all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Custom font sets doesn't fully work
@ 2021-07-31  1:14 Yuan Fu
  2021-07-31  6:42 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Yuan Fu @ 2021-07-31  1:14 UTC (permalink / raw)
  To: help-gnu-emacs

This is what I did (in emacs -q)

(create-fontset-from-fontset-spec
 (font-xlfd-name
  (font-spec :registry "fontset-lunamono")))

(set-fontset-font "fontset-lunamono"
                  'latin (font-spec :family "SF Mono"))
(set-fontset-font "fontset-lunamono"
                  'han (font-spec :family "Source Han Sans"))

(set-face-attribute 'default nil :font "fontset-lunamono" :height 130)

Now I expect Latin characters show in SF Mono, and Han characters show in Source Han Sans. However, only Latin characters work right, Han characters doesn’t use Source Han Sans.

If I use fontset-default instead:

(set-fontset-font "fontset-default"
                  'latin (font-spec :family "SF Mono"))
(set-fontset-font "fontset-default"
                  'han (font-spec :family "Source Han Sans”))

Both Latin and Han characters show in the right fonts. What gives?

Yuan


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

* Re: Custom font sets doesn't fully work
  2021-07-31  1:14 Custom font sets doesn't fully work Yuan Fu
@ 2021-07-31  6:42 ` Eli Zaretskii
  2021-07-31 17:19   ` Yuan Fu
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2021-07-31  6:42 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Yuan Fu <casouri@gmail.com>
> Date: Fri, 30 Jul 2021 21:14:23 -0400
> 
> (create-fontset-from-fontset-spec
>  (font-xlfd-name
>   (font-spec :registry "fontset-lunamono")))
> 
> (set-fontset-font "fontset-lunamono"
>                   'latin (font-spec :family "SF Mono"))
> (set-fontset-font "fontset-lunamono"
>                   'han (font-spec :family "Source Han Sans"))
> 
> (set-face-attribute 'default nil :font "fontset-lunamono" :height 130)
> 
> Now I expect Latin characters show in SF Mono, and Han characters show in Source Han Sans. However, only Latin characters work right, Han characters doesn’t use Source Han Sans.
> 
> If I use fontset-default instead:
> 
> (set-fontset-font "fontset-default"
>                   'latin (font-spec :family "SF Mono"))
> (set-fontset-font "fontset-default"
>                   'han (font-spec :family "Source Han Sans”))
> 
> Both Latin and Han characters show in the right fonts. What gives?

I don't know the answer, but did you try "M-x describe-fontset" and
compare the results in both cases regarding the 'han' characters?

Also, which Han characters didn't show in the right font, and what is
the script of those characters (see char-script-table)?



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

* Re: Custom font sets doesn't fully work
  2021-07-31  6:42 ` Eli Zaretskii
@ 2021-07-31 17:19   ` Yuan Fu
  2021-07-31 17:26     ` Eli Zaretskii
  2021-07-31 17:29     ` Yuan Fu
  0 siblings, 2 replies; 7+ messages in thread
From: Yuan Fu @ 2021-07-31 17:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs



> On Jul 31, 2021, at 2:42 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Fri, 30 Jul 2021 21:14:23 -0400
>> 
>> (create-fontset-from-fontset-spec
>> (font-xlfd-name
>>  (font-spec :registry "fontset-lunamono")))
>> 
>> (set-fontset-font "fontset-lunamono"
>>                  'latin (font-spec :family "SF Mono"))
>> (set-fontset-font "fontset-lunamono"
>>                  'han (font-spec :family "Source Han Sans"))
>> 
>> (set-face-attribute 'default nil :font "fontset-lunamono" :height 130)
>> 
>> Now I expect Latin characters show in SF Mono, and Han characters show in Source Han Sans. However, only Latin characters work right, Han characters doesn’t use Source Han Sans.
>> 
>> If I use fontset-default instead:
>> 
>> (set-fontset-font "fontset-default"
>>                  'latin (font-spec :family "SF Mono"))
>> (set-fontset-font "fontset-default"
>>                  'han (font-spec :family "Source Han Sans”))
>> 
>> Both Latin and Han characters show in the right fonts. What gives?
> 
> I don't know the answer, but did you try "M-x describe-fontset" and
> compare the results in both cases regarding the 'han' characters?
> 
> Also, which Han characters didn't show in the right font, and what is
> the script of those characters (see char-script-table)?
> 

If I evaluate this in emacs -q:

(progn
  (create-fontset-from-fontset-spec
   (font-xlfd-name
    (font-spec :registry "fontset-lunamono")))
  (set-fontset-font "fontset-lunamono"
                    'han
                    (font-spec :family "Source Han Sans"))
  (set-fontset-font "fontset-default"
                    'han
                    (font-spec :family "Source Han Sans"))
  (describe-fontset "fontset-lunamono”))

Lunamono fontset looks like this:

Fontset: -*-*-*-*-*-*-*-*-*-*-*-*-fontset-lunamono
CHAR RANGE (CODE RANGE)
    FONT NAME (REQUESTED and [OPENED])
⺀ .. ⿟ (#x2E80 .. #x2FDF)
    -*-Source Han Sans-*-*-*-*-*-*-*-*-*-*-*-*
㈀ .. 鿿 (#x3200 .. #x9FFF)
    -*-Source Han Sans-*-*-*-*-*-*-*-*-*-*-*-*
豈 .. 﫿 (#xF900 .. #xFAFF)
    -*-Source Han Sans-*-*-*-*-*-*-*-*-*-*-*-*
︰ .. ﹏ (#xFE30 .. #xFE4F)
    -*-Source Han Sans-*-*-*-*-*-*-*-*-*-*-*-*
🈀 .. 🋿 (#x1F200 .. #x1F2FF)
    -*-Source Han Sans-*-*-*-*-*-*-*-*-*-*-*-*
𠀀 .. 𪛟 (#x20000 .. #x2A6DF)
    -*-Source Han Sans-*-*-*-*-*-*-*-*-*-*-*-*
𪜀 .. 𮯯 (#x2A700 .. #x2EBEF)
    -*-Source Han Sans-*-*-*-*-*-*-*-*-*-*-*-*
丽 .. 𯨟 (#x2F800 .. #x2FA1F)
    -*-Source Han Sans-*-*-*-*-*-*-*-*-*-*-*-*
𰀀 .. 𱍏 (#x30000 .. #x3134F)
    -*-Source Han Sans-*-*-*-*-*-*-*-*-*-*-*-*

  ---<fallback to the default fontset>—
…

And (one of) default fontset’s Han script section looks like:

㈀ .. 鿿 (#x3200 .. #x9FFF)
    -*-Source Han Sans-*-*-*-*-*-*-*-*-*-*-*-*

AFAICT fontsets work as expected. Could it be the face not picking up the correct font to use? It seems to only pick up the default font of the fontset.

BTW, what should fontset-font do? (fontset-font "fontset-default" #x3200) doesn’t return “Source Han sans” as I thought it would, judging from the result of describe-fontset.

Yuan




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

* Re: Custom font sets doesn't fully work
  2021-07-31 17:19   ` Yuan Fu
@ 2021-07-31 17:26     ` Eli Zaretskii
  2021-07-31 21:41       ` Yuan Fu
  2021-07-31 17:29     ` Yuan Fu
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2021-07-31 17:26 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 31 Jul 2021 13:19:54 -0400
> Cc: help-gnu-emacs@gnu.org
> 
> AFAICT fontsets work as expected. Could it be the face not picking up the correct font to use? It seems to only pick up the default font of the fontset.
> 
> BTW, what should fontset-font do? (fontset-font "fontset-default" #x3200) doesn’t return “Source Han sans” as I thought it would, judging from the result of describe-fontset.

This area in Emacs is notoriously under-documented and might have
bugs.  So I suggest to file a bug report with the details, and we will
try to ask Kenichi Handa, who wrote large parts of the relevant code,
to look into that when he has time.



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

* Re: Custom font sets doesn't fully work
  2021-07-31 17:19   ` Yuan Fu
  2021-07-31 17:26     ` Eli Zaretskii
@ 2021-07-31 17:29     ` Yuan Fu
  1 sibling, 0 replies; 7+ messages in thread
From: Yuan Fu @ 2021-07-31 17:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

> 
> AFAICT fontsets work as expected. Could it be the face not picking up the correct font to use? It seems to only pick up the default font of the fontset.

Suspecting this, I tried the following, and indeed latin characters don’t show the expected SF Mono font either, even though the fondest seems to be correct.

(create-fontset-from-fontset-spec
 (font-xlfd-name
  (font-spec :registry "fontset-lunamono")))
(set-fontset-font "fontset-lunamono" 'latin (font-spec :family "SF Mono"))
(set-face-attribute 'default nil :font "fontset-lunamono”)

Fontset: -*-*-*-*-*-*-*-*-*-*-*-*-fontset-lunamono
CHAR RANGE (CODE RANGE)
    FONT NAME (REQUESTED and [OPENED])
C-@ .. DEL
    -*-SF Mono-*-*-*-*-*-*-*-*-*-*-*-*
  .. ɏ (#xA0 .. #x24F)
    -*-SF Mono-*-*-*-*-*-*-*-*-*-*-*-*
ʰ .. ͯ (#x2B0 .. #x36F)
    -*-SF Mono-*-*-*-*-*-*-*-*-*-*-*-*
᪰ .. ᫿ (#x1AB0 .. #x1AFF)
    -*-SF Mono-*-*-*-*-*-*-*-*-*-*-*-*
᷀ .. ỿ (#x1DC0 .. #x1EFF)
    -*-SF Mono-*-*-*-*-*-*-*-*-*-*-*-*
Ⱡ .. Ɀ (#x2C60 .. #x2C7F)
    -*-SF Mono-*-*-*-*-*-*-*-*-*-*-*-*
꜀ .. ꟿ (#xA700 .. #xA7FF)
    -*-SF Mono-*-*-*-*-*-*-*-*-*-*-*-*
ꬰ .. ꭯ (#xAB30 .. #xAB6F)
    -*-SF Mono-*-*-*-*-*-*-*-*-*-*-*-*
ff .. st (#xFB00 .. #xFB06)
    -*-SF Mono-*-*-*-*-*-*-*-*-*-*-*-*
︠ .. ︯ (#xFE20 .. #xFE2F)
    -*-SF Mono-*-*-*-*-*-*-*-*-*-*-*-*

  ---<fallback to the default fontset>—
...

Yuan


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

* Re: Custom font sets doesn't fully work
  2021-07-31 17:26     ` Eli Zaretskii
@ 2021-07-31 21:41       ` Yuan Fu
  2021-08-01  6:04         ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Yuan Fu @ 2021-07-31 21:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs



> On Jul 31, 2021, at 1:26 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Sat, 31 Jul 2021 13:19:54 -0400
>> Cc: help-gnu-emacs@gnu.org
>> 
>> AFAICT fontsets work as expected. Could it be the face not picking up the correct font to use? It seems to only pick up the default font of the fontset.
>> 
>> BTW, what should fontset-font do? (fontset-font "fontset-default" #x3200) doesn’t return “Source Han sans” as I thought it would, judging from the result of describe-fontset.
> 
> This area in Emacs is notoriously under-documented and might have
> bugs.  So I suggest to file a bug report with the details, and we will
> try to ask Kenichi Handa, who wrote large parts of the relevant code,
> to look into that when he has time.
> 

I had a look at the code, but I don’t have gdb and couldn’t really tell what’s going on. Anyway, I opened #49793. Do I need to CC him or something in debbugs?

Yuan


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

* Re: Custom font sets doesn't fully work
  2021-07-31 21:41       ` Yuan Fu
@ 2021-08-01  6:04         ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2021-08-01  6:04 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 31 Jul 2021 17:41:20 -0400
> Cc: help-gnu-emacs@gnu.org
> 
> > This area in Emacs is notoriously under-documented and might have
> > bugs.  So I suggest to file a bug report with the details, and we will
> > try to ask Kenichi Handa, who wrote large parts of the relevant code,
> > to look into that when he has time.
> > 
> 
> I had a look at the code, but I don’t have gdb and couldn’t really
> tell what’s going on.

Yes, the code is complicated and not easy to understand even with GDB.

> Anyway, I opened #49793. Do I need to CC him or something in debbugs?

Thanks, I CC'ed him.



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

end of thread, other threads:[~2021-08-01  6:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-31  1:14 Custom font sets doesn't fully work Yuan Fu
2021-07-31  6:42 ` Eli Zaretskii
2021-07-31 17:19   ` Yuan Fu
2021-07-31 17:26     ` Eli Zaretskii
2021-07-31 21:41       ` Yuan Fu
2021-08-01  6:04         ` Eli Zaretskii
2021-07-31 17:29     ` Yuan Fu

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.