discuss-gnustep
[Top][All Lists]
Advanced

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

Re: font substitution


From: Yen-Ju Chen
Subject: Re: font substitution
Date: Fri, 10 Aug 2007 17:05:01 -0700

Another issue is that sometimes freetype fails to get the coverage.
Therefore, NSCharacterSet raise an exception:
"Specified range exceeds character set".
So this patch prevents NSAttributedString from using all available fonts
to eliminate the possibility of using bad fonts.
It only uses user specified fonts for substitution.
And I hope GNUstep can add an user default to specify the preferred fonts.

Once the patch is applied, the font substitute basically works, but
has one problem.
I attach a screenshot to explain that.
The left window is using English font as default font and no preferred font.
So you only see English 'GNUstep'.
The middle window is using Chinese font as default font and no preferred font.
Because Chinese font also contains English letter,
you see both English and Chinese.
You can tell the English letter is from different font.
The right window is using English font as default font and Chinese
font as substitute.
Again, you can see both English and Chinese character.
But the funny thing is the Chinese character is upside-down.
I have no idea why it happens, but I suspect gui or back cache the font matrix
so the matrix of English font is applied to the Chinese font.
The hint of Chinese font is also different between middle and right window.
The middle one is sharp while the right one is blur.
It indicates something is cached, probably for the English font at the
start of the text.
Maybe someone has insights about what may cause it.

Yen-Ju

On 8/10/07, Yen-Ju Chen <yjchenx@gmail.com> wrote:
> Hi,
>
>   [NSFont coveredCharacterSet] is broken.
>   I attach a patch.
>   A quick test shows that a Chinese font which contains 25,000+ glyph
>   takes only about 1-2 seconds to go through.
>   It's on a powerbook G4 1GHz.
>   So cache may not be needed for coveredCharacterSet.
>   I haven't test the preferredFont yet.
>   Hope this patch can go in soon.
>
>   Yen-Ju
>
> On 8/9/07, Yen-Ju Chen <yjchenx@gmail.com> wrote:
> > On 8/9/07, Fred Kiefer <fredkiefer@gmx.de> wrote:
> > > Yen-Ju Chen wrote:
> > > > On 8/8/07, Fred Kiefer <fredkiefer@gmx.de> wrote:
> > > >> Yen-Ju Chen wrote:
> > > >>>   Another thing I am thinking is to save the coveredCharacterSet on 
> > > >>> disk.
> > > >>>   Font does not change frequently,
> > > >>>   and it does take time to generate coveredCharacterSet for each font,
> > > >>>   especially for CJK.
> > > >>>   If the cached coveredCharacterSet can be saved on disk and loaded 
> > > >>> later,
> > > >>>   it can reduce the overhead of starting an application.
> > > >>>   For art backend, it can even pack the saved coveredCharacterSet in 
> > > >>> nfont.
> > > >>>   So for small font, it is fine to check the covered character each 
> > > >>> time.
> > > >>>   For big font, saved character set is better.
> > > >>>
> > > >> Great idea! Would you like to work on that?
> > > >
> > > >   If the patch you have goes into the -trunk,
> > > >   I can play with it and see how much it effects the speed
> > > >   and decide what's the best way to do the cache if needed.
> > > >
> > >
> > > I just committed this change, now it is your turn :-)
> >
> >   Thanx. I will take a look shortly.
> >
> >   Yen-Ju
> >
> > >
> >
>
>

Attachment: gui_attributedstring.patch
Description: Text Data

Attachment: font_sub.png
Description: PNG image


reply via email to

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