discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Slow localized text drawing


From: UBoss UBoss
Subject: Re: Slow localized text drawing
Date: Mon, 1 Dec 2008 09:31:33 +0000

Hi

more info : hope this helps

CHAR SET is member 0x161  length 0x10000  _data[byte] 0x00
SUBSTITUTE FONT <NSFont: 0x85dd6e0> Bitstream Vera Sans 12.000 0.000 0.000 12.000 0.000 0.000 N P 12 ENC iso10646-1 CHARSET <NSBitmapCharSet: 0x860a758> AFMDCT {Ascender = 12; CapHeight = 15; Descender = "-3"; EncodingScheme = "iso10646-1"; FamilyName = "Bitstream Vera Sans"; FontName = "Bitstream Vera Sans"; Weight = medium; XHeight = 9; }
FONT NumGlyphs 257 INFO <GSXftFontInfo: 0x85dd728>


for me all looks correct, don't know where to look for more deeper info, so made quick fix to continue in development if  unichar is not found in characterIsMember then test if font is unicode  YES ok skip finding substitute font NO try to find substitute, work for me now, if i have more time i'll try to look deeper.

Thanks.








On Fri, Nov 28, 2008 at 8:32 PM, Fred Kiefer <fredkiefer@gmx.de> wrote:
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




reply via email to

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