On Fri, Feb 22, 2002 at 09:06:52AM +1100, Martin Sevior wrote:
> >From Lauris Kaplinski, gnome-print maintainer......
> ---------- Forwarded message ----------
> Date: Thu, 21 Feb 2002 21:34:25 +0200
> From: Lauris Kaplinski <[EMAIL PROTECTED]>
> To: Martin Sevior <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: HowTo use TTF's in gnome print?
[...]

Hello Lauris!  Thank you so much for explaining gnome-print so well!  Your
explanation sure helps us understand and solve font problems.

I have a patch for you.  Some fonts have "-" in their fontname, but XLFD
does not allow this, so this patch converts all "-" to "_" in familyname.

Now, I also converted "&" to "+" because I ran into problems (or I thought I
ran into problems) a few months ago with fontnames containing "&" (not
gnome-print related).  However, I just checked XLFD.txt and noticed that "&"
is a valid field value, and can be legally used for familyname.  (oops!)
So, perhaps I was paranoid.  :-)  So, you may want to remove this line
after applying the patch:

        if (ttf->gfi.familyName[i] == '&') ttf->gfi.familyName[i] = '+';

XLFD.txt does mention this though:

  Field values are constructed as strings of ISO 8859-1 graphic charac-
  ters, excluding the following:

  o    "-" (HYPHEN), the XLFD font name delimiter character

  o    "?" (QUESTION MARK) and "*" (ASTERISK), the X protocol font name
       wildcard characters

  o    "," (COMMA), used by Xlib to separate XLFD font names in a font
       set.

  o    """ (QUOTATION MARK), used by some commercial products to quote a
       font name.

So, besides  - , you may want to convert  ? * , "  to   _   too.  :-)

Cheers,

Anthony

-- 
Anthony Fok Tung-Ling
ThizLinux Laboratory   <[EMAIL PROTECTED]> http://www.thizlinux.com/
Debian Chinese Project <[EMAIL PROTECTED]>       http://www.debian.org/intl/zh/
Come visit Our Lady of Victory Camp!           http://www.olvc.ab.ca/
--- gnome-print-0.34~/installer/gf-ttf.c        Tue Jan  8 19:38:28 2002
+++ gnome-print-0.34/installer/gf-ttf.c Tue Jan  8 19:38:28 2002
@@ -113,6 +113,10 @@
                if (ttf->gfi.fontName[i] == ' ') ttf->gfi.fontName[i] = '-';
        }
        ttf->gfi.familyName = g_strdup (familyname);
+       for (i = 0; ttf->gfi.familyName[i]; i++) {
+               if (ttf->gfi.familyName[i] == '&') ttf->gfi.familyName[i] = '+';
+               if (ttf->gfi.familyName[i] == '-') ttf->gfi.familyName[i] = '_';
+       }
        ttf->gfi.isFixedPitch = FT_IS_FIXED_WIDTH (ft_face);
        ttf->gfi.fontBBox.llx = (gdouble) ft_face->bbox.xMin * 1000.0 / 
ft_face->units_per_EM;
        ttf->gfi.fontBBox.lly = (gdouble) ft_face->bbox.yMin * 1000.0 / 
ft_face->units_per_EM;

Reply via email to