xc/lib/font/FreeType/ in "XORG-RELEASE-1"-branch differs fromXfree86 trunk...

Chisato Yamauchi cyamauch at a.phys.nagoya-u.ac.jp
Sun Mar 14 23:25:50 PST 2004


From: Keith Packard <keithp at keithp.com>
Subject: Re: xc/lib/font/FreeType/ in "XORG-RELEASE-1"-branch differs fromXfree86 trunk... 
Date: Sun, 14 Mar 2004 13:03:43 -0800

> > Can you please restore the original code ? I guess the current version
> > in the "XORG-RELEASE-1"-branch will likely result in a horrible
> > disaster.
> 
> I don't see a horrible disaster here; I see a performance problem for an
> unexpected usage pattern (fonts with embedded bitmaps that aren't used).
> I don't think there is any functionality that will be impacted.

  KeithP, you don't understand CJK environment at all.  At least, we
Japanese always use TrueType fonts which have embedded-bitmap and
thousands of glyphs.  It seems that Westerners generally want to ignore
CJK environments and CJK specific promlems.
#Roland is an exception :-)
  
  I show test results.  This is the code for testing:

#include <X11/Xlib.h>
int main( int argc, char *argv[] )
{
    Display* dis=NULL;
    dis=XOpenDisplay(NULL);
    XLoadQueryFont( dis, argv[1] );
    return 0;
}


  and fonts.dir:

fn=1:msgothic.ttc -microsoft1-ms pgothic-medium-r-normal--0-0-0-0-p-0-iso10646-1

  The msgothic.ttc is a standard Japanese font and included in WindowsNT/2000/XP.


  and results:

KetithP's code:
time ./bench "-microsoft1-ms pgothic-medium-r-normal--32-0-0-0-p-0-iso10646-1"
./bench "-microsoft1-ms pgothic-medium-r-normal--32-0-0-0-p-0-iso10646-1"
  0.01s user 0.00s system 1% cpu 0.513 total

My code:
time ./bench "-microsoft1-ms pgothic-medium-r-normal--32-0-0-0-p-0-iso10646-1"
./bench "-microsoft1-ms pgothic-medium-r-normal--32-0-0-0-p-0-iso10646-1"
  0.00s user 0.00s system 0% cpu 0.061 total

  Your result is 8 or more times slower than mine.  This tendency becomes very
serious when the number of glyphs increases.  See also http://x-tt.sourceforge.jp/documentation.html
which shows the results in the case of the Cyberbit unicode font.  Cyberbit unicode
font has many glyphs than that of msgothic.ttc.  The `very lazy' method shows
77 times as fast as strict metrics calculation.  If such fonts have embedded bitmaps,
your FreeType backend will work very very very very very very very slowly.

  Such problems are unrelated to your life.  However they are serious problems
for us.  Don't ignore actual problems and don't kill our environments, please.
If you ignore the problem, I think that the freedesktop.org is never free.

> And, if we do ship the code, I expect the FreeType API will never be 
> fixed, so we'll be stuck in the next release at the same place.

  Can such a reason kill our environments?

  I just sent mail to David Turner to know a optimal method.  It is better
surely to use only public API.

> Actually, I was thinking about this -- you want to know when bitmaps are in
> use; it seems like that's trivial -- pull a single glyph from the font and
> see if you get back an outline or a bitmap.  Assume that the font will 

  If it is trivial, tell me the method.  My method is as a result of my
difficulties.

> uniformly return bitmaps or outlines; after all, that's what's being 
> assumed in the current code.  That should be essentially as fast as the 
> original code without breaking the API.

  Yes.  My code assumes that if embedded-bitmaps exist in the size,
all glyphs in the size are embedded-bitmaps.  Surely, in the case of msgothic.ttc,
there are a few glyphs in which embedded-bitmaps are not contained.  
But such glyphs are rare, so this is not major problem.

  But your code assumes that if the font has embedded-bitmaps, all glyphs of 
all sizes are embedded-bitmap.  There cannot be no such thing by any means.

  Restore the code, please.

------------------------------------------------------------
    Chisato Yamauchi



More information about the release-wranglers mailing list