Re: unix font handling and printing under utf-8 locale


Subject: Re: unix font handling and printing under utf-8 locale
From: Vlad Harchev (hvv@hippo.ru)
Date: Tue Jan 30 2001 - 13:49:56 CST


On Tue, 30 Jan 2001, Tomas Frydrych wrote:

 Hi Tomas, Hi abi-dev,

>
> With the two patches I made recently, it is now possible, under utf-
> 8 locale, to input and display arbitrary Unicode characters in a
> single document. The next necessary step is to deal with the
> printing, but this is where it gets slightly more complicated.
>
> At the moment AW prints using pfa/afm set of font-files.
> Unfortunately, the X fonts server, including XFree 4.0.2, seems to
> be unable to handle Type1 Unicode fonts (it will only make

  As I understand, CJK guys use only TTFs for scalable fonts (they don't use
Type1 fonts since they are ~10Mb each due to their format). So presumably
there exist patches for Xfree and/or vairous font servers to support ttfs with
more than 256 glyphs. Also, CJK people use only TTF fonts when printing to PS,
but no fonts/afms are emitted into .ps in CJK mode since TTF fonts are already
registered in ghostscript. Of course they use specially-patched GS for this
too (mainly generic fixex for CJK support).
 Having ability to print using TTFs would be handy though.

> available the first 255 characters). Consequently, the only scalable
> Unicode fonts that are currently usable with X are ttf. Therefore, we
> need to free ourselves from the pfa/afm limitation, if we are to be
> able to print under utf-8 locale. (Support for ttf fonts in AW would be
> a welcome feature irrespective of utf-8 locale.)
>
> I am not sure what the best way forward is on this, and would
> appreciate some input. I have had a look at the XPrint API, but as it
> is not supported by gdk and we do everything graphical via gdk, it
> would require a major effort to print using XPrint, and further, as
> Vlad pointed out on other occassion, there is a portability problem,
> since XPrint is not available on all X platforms.
>
> I recall that in an earlier discussion of the font issue, Vlad
> mentioned that it would be possible to print with ttf fonts using
> ghostscript. However, I have no experience with GS and PS in
> general, and have no idea where to start and how to go about it. If
> anyone could point me in the right direction, I would appreciate it.

 You first should be able to register your fonts in GS. Just see Fontmap file
that comes with it and add more entries of the same form. It should just work.

 Then we should code for AW not to include afms and pfms of fonts into .ps for
some subset of fonts. Also we should have the ability to get information on
glyphs dimensions. For Type1 fonts it's acquired by parsing afm files
(xap_UnixPSParseAFM.c). For TTFs - I think we could query Xserver for all this
information (even using gdk), but for very big font size (say 200 pixels) to
make rounding errors smaller. Well, that's it. Currently in CJK mode
information about glyphs dimensions is specified via special syntax of
fonts.dir (ascent, descent are encoded in XLFD in CJK mode - see
XAP_UnixFontManager::_allocateCJKFont()).

 For fast hacking, you can use some monospaced TTF font, and simulate CJK
locale (LANG=zh_CN.BIG5) (but calculate font dimensions first and store them
in fonts.dir in special format). I think everything will just work without
any modifications of the AW source. After that write code to query information
about glyph dimensions from X server and test it.

> Tomas
>

 Best regards,
  -Vlad



This archive was generated by hypermail 2b25 : Tue Jan 30 2001 - 15:08:24 CST