[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] PCF bitmap width fix (was: Compressed PCF fonts)
From: |
Detlef Würkner |
Subject: |
[Devel] PCF bitmap width fix (was: Compressed PCF fonts) |
Date: |
Tue, 05 Feb 2002 17:00:38 +0100 |
address@hidden (Keith Packard) wrote:
> PCF "properties" hold the X font property data. These are arbitrary name->
> value mappings, with the values as either strings or numbers. The core X
> protocol defines no particular properties, but the XLFD spec does -- there
> are lots of them. Here's the list that the XLFD defines; most of these
> have the obvious definitions:
>
> FOUNDRY | FAMILY_NAME | WEIGHT_NAME | SLANT | SETWIDTH_NAME |
> ADD_STYLE_NAME | PIXEL_SIZE | POINT_SIZE | RESOLUTION_X | RESOLUTION_Y |
> SPACING | AVERAGE_WIDTH | CHARSET_REGISTRY | CHARSET_ENCODING | QUAD_WIDTH
^^^^^^^^^^^^^
[...]
>
> A complete specification for these is available in the XFree86 distribution
> (xc/doc/specs/XLFD/xlfd.tbl.ms).
Thanks for the information! Now I could create a patch for the PCF driver
that sets the correct width of the font if available, instead of always
using the same value for width and height. This is useful especially for
calculating the pixel width of monospaced fonts.
----8<----
--- freetype-2.0.7/src/pcf/pcfread.c.ori Tue Feb 5 13:57:35 2002
+++ freetype-2.0.7/src/pcf/pcfread.c Tue Feb 5 15:57:24 2002
@@ -982,8 +982,13 @@
prop = find_property( face, "PIXEL_SIZE" );
if ( prop != NULL )
{
- root->available_sizes->width = (FT_Short)( prop->value.integer );
root->available_sizes->height = (FT_Short)( prop->value.integer );
+ prop = find_property( face, "AVERAGE_WIDTH" );
+ if ( prop != NULL )
+ root->available_sizes->width =
+ (FT_Short)( prop->value.integer / 10 );
+ else
+ root->available_sizes->width = root->available_sizes->height;
size_set = 1;
}
@@ -992,20 +997,25 @@
prop = find_property( face, "POINT_SIZE" );
if ( prop != NULL )
{
- PCF_Property xres = 0, yres = 0;
+ PCF_Property xres, yres, avgw;
xres = find_property( face, "RESOLUTION_X" );
yres = find_property( face, "RESOLUTION_Y" );
-
- if ( ( xres != NULL ) && ( yres != NULL ) )
+ avgw = find_property( face, "AVERAGE_WIDTH" );
+
+ if ( ( yres != NULL ) && ( ( xres != NULL ) || ( avgw != NULL ) ) )
{
- root->available_sizes->width =
- (FT_Short)( prop->value.integer *
- xres->value.integer / 720 );
root->available_sizes->height =
(FT_Short)( prop->value.integer *
yres->value.integer / 720 );
+ if ( avgw != NULL )
+ root->available_sizes->width =
+ (FT_Short)( avgw->value.integer / 10 );
+ else
+ root->available_sizes->width =
+ (FT_Short)( prop->value.integer *
+ xres->value.integer / 720 );
size_set = 1;
}
----8<----
BTW, http://ftp.xfree86.org/pub/XFree86/4.2.0/binaries/Common/Xfnts.tgz
seems to have a small problem, tested only with
lib/X11/fonts/75dpi/cour???-ISO8859-1.pcf, it seems that
lib/X11/fonts/75dpi/cour?08-ISO8859-1.pcf (the 8 point variants)
are not monospaced?
Ciao, Detlef
--
_ // address@hidden
\X/ Detlef Wuerkner, Langgoens/Germany
- [Devel] Compressed PCF fonts, Keith Packard, 2002/02/01
- Re: [Devel] Compressed PCF fonts, Werner LEMBERG, 2002/02/02
- Re: [Devel] Compressed PCF fonts, Francesco Zappa Nardelli, 2002/02/04
- Re: [Devel] Compressed PCF fonts, Francesco Zappa Nardelli, 2002/02/04
- Re: [Devel] Compressed PCF fonts, Keith Packard, 2002/02/04
- Re: [Devel] Compressed PCF fonts, David Turner, 2002/02/04
- Re: [Devel] Compressed PCF fonts, Keith Packard, 2002/02/04
- Re: [Devel] Compressed PCF fonts, David Turner, 2002/02/04
- Re: [Devel] Compressed PCF fonts, Keith Packard, 2002/02/04
- [Devel] PCF bitmap width fix (was: Compressed PCF fonts),
Detlef Würkner <=
- [Devel] PCF bitmap height again (was: PCF bitmap width fix), Detlef Würkner, 2002/02/05
- Re: [Devel] PCF bitmap height again (was: PCF bitmap width fix), George Williams, 2002/02/05
- [Devel] Looking for test font..., George Williams, 2002/02/06
- Re: [Devel] Looking for test font..., Werner LEMBERG, 2002/02/07
- [Devel] Proportional font, Xuqiang Bai, 2002/02/07
- Re: [Devel] Looking for test font..., George Williams, 2002/02/07
- Re: [Devel] Looking for test font..., George Williams, 2002/02/09
- Re: [Devel] Compressed PCF fonts, Werner LEMBERG, 2002/02/04
- Re: [Devel] Compressed PCF fonts, David Turner, 2002/02/04