Re: Are ready to go? (was Re: commit: Win32 printing)

Subject: Re: Are ready to go? (was Re: commit: Win32 printing)
From: ha shao (
Date: Mon Jul 23 2001 - 11:24:54 CDT

On Sun, Jul 22, 2001 at 07:57:13PM +1000, wrote:
> On Sun, 22 Jul 2001, Jesse Kuang wrote:
> > BUT, cjk font support got broken since 7/14,

Actually, it is since 7/17.

> > under CJK locale, abiword display following message and abort (XAP_UnixFont::getMetricsData)
> > "The font metrics file [%s] could\n"
> > "not be opened for parsing, nor was\n"
> > "it possible to retrieve the needed\n"
> > "information from the X server; this\n"
> > "is a fatal error and AbiWord will\n"
> > "terminate.",
> Thanks very much for telling me this. I'll try to fix this ASAP. Please
> let me know as soon as you see this sort of thing happenning. I have no
> way of knowing if CJK fonts work.
> Ha Shao, can you check and look and tell me what I've screwed up? It is
> something in xap_UnixFonts.cpp I think.

I've taken a look at the changes. Some background first.
For cjk font, we do not create font metrics information from the
font. So there is never a afm file. The descent, ascent and width of
the whole font are specified in the fonts.dir(fonts.dir for cjk is
a bit different from latin fonts.dir). So getMetricsData
always failed on cjk fonts.

Since 7/17, the font's informations are treated differently b/w low and
high resolution. Under higher resolution, the metrics are looked up from
the metrics file, even for cjk font. Now we have the error as reported.
See GR_UnixGraphics::getFontAscent(GR_Font * fnt) and
GR_UnixGraphics::getFontDescent(GR_Font * fnt) in gr_UnixGraphics.cpp.

Since getMetricsData() always fail for CJK font, we have to use
get_CJK_Ascent/Descent() here.

We can create font metrics for CJK font (mostly, ttf) too, instead of hard
coded them inside the fonts.dir. This can be done with little change in
ttftools. However, since CJK as a whole are hacks in abiword now and the hacks
work relatively stable, I don't feels like to make much change before
1.0. When we start to make use of pango and stuff, hopefully, most of
the special treatements for CJK can be eliminated, and we then will have a
more generic approach toward i18n.

Patch attached (if I got the scales right).

Best regard

This archive was generated by hypermail 2b25 : Mon Jul 23 2001 - 11:24:33 CDT