discuss-gnustep
[Top][All Lists]
Advanced

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

Re: font substitution


From: Fred Kiefer
Subject: Re: font substitution
Date: Tue, 07 Aug 2007 20:36:32 +0200
User-agent: Thunderbird 1.5.0.12 (X11/20060911)

Yen-Ju Chen wrote:
> On 8/7/07, Yen-Ju Chen <address@hidden> wrote:
>> On 8/7/07, Fred Kiefer <address@hidden> wrote:
>>> OK, so here is a reworked version of this patch. I had to fix the
>>> coveredCharacterSet method of ftfont to get this working. So it may not
>>> be possible for you to actually check this code. What I would like to
>>> get from the mailing list is a short review, if you agree that this code
>>> is fast enough to be included.
>>> There are a few noteworthy changes to Alexander's patch. I set the
>>> substitution font directly as the new font for the character. I am not
>>> sure, if this is compatible with what Apple does. This patch also tries
>>> to find a substitution by looking at all available fonts. This may be
>>> really slow, when it fails. It will also result in the character sets
>>> for all fonts being cached. I am not sure, if we really want this,
>>> perhaps we should do this caching only for the fonts in preferredFontNames?
>>>
>>> As you can see, I am still not that sure about this patch.
>>   If speed is the concern,
>>   I would say caching only preferredFontNames is enough.

This surely would save space. But most likely it will be slower, when we
have a miss for the preferred fonts.

>>   Because OS X ship their own fonts for each language,
>>   I believe they can cache such information in advance for each language
>>   and only fallback when all the defaults font fails, which hardly happens.
>>   I also wonder whether fonts have language information inside.
>>   If so, we can actually have a table of glyph range of each language
>>   and only match language instead of each glyph.
>>   That would be much faster.
>>   And I believe that there is hardly a font supporting
>>   only half of the glyphs for a language.
>>   In another word, if a font has 'A', it must have [A-Z][a-z][0-9].
>>   In that case, we only need to look at the unicode table
>>   and pick probably 2 glyphs for each language
>>   and use them to check the font.

What you are talking about is what to AppKit documentation calls
scripts. Fonts normally support scripts and it would help to know, which
script is supported by which font. As far as I can see there is no
official interface to query this information. It could be established in
the way you suggest, but this could be risky. I am not to familiar with
other scripts, but just for the standard European languages it would be
hard to define which characters should be checked. Is it enough to check
for "ö" and "Ü" to know that German is supported? Or do we need to check
"ß" as well (if we aren't writing is Swiss German). (Not sure, what you
will see here, but I used a few Umlaute and a replacement for "ss")

>   I forgot to ask, is there a user default to set the preferredFontNames ?
>   Otherwise, preferredFontNames will always return nil
>   unless applications explicitly set it in NSFont.
> 

Good point. Currently we rely on the application to set this variable.
It surely would be better to have a user default for it.




reply via email to

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