unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* set-fontset-font
@ 2008-07-16  6:23 Miles Bader
  2008-07-16  6:55 ` set-fontset-font Kenichi Handa
  0 siblings, 1 reply; 4+ messages in thread
From: Miles Bader @ 2008-07-16  6:23 UTC (permalink / raw)
  To: emacs-devel

In a fresh emacs, started with "emacs -Q", I can change the font used
for e.g. japanese characters by doing:

   (set-fontset-font "fontset-default" 'kana "メイリオ")
   (set-fontset-font "fontset-default" 'han "メイリオ")

where "メイリオ" is the name of the font.  This works fine.

However in my normal emacs, it _doesn't_ work -- the font emacs uses for
Japanse character doesn't change.

_Should_ the above work?  Is there better way to do it...?  What does
"fontset-default" really mean, anyway?

Thanks,

-Miles

-- 
Advice, n. The smallest current coin.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: set-fontset-font
  2008-07-16  6:23 set-fontset-font Miles Bader
@ 2008-07-16  6:55 ` Kenichi Handa
  2008-07-16 14:08   ` set-fontset-font Miles Bader
  0 siblings, 1 reply; 4+ messages in thread
From: Kenichi Handa @ 2008-07-16  6:55 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel

In article <buoprpegxdx.fsf@dhapc248.dev.necel.com>, Miles Bader <miles.bader@necel.com> writes:

> In a fresh emacs, started with "emacs -Q", I can change the font used
> for e.g. japanese characters by doing:

>    (set-fontset-font "fontset-default" 'kana "メイリオ")
>    (set-fontset-font "fontset-default" 'han "メイリオ")

> where "メイリオ" is the name of the font.  This works fine.

> However in my normal emacs, it _doesn't_ work -- the font emacs uses for
> Japanse character doesn't change.

I have not yet decided how to manage non-ASCII
family/foundry/adstyle names.  Currently, perhaps this will
work:

   (set-fontset-font "fontset-default" 'kana
      (encode-coding-string "メイリオ" 'utf-8))
   (set-fontset-font "fontset-default" 'ha
      (encode-coding-string "メイリオ" 'utf-8))

In the future, of course, I'll fix the code so that your
original setting work.

> What does "fontset-default" really mean, anyway?

A fontset maps a non-ASCII character to a group of fonts
(font-group).

Usually, two fontsets "fontset-startup" and
"fontset-default" are active.  "fontset-startup" is made
automatically and it maps Latin characters to the default
font and set the fallback font to the default font.  The
mapping of both fonts may be modified by a user.

To decide a font for a non-ASCII character CH, Emacs does
this:

(1) Check "fontset-startup".  If CH is mapped to a
    font-gourp and one of the font supports CH, that font is
    used.  Otherwise...

(2) Check "fontset-default".  If CH is mapped to a
    font-gourp and one of the font supports CH, that font is
    used.  Otherwise...

(3) Check the fallback font-group of "fontset-startup".  If
    CH is mapped....   Otherwise...

(4) Check the fallback font-group of "fontset-default".  If
    CH is mapped....   Otherwise...

(5) Give up finding a font for CH.

So, in short, "fontset-default" gives the default
information about fonts to support each character
(e.g. Devanagari fonts requires this and that OTF features).


---
Kenichi Handa
handa@ni.aist.go.jp




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: set-fontset-font
  2008-07-16  6:55 ` set-fontset-font Kenichi Handa
@ 2008-07-16 14:08   ` Miles Bader
  2008-07-17  0:29     ` set-fontset-font Kenichi Handa
  0 siblings, 1 reply; 4+ messages in thread
From: Miles Bader @ 2008-07-16 14:08 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=iso-2022-jp-2, Size: 2274 bytes --]

Kenichi Handa <handa@m17n.org> writes:
> I have not yet decided how to manage non-ASCII
> family/foundry/adstyle names.  Currently, perhaps this will
> work:
>
>    (set-fontset-font "fontset-default" 'kana
>       (encode-coding-string "^[$B%a%$%j%*^[(B" 'utf-8))
>    (set-fontset-font "fontset-default" 'ha
>       (encode-coding-string "^[$B%a%$%j%*^[(B" 'utf-8))

Hmm no, that doesn't work either.  (nothing seems to change)

I wonder if it's really the font-name encoding that's the problem, though,
because:

 (1) My original example (which didin't use encode-coding-string)
     actually _does_ work in "emacs -q".

 (2) If I use the ascii name of the font (as shown by fc-list), the
     following still _doesn't_ work in my current emacs session:

       (set-fontset-font "fontset-default" 'kana "Meiryo")
       (set-fontset-font "fontset-default" 'han "Meiryo")

Here's what fc-list says about the font BTW:

   $ fc-list meiryo
   ^[$B%a%$%j%*^[(B,Meiryo:style=^[$B%\!<%k%I^[(B,Negreta,tu^[$(D+-^[(Bn^[$(D+1^[(B,fed,Fett,^[$(D&b^[$B&M&S&O&M&A^[(B,Bold,Negrita,Lihavoitu,Gras,F^[$(D+1^[(Blk^[$(D+S^[(Bv^[$(D+1^[(Br,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,^[$B'1'`']'e'X'Z'b'_'m'[^[(B,Fet,Kal^[$(D)E^[(Bn,Krepko,Lodia
   ^[$B%a%$%j%*^[(B,Meiryo:style=^[$B%\!<%k%I^[(B ^[$B%$%?%j%C%/^[(B,Negreta cursiva,tu^[$(D+-^[(Bn^[$(D+1^[(B kurz^[$(D+?^[(Bva,fed kursiv,Fett Kursiv,^[$(D&b^[$B&M&S&O&M&A^[(B ^[$B&0&K^[$(D&q^[$B&C&I&A^[(B,Bold Italic,Negrita Cursiva,Lihavoitu Kursivoi,Gras Italique,F^[$(D+1^[(Blk^[$(D+S^[(Bv^[$(D+1^[(Br d^[$(D+V^[(Blt,Grassetto Corsivo,Vet Cursief,Halvfet Kursiv,Pogrubiona kursywa,Negrito It^[$(D+!^[(Blico,^[$B'1'`']'e'X'Z'b'_'m'[^[(B ^[$B','e'b'c'Z'S^[(B,Tu^[$(D+-^[(Bn^[$(D+!^[(B kurz^[$(D+?^[(Bva,Fet Kursiv,Kal^[$(D)E^[(Bn ^[$(D*D^[(Btalik,Krepko po^[$(D+^^[(Bevno,Lodi etzana
   ^[$B%a%$%j%*^[(B,Meiryo:style=^[$B%$%?%j%C%/^[(B,Cursiva,kurz^[$(D+?^[(Bva,kursiv,^[$B&0&K^[$(D&q^[$B&C&I&A^[(B,Italic,Kursivoitu,Italique,D^[$(D+V^[(Blt,Corsivo,Cursief,Kursywa,It^[$(D+!^[(Blico,^[$B','e'b'c'Z'S^[(B,^[$(D*D^[(Btalik,Po^[$(D+^^[(Bevno,Etzana
   ^[$B%a%$%j%*^[(B,Meiryo:style=^[$B%l%.%e%i!<^[(B,Normal,oby^[$(D+-^[(Bejn^[$(D+1^[(B,Standard,^[$B&*&A&M&O&M&I&J^[$(D&q^[(B,Regular,Normaali,Norm^[$(D+!^[(Bl,Normale,Standaard,Normalny,^[$B'0'R'm'i'_'m'[^[(B,Norm^[$(D+!^[(Blne,Navadno,Arrunta


Thanks,

-Miles

-- 
97% of everything is grunge




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: set-fontset-font
  2008-07-16 14:08   ` set-fontset-font Miles Bader
@ 2008-07-17  0:29     ` Kenichi Handa
  0 siblings, 0 replies; 4+ messages in thread
From: Kenichi Handa @ 2008-07-17  0:29 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel

In article <buo1w1thqgg.fsf@dhapc248.dev.necel.com>, Miles Bader <miles.bader@necel.com> writes:

> I wonder if it's really the font-name encoding that's the problem, though,
> because:

>  (1) My original example (which didin't use encode-coding-string)
>      actually _does_ work in "emacs -q".

Ah, hmmm.

>  (2) If I use the ascii name of the font (as shown by fc-list), the
>      following still _doesn't_ work in my current emacs session:

>        (set-fontset-font "fontset-default" 'kana "Meiryo")
>        (set-fontset-font "fontset-default" 'han "Meiryo")

Please try this and show me the result:

(1) start Emacs
(2) ESC : (set-fontset-font "fontset-default" 'kana ("Meiryo") RET
(3) ESC : (setq font-log t) RET
(4) insert a Kana character
(5) M-x font-show-log RET

---
Kenichi Handa
handa@ni.aist.go.jp




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-07-17  0:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-16  6:23 set-fontset-font Miles Bader
2008-07-16  6:55 ` set-fontset-font Kenichi Handa
2008-07-16 14:08   ` set-fontset-font Miles Bader
2008-07-17  0:29     ` set-fontset-font Kenichi Handa

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).