help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Japanese font settings ?


From: Jean-Christophe Helary
Subject: Re: Japanese font settings ?
Date: Sat, 23 May 2020 16:38:00 +0900

>> If you don't have an answer to that, that's fine. I just want to change a 
>> font, not spend a day reading a reference. The emacs manual doesn't have an 
>> answer to that. It should.
> 
> I don't yet see whether the Emacs user manual has an answer.  It has
> several examples in the node "Modifying Fontsets" that are very close
> to what AFAIU you needed.  Did you see those examples and tried to
> follow them?  If so, what didn't work?

============================================================
Fontsets can be modified using the function `set-fontset-font',
specifying a character, a charset, a script, or a range of characters
to modify the font for, and a font specification for the font to be
used.  Some examples are:

     ;; Use Liberation Mono for latin-3 charset.
     (set-fontset-font "fontset-default" 'iso-8859-3
                       "Liberation Mono")
============================================================

1) I don't know what character set I'm supposed to specify for a page with 
potentially French/English/Japanese and I *don't* want to set a Japanese font 
for French strings.

For ex, after checking list-character-sets I see that japanese-jisx0212 covers 
accented French letters. I don't want to use a Japanese font for such 
characters (it happens that using set-fontset-font with jisx0212 does not 
change the font used for French characters, and then I have no idea why not).

2) the Emacs manual does not have a relevant index entry for "scripts". There 
is no "list-scripts" command that would tell me which scripts are supported in 
emacs, but there is a reference to the Unicode Standard defined scripts in 
"Specifying Fonts on MS-Windows". So I end up finding this page:
https://www.unicode.org/standard/supported.html.

3) C-h d script

4) I eventually find charset-script-alist

(after checking the *docstrings* for set-fontset-font I found that 
script-representative-chars is supposed to be the list of scripts but its name 
and description did not make me want to check its contents when I first found 
it)

5) in charset-script-alist all the Japanese charsets seem to correspond to the 
han script, which is weird (han is supposed to cover kanjis only)

6) I try with various fonts that, work fine in macos and for some reason the 
kanjis are properly taken from the font but not the kanas. I end up with:

     (set-fontset-font "fontset-default" 'han
                       "Osaka")

because that seems to be the only for which emacs applies a Japanese font to 
both kanas and kanjis.

7) I have no idea how to simply add kanas to the above specification and there 
is no relevant reference to kanas in either manual

> I mentioned the ELisp manual because it just happens to have an
> example with Japanese, but the examples in the Emacs manual are very
> similar, they just use different scripts.

FWIW the example happens to work, but I'm not sure why, probably the fact that 
the specification does not use 'han but a Japanese charset. So what is that 
charset-script-alist variable giving me ? Why is that variable not giving me 
other parts of the Japanese script ?


Re. the Fontest node in the emacs manual:

"In this case, or if the characters are shown, but not as well as you would 
like, you may need to install extra fonts."

The default emacs setting for Japanese looks like crap on my machine but macos 
has a range of excellent font for Japanese. So I don't think I need to install 
extra fonts. This sentence should read "you may need to modify the default 
fontset or, if that does not work, install extra fonts." Or something like that.


"   To show the information about a specific fontset, use the
`M-x describe-fontset' command.  It prompts for a fontset name,
defaulting to the one used by the current frame, and then displays all
the subranges of characters and the fonts assigned to them in that
fontset."

The default fontset name for my frame seems to be "Hiragino Maru Gothic ProN", 
which is confusing as hell since it's not using Hiragino Maru Gothic ProN. 
Also, I'm not seeing subranges there, I'm seeing a file that's close to 20000 
lines long with one character per line. Where does that "Hiragino Maru Gothic 
ProN" come from ? I have no idea. Is that an Emacs default ?


I'm not sure why the "Defining Fontsets" node comes next. Why does this 
information have a higher priority than "Modifying Fontsets" when most emacs 
users will alledgedly just be fine modifying the predefined fontsets that emacs 
creates as described in the first section ?


In the Elisp manual:

"CHARACTER may be a script name (*note Character Properties::).  In
     that case, use FONT-SPEC for all the characters belonging to the
     script."

The link to "Character Properties" does not give *any* information regarding 
how to find those script names.


All in all, after too many hours wasted on this issue, I'm left with a solution 
that's exactly equivalent to finding a code snippet found on the web and I've 
not come any closer to a better understanding of how all that works.

What the emacs manual should have is:

1) a link to the elisp manual for set-fontset-font
2) the reference to list-character-sets and to script-representative-chars
3) an example that applies set-fontset-font to a list of scripts
3) a way to *find* a range of character: do we use list-character-sets, click 
on a given character set and from there ? Is there a better way ?



Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune





reply via email to

[Prev in Thread] Current Thread [Next in Thread]