[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Slow localized text drawing
From: |
Fred Kiefer |
Subject: |
Re: Slow localized text drawing |
Date: |
Fri, 28 Nov 2008 21:32:11 +0100 |
User-agent: |
Thunderbird 2.0.0.18 (X11/20081112) |
UBoss UBoss wrote:
> Using gnustep stable
> make - 2.0.6
> base - 1.16.3
> gui - 0.14.0
> back - 0.14.0 (Xlib, X11)
>
> OS: solaris 10
>
> using font Helvetica (included in gnustep) (iso10646-1 = unicode)
>
> when drawing Loclaized string (Latin2) - [NSString allioc] initWithData:
> <Latin2 chars as data> encoding:NSISOLatin2StringEcoding]
> into textFiled, NSBrowserCell ...
> the responses of application is too slow (about 3-5sec per one nonASCII
> char)
>
> after searching in sources found that slow piece of code is in
> gui/Sources/NSAttributedString.m
> method
> fixFontAttributeInRange
> ....
> on line .... subFont = [self _substituteFontFor: uchar font: font];
>
> returned subFont is nil
>
> after commenting out this line application responses is OK, drawing is OK.
>
> question is why is there substitue if using unicode font ?
>
> Hope this helps..
Let me explain a bit what goes on here:
You end up in this code, when the font does not seem to support the
given characters. In your case the charcter set returned by the font
doesn't seem to match the characters supported by the font. What the
code now tries to do is find a replacement font that will support this
characters. In your case this goes wrong, most likely because the other
fonts also have wrong character sets assigned and all seem to not
support that character. This of course is a rather heavy operation and
repeated for each single character.
First of all we should now try to find out, what goes wrong in your
specific case and over all we need to come up with a better
implementation here, where we handle fonts and characters in groups per
scripts.
You wrote that you are using the xlib backend, for this backend we have
three different font mechanisms:
GSXftFontInfo
XGFontInfo
XGFontSetFontInfo
If you haven't set up something specifically you will be using the first
one. For this class the method coveredCharacterSet is fully implemented
and should be working correctly (At least that is what I hope, having
implemented it myself). But I have no experience with it on Solaris.
Solaris may also be missing XFT or you may have switched off
anti-aliasing then XGFontInfo would be used. For that class
coveredCharacterSet hasn't been implemented, so it would be ignored by
the NSAtrributedString.
Now the only font provided with GNUstep itself is the Helvetica nfont
that comes along with back and it is only used by the art backend.
All of that is confusing me.
It would be nice to report back some information about the font
character set as seen within the fixFontAttributeInRange method.
Fred