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

Re: fontconfig, alias/pseudo-fonts, Xft



Jungshik Shin <jshin@xxxxxxxxxxx> さんは書きました:

> Mike FABIAN wrote:
>
>>Pablo Saratxaga <pablo@xxxxxxxxxxxxxxxx> さんは書きました:
>>
>>>Also, Xft allows to define "virtual fonts" created from a list of other
>>>fonts; "Sans", "Serif" and "Monospace" come in standard.
>>>
>>~/.fonts.conf
>
> I guess Pablo meant something like the following
> but this doesn't work the way he (and
> I) wrote it would if only Xft APIs are used(see below). For instance,
> 'monospace' is a 'virtual' font defined as
>
> <alias>
> <family>monospace</family>
> <prefer>
> <family>Luxi Mono</family>
> <family>Nimbus Mono L</family>
> <family>Kochi Gothic</family>
> <family>ZYSong18030</family>
> <family>AR PL SungtiL GB</family>
> <family>AR PL Mingti2L Big5</family>
> <family>Gulimche</family>
> <family>Andale Mono</family>
> <family>Courier New</family>
> </prefer>
> </alias>
>
>>>and define some pseudo-fonts you want.
>
>>How does that work? I didn't know that it is possible to define
>>"virtual fonts" from a list of other fonts using fontconfig/Xft2.
>>  
>>
>>But I don't yet know a *simple* way to achieve that by using only Xft2.
>>When using something like
>>
>>	xft_font = XftFontOpenPattern(dpy, pattern);
>>
> I guess you have to call fontconfig APIs(e.g. FcFontSort) directly
> and do manual break-up of your input text into mutilple pieces
> to be rendered by one of fonts returned (by FcFontSort) depending
> on their coverage. And, you know this *complex* way, don't you?

Yes, I know that something like that can be done.  As far as I know,
higher level libraries like Pango probably do something like that.

>>I always got exactly one font. Are you saying that it is possible to use
>>more than one font with a single call to XftFontOpenPattern()
>>by doing some setup in ~/.fonts.conf?
>
> I think Pablo mistook what fontconfig does for what Xft does unless
> I'm missing something Pablo knows. I also plead guilty of making
> a similar mistake when I wrote abuot working-around a hard-coded
> font name in a Window manager and a theme (e.g. Courier)

Yes, that was the reason why Pablo's mail did arouse my interest.  I
sounded like there is some way to make simple-minded applications
(which don't use sophisticated libraries like Pango) more or less work
with little changes in the code.

Many window managers are like that. The best solution I currently
know is to use the generic aliases "sans-serif", "serif", and
"monspaced" instead of real font names like "Courier", etc...

In your above example from fonts.conf, "Luxi Mono" will be used in
case of German and "Kochi Gothic" will be used in case of Japanese.
But there is no easy way to display both German Umlauts *and* Japanese
at the same time without using a single font which contains both
Japanese and German Umlauts and inserting that on top of the <prefer>
list.

Mixing several fonts seems to require a bit more work.

-- 
Mike Fabian   <mfabian@xxxxxxx>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。
--
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/linux-utf8/