From 52d77256f56322be003610acf88652297f7e59608d9bb3f353140162ca8358a5 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Fri, 13 Jul 2007 20:25:30 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/xemacs?expand=0&rev=12 --- suse-xft-init.el | 105 +++++++++++++++++++++++++++++++++++++++++++++++ xemacs.changes | 8 ++++ xemacs.patch | 5 ++- xemacs.spec | 13 +++++- 4 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 suse-xft-init.el diff --git a/suse-xft-init.el b/suse-xft-init.el new file mode 100644 index 0000000..70c1d2a --- /dev/null +++ b/suse-xft-init.el @@ -0,0 +1,105 @@ +;;; -*- mode: emacs-lisp -*- + +;;; Fri Jul 13 20:43:53 2007 Mike FABIAN + +(setq xft-debug-level 0) ;; default is 1. Set to 0 to suppress all warnings + +(setq suse-xft-lang-tags + (list "ar" + "en" + "de" + "he" + "ko" + "zh-TW" + "zh-CN" + "ja" + "th" + "vi")) + +(mapcar (lambda (x) (define-specifier-tag (intern x))) suse-xft-lang-tags) + +(defun suse-xft-find-font-for-tag (tag) + "uses fc-match to find a suitable font for tag" + (let* ((fc-match-result (shell-command-to-string + (format "fc-match monospace:lang=%s" tag))) + (family (nth 1 (split-string fc-match-result "\""))) + (style (nth 3 (split-string fc-match-result "\"")))) + (format "%s:style=%s" family style))) + + +(defun suse-xft-make-fonts-alist (tags) + "returns an alist of with the tags as keys and suitable fonts as values" + (let ((fonts-alist nil)) + (mapcar + (lambda (x) + (setq fonts-alist + (cons (cons x (suse-xft-find-font-for-tag x)) + fonts-alist))) + tags) + (reverse fonts-alist))) + +(setq suse-xft-fonts-alist (suse-xft-make-fonts-alist suse-xft-lang-tags)) + +;; tune the defaults returned by fc-match according to taste: +;; For example, I prefer "DejaVu Sans Mono" as the standard +;; font even if another font is the default for "monospace" +;; because "DejaVu Sans Mono" has a lot more special symbols +;; than most other monospaced fonts. + +(if (not (equal "" (shell-command-to-string "fc-list \"DejaVu Sans Mono\""))) + (setf (cdr (assoc "en" suse-xft-fonts-alist)) "DejaVu Sans Mono")) + +(defun suse-xft-set-all-faces (size) + "tries to set reasonable fonts for all faces" + (interactive "nnew size for all faces: ") + (setq suse-xft-current-size size) + (when (console-on-window-system-p) + (mapcar + (lambda (face) + (progn + ;; first set the English font as the standard font for all faces + (set-face-font face + (format "%s:size=%d" + (cdr (assoc "en" suse-xft-fonts-alist)) + size)) + ;; then append the fonts for the other languages + (mapcar + (lambda (tag) + (set-face-font face + (format "%s:size=%d" + (cdr (assoc tag suse-xft-fonts-alist)) + size) + nil + (list (intern tag)) + 'remove-tag-set-append)) + suse-xft-lang-tags) + (if (string-match "bold-italic" (symbol-name face)) + (make-face-bold-italic face) + (if (string-match "bold" (symbol-name face)) + (make-face-bold face)) + (if (string-match "italic" (symbol-name face)) + (make-face-italic face))) + (if (fboundp 'custom-face-get-spec) + (if (and (eq t (plist-get (cadr (assoc t (custom-face-get-spec face))) :bold)) + (eq t (plist-get (cadr (assoc t (custom-face-get-spec face))) :italic))) + (make-face-bold-italic face) + (if (eq t (plist-get (cadr (assoc t (custom-face-get-spec face))) :bold)) + (make-face-bold face)) + (if (eq t (plist-get (cadr (assoc t (custom-face-get-spec face))) :italic)) + (make-face-italic face)))) + )) + (face-list)))) + +(defun suse-xft-change-size (delta) + (interactive "nsize change in point (may be negative): ") + (setq suse-xft-current-size (+ delta suse-xft-current-size)) + (if (> 1 suse-xft-current-size) + (setq suse-xft-current-size 1)) + (suse-xft-set-all-faces suse-xft-current-size)) + +(setq suse-xft-current-size 12) + +(suse-xft-set-all-faces suse-xft-current-size) + + + diff --git a/xemacs.changes b/xemacs.changes index f29c649..237c44a 100644 --- a/xemacs.changes +++ b/xemacs.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Jul 13 19:49:34 CEST 2007 - mfabian@suse.de + +- enable the use of Xft if XEmacs is built in the openSUSE + build service (keep using X11 core fonts when XEmacs is built + in autobuild). +- add some suse-xft-init.el to do some default Xft font setup. + ------------------------------------------------------------------- Thu Jul 12 12:46:38 CEST 2007 - mfabian@suse.de diff --git a/xemacs.patch b/xemacs.patch index 3049202..a4276f7 100644 --- a/xemacs.patch +++ b/xemacs.patch @@ -308,7 +308,7 @@ diff -Nru xemacs-21.5.20.orig/lisp/x-win-xfree86.el xemacs-21.5.20/lisp/x-win-xf diff -Nru xemacs-21.5.21.orig/site-packages/lisp/site-start.el xemacs-21.5.21/site-packages/lisp/site-start.el --- xemacs-21.5.21.orig/site-packages/lisp/site-start.el 1970-01-01 01:00:00.000000000 +0100 +++ xemacs-21.5.21/site-packages/lisp/site-start.el 2005-06-17 12:48:11.000000000 +0200 -@@ -0,0 +1,406 @@ +@@ -0,0 +1,409 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; File name: ` /usr/share/xemacs/site-lisp/site-start.el ' +;;; System wide start file for xemacs. @@ -713,6 +713,9 @@ diff -Nru xemacs-21.5.21.orig/site-packages/lisp/site-start.el xemacs-21.5.21/si + (suse-list-unsupported-codepoints-range '(#xFB00 #xFFFF)) + )) + ++(if (and (boundp 'xft-version) (eq window-system 'x)) ++ (load "suse-xft-init.el" t t)) ++ +;;;;;;;;;; +;; the end diff -Nru xemacs-21.5.20.orig/site-packages/lisp/term/func-keys.el xemacs-21.5.20/site-packages/lisp/term/func-keys.el diff --git a/xemacs.spec b/xemacs.spec index 3d5327f..f837620 100644 --- a/xemacs.spec +++ b/xemacs.spec @@ -37,7 +37,7 @@ Requires: xemacs-info xemacs-packages ctags Conflicts: gnuserv Autoreqprov: on Version: 21.5.28 -Release: 13 +Release: 14 Summary: XEmacs BuildRoot: %{_tmppath}/%{name}-%{version}-build # Howto get the cvs tree of XEmacs: @@ -58,6 +58,7 @@ Source1: xe-list.el Source2: fix-load-history.el Source3: xemacs.desktop Source4: xemacs.png +Source5: suse-xft-init.el Patch0: xemacs.patch # keep in sync with the similar patch to the app-defaults in the main xemacs-packages package: Patch3: xemacs-21.4.8-app-defaults.patch @@ -171,6 +172,7 @@ find lisp/ etc/ -name '*.elc' | xargs -r rm -f %define enable_pdump 1 %endif %define enable_dump_in_exec 0 +%define enable_xft 0%{?opensuse_bs} find . -name CVS -type d | xargs rm -rf find . -name .cvsignore -type f | xargs rm -f chmod -R u+w * @@ -274,6 +276,9 @@ SPECIAL="--enable-database=gdbm,berkdb \ %else --enable-pdump=no \ %endif +%if %enable_xft + --with-xft=emacs,tabs,gauges \ +%endif " # # Graphics and X window system @@ -417,6 +422,7 @@ mkdir -p $RPM_BUILD_ROOT%{appdefdir}/app-defaults/ install -m 644 etc/Emacs.ad $RPM_BUILD_ROOT%{appdefdir}/app-defaults/XEmacs # SuSE extension install -m 0644 site-packages/lisp/site-start.el $RPM_BUILD_ROOT/usr/share/xemacs/site-packages/lisp/ +install -m 0644 $RPM_SOURCE_DIR/suse-xft-init.el $RPM_BUILD_ROOT/usr/share/xemacs/site-packages/lisp/ install -m 0644 site-packages/lisp/term/func-keys.el $RPM_BUILD_ROOT/usr/share/xemacs/site-packages/lisp/term/ install -m 0644 site-packages/lisp/term/linux.el $RPM_BUILD_ROOT/usr/share/xemacs/site-packages/lisp/term/ install -m 0644 site-packages/lisp/term/xterm.el $RPM_BUILD_ROOT/usr/share/xemacs/site-packages/lisp/term/ @@ -548,6 +554,11 @@ rm -rf $RPM_BUILD_ROOT %dir /usr/share/xemacs/site-packages/lisp/term/ %changelog +* Fri Jul 13 2007 - mfabian@suse.de +- enable the use of Xft if XEmacs is built in the openSUSE + build service (keep using X11 core fonts when XEmacs is built + in autobuild). +- add some suse-xft-init.el to do some default Xft font setup. * Thu Jul 12 2007 - mfabian@suse.de - add "Conflicts: gnuserv" (XEmacs already has it's own version of gnuserv).