Subject: bug#4895: 23.1; Incorrect font selected

From: Eli Zaretskii <[email-masked]>
Date: Mon, 09 Jul 2012 19:41:20 +0300

> From: Chong Yidong <[email-masked]>
> Date: Mon, 09 Jul 2012 13:26:55 +0800
> Cc: [email-masked], [email-masked], Kenichi Handa <[email-masked]>
> 
> Also, where in the code does this
> 
> >> when you read a file with cp1251, the charset property
> >> `cp1251' is put on the buffer text.  Thus the font-selector
> >> prefers a font whose registry is "microsoft-cp1251".
> 
> occur?

decode_coding calls produce_annotation that calls produce_charset,
which puts the 'charset' text property on the decoded text.

Then font_for_char uses this property to get the charset ID with which
it calls fontset_font, which in turn calls fontset_find_font, which
prefers fonts whose repertory matches that ID.

> I took a quick look at the documentation, e.g. the docstring of
> new-fontset, and couldn't find the explanation of how the
> font-selector chooses the font to use from the list of font
> specifications.  If the list of font specifications is not given in
> order of priority, that should be clearly explained somewhere.

The documentation of fontset stuff could use a lot of improvement.