svnno****@sourc*****
svnno****@sourc*****
2007年 7月 22日 (日) 11:29:47 JST
Revision: 508 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=macemacsjp&view=rev&rev=508 Author: matsuan Date: 2007-07-22 11:29:47 +0900 (Sun, 22 Jul 2007) Log Message: ----------- new function fixed-width-set-fontset Modified Paths: -------------- fixed-width-fontset/trunk/carbon-font.el fixed-width-fontset/trunk/fixed-width-fontset.el fixed-width-fontset/trunk/ntemacs-font.el -------------- next part -------------- Modified: fixed-width-fontset/trunk/carbon-font.el =================================================================== --- fixed-width-fontset/trunk/carbon-font.el 2007-07-05 21:29:06 UTC (rev 507) +++ fixed-width-fontset/trunk/carbon-font.el 2007-07-22 02:29:47 UTC (rev 508) @@ -1,8 +1,8 @@ ;;; carbon-font.el -- fontsets for Carbon Emacs -*- coding: iso-2022-7bit -*- ;; Copyright (C) 2004-2007 by T. Hiromatsu <matsu****@users*****> -;; Version 1_5_6 -;; 2007-06-28 +;; Version 1_5_7 +;; 2007-07-22 ;;; Commentary: @@ -45,7 +45,7 @@ ;; $B$+$iF~<j2DG=$G$9!#(B ;; ;;---------------------------------------------------------------------- -;; carbon-font.el 2007-06-28$BHG(B;; +;; carbon-font.el 2007-07-22$BHG(B;; ;; ;; 1. Introduction ;; 1.1. idea @@ -82,46 +82,14 @@ ;; (if (eq window-system 'mac) (require 'carbon-font)) ;; ;; 2.3. set fontset -;; If font is defined like as -;; "fontset-hirakaku_w3", -;; 12point of $B%R%i%.%N3Q%4%7%C%/(B(hiraginokaku) is used. +;; Use `fixed-width-set-fontset'. +;; Set fontset and size to `default-frame-alist' and `frame-parameter' of +;; current frame as `font'. if size is nil, default size of fontset will be used. +;; To get available fontset, use `fontset-list'. ;; -;; If you want to use other sizes, please use full XLFD name like as -;; "-*-*-medium-r-normal--8-*-*-*-*-*-fontset-hirakaku_w3" +;; example: +;; (fixed-width-set-fontset "hiramaru" 14) ;; -;; 2.3.1. If you are not familiar to emacs lisp, follow this section. -;; -;; To define default fontset, I suggest you to use -;; 'fixed-width-set-default-fontset as below. -;; 12point -;; (fixed-width-set-default-fontset "fontset-hirakaku_w3") -;; other sizes -;; (fixed-width-set-default-fontset -;; "-*-*-medium-r-normal--8-*-*-*-*-*-fontset-hirakaku_w3") -;; -;; On initial frame, to use different font from default one, please set -;; (add-to-list 'initial-frame-alist '(font . "fontset-hiramaru")) -;; or -;; (add-to-list -;; 'initial-frame-alist -;; '(font . "-*-*-medium-r-normal--8-*-*-*-*-*-fontset-hiramaru")) -;; -;; To change fontset only on current frame, set -;; (set-frame-font "fontset-hiramaru") -;; or -;; (set-frame-font -;; "-*-*-medium-r-normal--8-*-*-*-*-*-fontset-hiramaru") -;; -;; 2.3.2. If you are familiar to E-lisps -;; -;; In .emacs.el, by setting ('font . fontset-name) in -;; 'default-frame-alist -;; or -;; 'initial-frame-alist -;; font "fontset-name" should be used. -;; -;; To change font on current frame, please use 'set-frame-font. -;; ;; 2.4. disable compensation of font width ;; (setq fixed-width-rescale nil) ;; @@ -204,55 +172,19 @@ ;; carbon-font.el (this file) ;; fixed-width-fontset.el ;; -;; 2.2. load package +;; 2.2. $BFI$_9~$_(B ;; (if (eq window-system 'mac) (require 'carbon-font)) ;; $B$H$7$F$/$@$5$$!#(B ;; -;; 2.3. set fontset -;; $B<!$N$h$&$K;XDj$7$?>l9g!"(B -;; "fontset-hirakaku_w3" -;; $B%R%i%.%N3Q%4%7%C%/$N(B12point $B$,;H$o$l$^$9!#(B +;; 2.3. $B%U%)%s%H%;%C%H$r @ _Dj(B +;; `fixed-width-set-fontset' $B$r;H$$$^$9!#(B +;; Set fontset and size to `default-frame-alist' and `frame-parameter' of +;; current frame as `font'. if size is nil, default size of fontset will be used. +;; To get available fontset, use `fontset-list'. ;; -;; $B$3$l0J30$N%5%$%:$r;H$$$?$$>l9g$O!"(B -;; "-*-*-medium-r-normal--8-*-*-*-*-*-fontset-hiramaru" -;; $B$NMM$K!"%U%k(BXLFD$B%M!<%`$r;XDj$7$F$/$@$5$$!#(B +;; $BNc(B: +;; (fixed-width-set-fontset "hiramaru" 14) ;; -;; 2.3.1. emacs lisp $B$KFk @ w$NL5$$J}$N0Y$K(B -;; -;; $B%G%U%)%k%H$G;H$&%U%)%s%H%;%C%H$N;XDj$9$k>l9g$O0J2<$N$h$&$K(B -;; fixed-width-set-default-fontset $B$r;H$C$F$/$@$5$$!#(B -;; 12point$B$r;H$&>l9g(B -;; (fixed-width-set-default-fontset "fontset-hirakaku_w3") -;; 12point$B0J30$N%5%$%:$r;H$&>l9g(B -;; (fixed-width-set-default-fontset -;; "-*-*-medium-r-normal--8-*-*-*-*-*-fontset-hirakaku_w3") -;; -;; $B:G=i$N%U%l!<%`$@$1!"JL$N(Bfontset$B$r;H$$$?$$>l9g$O!"(B -;; (add-to-list 'initial-frame-alist '(font . "fontset-hiramaru")) -;; $B$d!"(B -;; (add-to-list -;; 'initial-frame-alist -;; '(font . "-*-*-medium-r-normal--8-*-*-*-*-*-fontset-hiramaru")) -;; $BEy$H$7$F2<$5$$!#(B -;; -;; $B:#%+!<%=%k$NM-$k%U%l!<%`$@$1!"%U%)%s%H$rJQ99$7$?$$>l9g$O!"(B -;; (set-frame-font "fontset-hiramaru") -;; $B$d(B -;; (set-frame-font -;; "-*-*-medium-r-normal--8-*-*-*-*-*-fontset-hiramaru") -;; $B$H$7$F$/$@$5$$!#(B -;; -;; 2.3.2. emacs lisp $B$rM}2r$7$F5o$i$l$kJ}$K(B -;; -;; .emacs.el $B$G(B -;; 'default-frame-alist -;; $B5Z$S(B -;; 'initial-frame-alist -;; $B$K!"(B('font . fontset-name) $B$r @ _Dj$9$k$3$H$K$h$j!"(Bfontset-name $B$,3F!9(B -;; $BM-8z$K$J$j$^$9!#(B -;; $BKt!"8=:_$N%U%l!<%`$N%U%)%s%H$rJQ99$9$k$K$O!"(Bset-frame-font $B$r$*;H$$(B -;; $B2<$5$$!#(B -;; ;; 2.4. $BEyI}Jd @ 5$r @ Z$j$?$$>l9g(B ;; (setq fixed-width-rescale nil) ;; $B$H$7$F$/$@$5$$!#(B Modified: fixed-width-fontset/trunk/fixed-width-fontset.el =================================================================== --- fixed-width-fontset/trunk/fixed-width-fontset.el 2007-07-05 21:29:06 UTC (rev 507) +++ fixed-width-fontset/trunk/fixed-width-fontset.el 2007-07-22 02:29:47 UTC (rev 508) @@ -94,6 +94,8 @@ (defvar fixed-width-rescale t) +(defvar fixed-width-fontset-template "-*-*-medium-r-normal--%d-*-*-*-*-*-fontset-%s") + ;; font-width-compensation function section ;; $B%+%l%s%H%U%l!<%`$G;H$o$l$F$$$k%U%)%s%H$N!"%j%9%1!<%k%U%!%/%?!<$r!"(B ;; fixed-width-scale-alist $B$+$i!"<hF@$9$k!#(B @@ -119,6 +121,19 @@ (if old (setcdr old fontset) (add-to-list 'default-frame-alist (cons 'font fontset))))) +(defun fixed-width-set-fontset (fontset &optional size) + "Set FONTSET and SIZE to `default-frame-alist' and `frame-parameter' of +current frame as `font'. if size is nil, default size of FONTSET will be used. +To get available fontset, use `fontset-list'." + (let* ((fnt-xlfd (fontset-font (format "fontset-%s" fontset) ?a)) + (sz-asc (aref (x-decompose-font-name fnt-xlfd) xlfd-regexp-pixelsize-subnum)) + (sz (or size (string-to-int sz-asc))) + (fnt (format fixed-width-fontset-template sz fontset)) + (old (assoc 'font default-frame-alist))) + (if old (setcdr old fnt) + (add-to-list 'default-frame-alist (cons 'font fnt))) + (if (current-frame-configuration) (set-frame-font fnt)))) + (defun fixed-width-make-frame-param (frame) "Add face-font-rescale-alist to frame parameters as frame local" (modify-frame-parameters frame Modified: fixed-width-fontset/trunk/ntemacs-font.el =================================================================== --- fixed-width-fontset/trunk/ntemacs-font.el 2007-07-05 21:29:06 UTC (rev 507) +++ fixed-width-fontset/trunk/ntemacs-font.el 2007-07-22 02:29:47 UTC (rev 508) @@ -1,8 +1,8 @@ ;;; ntemacs-font.el -- fontsets for Emacs on Windows -*- coding: iso-2022-7bit -*- ;; Copyright (C) 2004-2007 by T. Hiromatsu <matsu****@users*****> -;; Version 1_0_6 -;; 2007-06-03 +;; Version 1_0_7 +;; 2007-07-22 ;;; Commentary: @@ -41,7 +41,7 @@ ;; $B$+$iF~<j2DG=$G$9!#(B ;; ;;---------------------------------------------------------------------- -;; ntemacs-font.el 2005-09-13$BHG(B;; +;; ntemacs-font.el 2007-07-22$BHG(B;; ;; ;; 1. Introduction ;; 1.1. idea @@ -59,7 +59,7 @@ ;; then totally 20 fontsets were defined. ;; ;; 1.2. Emacs version -;; ntemacs-font supports only CVS version of Emacs. +;; ntemacs-font supports after 22.1. ;; ;; 2. Usage ;; 2.1. Installation @@ -68,20 +68,16 @@ ;; fixed-width-fontset.el ;; ;; 2.2. load package -;; (if (eq window-system 'w32) (require 'ntemacs-font)) +;; (if (eq window-system 'mac) (require 'carbon-font)) ;; ;; 2.3. set fontset -;; Fontset names doesn't include size. If you set the fontset like as -;; (set-default-font "fontset-msgothic") -;; font size was set to 12 (default). +;; Use `fixed-width-set-fontset'. +;; Set fontset and size to `default-frame-alist' and `frame-parameter' of +;; current frame as `font'. if size is nil, default size of fontset will be used. +;; To get available fontset, use `fontset-list'. ;; -;; If you want to use another size, please use full fontset name like as -;; (set-default-font -;; "-*-*-medium-r-normal--10-*-*-*-*-*-fontset-msgothic") -;; or -;; (add-to-list -;; 'default-frame-alist -;; '(font . "-*-*-medium-r-normal--10-*-*-*-*-*-fontset-msgothic")) +;; example: +;; (fixed-width-set-fontset "msgothic" 14) ;; ;; 2.4. recommendation ;; I strongly recommend to set like as below. @@ -133,7 +129,7 @@ ;; default$B$N%5%$%:$O!"(B12$B$G$9!#(B ;; ;; 1.2. $BF0:n4D6-(B -;; emacs on W32 $B$O!"(BCVS$B$+$iF~<j$7$?J*$r8f;H$$$/$@$5$$!#(B +;; emacs on W32 $B$O!"(B22.1 $B0J9_$r%5%]!<%H$7$^$9!#(B ;; ;; 2. Usage($B;H$$J}(B) ;; 2.1. Install @@ -141,27 +137,19 @@ ;; ntemacs-font.el (this file) ;; fixed-width-fontset.el ;; -;; 2.2. load package +;; 2.2. $BFI$_9~$_(B ;; (if (eq window-system 'w32) (require 'ntemacs-font)) ;; $B$H$7$F$/$@$5$$!#(B ;; -;; 2.3. set fontset -;; $B<!$N$h$&$K$7$?>l9g!"(B -;; (set-default-font "fontset-msgothic") -;; $B#M#S%4%7%C%/$N(B12point $B$,;H$o$l$^$9!#(B +;; 2.3. $B%U%)%s%H%;%C%H$r @ _Dj(B +;; `fixed-width-set-fontset' $B$r;H$$$^$9!#(B +;; Set fontset and size to `default-frame-alist' and `frame-parameter' of +;; current frame as `font'. if size is nil, default size of fontset will be used. +;; To get available fontset, use `fontset-list'. ;; -;; $B$3$l0J30$N%5%$%:$r;H$$$?$$>l9g$O!"(B -;; (set-default-font -;; "-*-*-medium-r-normal--10-*-*-*-*-*-fontset-msgothic") -;; $BKt$O(B -;; (add-to-list -;; 'default-frame-alist -;; '(font . "-*-*-medium-r-normal--10-*-*-*-*-*-fontset-msgothic")) -;; $B$H$7$F$/$@$5$$!#(B +;; $BNc(B: +;; (fixed-width-set-fontset "msgothic" 14) ;; -;; $B:G=i$O!"(Bfontset$B$N;XDj$r$7$J$$$G!"(Bshift + click $B$G=P$F$/$k!"(Bfontset -;; menu $B$+$i!"$*9%$_$NJ*$rC5$9J}$,NI$$$+$b$7$l$^$;$s!#(B -;; ;; 2.4. recomendation ;; $B0J2<$N @ _Dj$rDI2C$5$l$k$3$H$r!"6/$/$*4+$a$7$^$9!#(B ;; (setq w32-use-w32-font-dialog nil)