Most bitmap fonts contain the bdf properties WEIGHT_NAME and SLANT
with an upper case first letter like this:
WEIGHT_NAME "Bold"
SLANT "I"
But there are quite a few which have these properties all in lower
case like this:
WEIGHT_NAME "bold"
SLANT "i"
As freetype checks only for upper case first letters, the weights andd
style of such fonts cannot be properly distinguished by fontconfig,
for example:
address@hidden:~$ fc-list "etl fixed:foundry=etl:pixelsize=16" family style
weight foundry file
/usr/X11R6/lib/X11/fonts/misc/lt1-16b-etl.pcf.gz: ETL
fixed:style=Regular:weight=100:foundry=ETL
/usr/X11R6/lib/X11/fonts/misc/lt1-16bi-etl.pcf.gz: ETL
fixed:style=Regular:weight=100:foundry=ETL
/usr/X11R6/lib/X11/fonts/misc/lt1-16-etl.pcf.gz: ETL
Fixed:style=Regular:weight=100:foundry=ETL
/usr/X11R6/lib/X11/fonts/misc/lt1-16i-etl.pcf.gz: ETL
fixed:style=Regular:weight=100:foundry=ETL
address@hidden:~$
All fonts above are listed with "style=Regular:weight=100", i.e. they
are identical as far as fontconfig is concerned and when trying to
select such a font one gets a rather random result.
It is probably better if freetype checked this case insensitively.
The attached patch does this and after applying the patch and calling
'fc-cache' the same fc-list command returns:
address@hidden:~$ fc-list "etl fixed:foundry=etl:pixelsize=16" family style
weight foundry file
/usr/X11R6/lib/X11/fonts/misc/lt1-16i-etl.pcf.gz: ETL
fixed:style=Italic:weight=100:foundry=ETL
/usr/X11R6/lib/X11/fonts/misc/lt1-16-etl.pcf.gz: ETL
Fixed:style=Regular:weight=100:foundry=ETL
/usr/X11R6/lib/X11/fonts/misc/lt1-16b-etl.pcf.gz: ETL
fixed:style=Bold:weight=200:foundry=ETL
/usr/X11R6/lib/X11/fonts/misc/lt1-16bi-etl.pcf.gz: ETL fixed:style=Bold
Italic:weight=200:foundry=ETL
address@hidden:~$
which is more useful.
------------------------------------------------------------------------
diff -ru freetype-2.1.4.orig/src/bdf/bdfdrivr.c
freetype-2.1.4/src/bdf/bdfdrivr.c
--- freetype-2.1.4.orig/src/bdf/bdfdrivr.c 2003-03-20 08:04:40.000000000
+0100
+++ freetype-2.1.4/src/bdf/bdfdrivr.c 2003-08-26 18:07:50.000000000 +0200
@@ -266,15 +266,18 @@
if ( prop != NULL )
if ( prop->format == BDF_ATOM )
if ( prop->value.atom != NULL )
- if ( ( *(prop->value.atom) == 'O' ) ||
- ( *(prop->value.atom) == 'I' ) )
+ if ( ( *(prop->value.atom) == 'O' ) ||
+ ( *(prop->value.atom) == 'o' ) ||
+ ( *(prop->value.atom) == 'I' ) ||
+ ( *(prop->value.atom) == 'i' ) )
root->style_flags |= FT_STYLE_FLAG_ITALIC;
prop = bdf_get_font_property( font, (char *)"WEIGHT_NAME" );
if ( prop != NULL )
if ( prop->format == BDF_ATOM )
if ( prop->value.atom != NULL )
- if ( *(prop->value.atom) == 'B' )
+ if ( ( *(prop->value.atom) == 'B' ) ||
+ ( *(prop->value.atom) == 'b' ) )
root->style_flags |= FT_STYLE_FLAG_BOLD;
prop = bdf_get_font_property( font, (char *)"FAMILY_NAME" );
diff -ru freetype-2.1.4.orig/src/pcf/pcfread.c freetype-2.1.4/src/pcf/pcfread.c
--- freetype-2.1.4.orig/src/pcf/pcfread.c 2003-01-22 23:45:28.000000000
+0100
+++ freetype-2.1.4/src/pcf/pcfread.c 2003-08-26 18:05:10.000000000 +0200
@@ -931,13 +931,16 @@
if ( prop != NULL )
if ( prop->isString )
if ( ( *(prop->value.atom) == 'O' ) ||
- ( *(prop->value.atom) == 'I' ) )
+ ( *(prop->value.atom) == 'o' ) ||
+ ( *(prop->value.atom) == 'I' ) ||
+ ( *(prop->value.atom) == 'i' ) )
root->style_flags |= FT_STYLE_FLAG_ITALIC;
prop = pcf_find_property( face, "WEIGHT_NAME" );
if ( prop != NULL )
if ( prop->isString )
- if ( *(prop->value.atom) == 'B' )
+ if ( ( *(prop->value.atom) == 'B' ) ||
+ ( *(prop->value.atom) == 'b' ) )
root->style_flags |= FT_STYLE_FLAG_BOLD;
root->style_name = (char *)"Regular";
------------------------------------------------------------------------