freetype
[Top][All Lists]
Advanced

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

[Freetype] Suggested patch: bitmap fonts, foundry, family and fontconfig


From: Mike FABIAN
Subject: [Freetype] Suggested patch: bitmap fonts, foundry, family and fontconfig/Xft2
Date: Tue, 08 Apr 2003 23:50:36 +0200
User-agent: Gnus/5.090014 (Oort Gnus v0.14) XEmacs/21.4 (Portable Code, x86_64-suse-linux)

With freetype 2.1.4, fontconfig and Xft2 it is possible to display
also Bitmap fonts in .pcf or .pcf.gz format via the Xft2 api.

But apparently the bdf-property "FOUNDRY" is completely ignored by
both freetype and fontconfig, only the bdf-property "FAMILY_NAME" is
used.

Therefore the selection of many bitmap fonts becomes chaotic and
apparently random.

For example there are many bitmap fonts where the bdf-property
only contains "Fixed" but which are completely different in style.

For example the 

   -sony-fixed-*

fonts are serif fonts whereas the

   -etl-fixed-*

fonts are sans-serif fonts. The

   -misc-fixed-*

are sans-serif fonts as well, but somewhat different in style to the
etl-fixed fonts. 

If one tries to use such fonts via Xft, for example with

   xfd -fa "fixed:size=<some number>"

or when clicking on "fixed" in a font-selection dialog in KDE3 or
Gnome2 and selecting a font size, one gets fairly random results,
sometimes a serif font, sometimes a sans-serif etc...

It is often impossible to select a desired font at all, it maybe that
one never gets the 16 pixel sony-fixed font but always a misc-fixed
font or some other "fixed" font of the same size or vice versa.

Obviously all these "fixed" fonts cannot really be regarded as fonts
from the same family.

I believe it would be better if the family name which shows up via the
fontconfig/Xft2 API reflected that and the fonts showed up as

    "Misc Fixed", "Sony Fixed", "Etl Fixed", etc...

This makes the family names of bitmap fonts more similar to typical
family names of TrueType fonts. For example

    address@hidden:~$ ftdump /usr/X11R6/lib/X11/fonts/truetype/tt2001gn.ttf | 
grep family
       family:     Bitstream Vera Sans
    address@hidden:~$ ftdump /usr/X11R6/lib/X11/fonts/truetype/msmincho.ttc  | 
grep family
       family:     MS Mincho
       family:     MS PMincho
    address@hidden:~$


Here "Bitstream" and "MS" are something like "FOUNDRY", but as
TrueType fonts don't have something like "FOUNDRY", it appears to be
common practice to include this information into the family name.
It's certainly better than to have different fonts which are all
called "Mincho" only and become indistinguishable.

I can see two ways to achieve this:

   (1) patch the .bdf source of the font files and make the property
       "FAMILY_NAME" contain "Misc Fixed", "Sony Fixed", ...

   (2) patch freetype to return "FOUNDRY" + " " + "FAMILY_NAME"
       as the family of a bitmap font.

I believe (2) is better, because it achieves this for all bitmap fonts
at once in a consistent way without having to patch all bitmap fonts
separately.

A patch to do this for .pcf fonts is attached.

The patch does one more thing:

Even if FOUNDRY is prepended to the family name, it still isn't
possible to distinguish between "normal" fonts and fonts which
contain *only* double width characters. For example:

    -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1
    -misc-fixed-medium-r-normal-ja-18-120-100-100-c-180-iso10646-1

or

    -efont-fixed-medium-r-normal--16-160-75-75-c-80-iso10646-1
    -efont-fixed-medium-r-normal--16-160-75-75-c-160-iso10646-1

are still indistinguishable via Xft.
But they are quite different as well,

    -misc-fixed-medium-r-normal-ja-18-120-100-100-c-180-iso10646-1
    -efont-fixed-medium-r-normal--16-160-75-75-c-160-iso10646-1

contain *only* double width characters. They work nicely together
with their single width counterpart, for example

    xterm -fn -efont-fixed-medium-r-normal--16-160-75-75-c-80-iso10646-1 \
          -fw -efont-fixed-medium-r-normal--16-160-75-75-c-160-iso10646-1

But it is usually bad if the double width only font is accidentally
selected via Xft. If one happens to get the double width only
version when using

    xterm -fa "Efont Fixed:pixelsize=16" 

xterm will be unusable.

My patch avoids this by appending " Wide" to fonts which have an
AVERAGE_WIDTH >= POINT_SIZE in the bdf-properties, i.e. for fonts
which have at least square shaped or even wider glyphs.

That way one can still select the double width only version of the above
examples on purpose with

    xfd -fa "Efont Fixed Wide:pixelsize=16"

    xfd -fa "Misc Fixed Wide:pixelsize=18"

if desired, but one will not get these by accident.

With my patch, the following fonts on my system get " Wide" added to
their family name:

    address@hidden:~$ fc-list "" family file | grep Wide
    /usr/X11R6/lib/X11/fonts/misc/f12.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/cu-alt12.pcf.gz: MUTT ClearlyU Alternate 
Glyphs Wide
    /opt/kde3/share/fonts/console8x8.pcf.gz: Misc Console Wide
    /usr/X11R6/lib/X11/fonts/misc/18x18ko.pcf.gz: Misc Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f16_bi.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f14.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/sgi/ScrB7.pcf.gz: SGI Screen Wide
    /usr/X11R6/lib/X11/fonts/misc/f24.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f12_bi.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f14_bi.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/18x18ja.pcf.gz: Misc Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f24_bi.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f16.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f10_bi.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/12x13ja.pcf.gz: Misc Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f10_i.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f12_i.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f14_i.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f24_i.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f10_b.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f16_i.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f10.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f12_b.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f14_b.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f16_b.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/f24_b.pcf.gz: Efont Fixed Wide
    /usr/X11R6/lib/X11/fonts/misc/cu12.pcf.gz: MUTT ClearlyU Wide
    address@hidden:~$

Among these, there are two fonts where the " Wide" attribute
may be debatable:

    /opt/kde3/share/fonts/console8x8.pcf.gz: Misc Console Wide
    /usr/X11R6/lib/X11/fonts/misc/sgi/ScrB7.pcf.gz: SGI Screen Wide

These two fonts contain only glyphs from the Latin Alphabet, but both
have square shaped glyphs, 8x8 pixel in case of "Misc Console Wide"
and 7x7 pixel in case of "SGI Screen Wide". I.e. they may not be
"double width only" fonts, but they certainly look stretched in the
horizontal direction, i.e. I believe it makes some sense to add "
Wide" to the family name for all bitmap fonts which are at least
square shaped or even wider.

What do you think?

Can something like this patch be included in the next version of freetype?

Attachment: freetype2-bitmap-foundry.patch
Description: Text Data

-- 
Mike Fabian   <address@hidden>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。

reply via email to

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