aboutsummaryrefslogtreecommitdiffstats
path: root/print
diff options
context:
space:
mode:
authormarcus <marcus@FreeBSD.org>2004-03-19 05:58:47 +0800
committermarcus <marcus@FreeBSD.org>2004-03-19 05:58:47 +0800
commit6d4085f43d16e74d9c068825baeb0dcbbb93f79b (patch)
tree45e6abacdd4d1e2adf42a30cfee0ec2bb28b351c /print
parente028cc99fa9b5fa6c1070e7c7e5c3991feee70ed (diff)
downloadfreebsd-ports-gnome-6d4085f43d16e74d9c068825baeb0dcbbb93f79b.tar.gz
freebsd-ports-gnome-6d4085f43d16e74d9c068825baeb0dcbbb93f79b.tar.zst
freebsd-ports-gnome-6d4085f43d16e74d9c068825baeb0dcbbb93f79b.zip
Fix the height and width calculations for BDF/PCF fonts. This fixes the
problems people were seeing with bitmap fonts after the big font upgrade a few days ago. Note: If you applied my libXft patch, you need to back that out once you upgrade freetype2. Obtained from: FreeType CVS
Diffstat (limited to 'print')
-rw-r--r--print/freetype2/Makefile1
-rw-r--r--print/freetype2/files/patch-src_bdf_bdfdrivr.c87
-rw-r--r--print/freetype2/files/patch-src_pcf_pcfdrivr.c14
3 files changed, 102 insertions, 0 deletions
diff --git a/print/freetype2/Makefile b/print/freetype2/Makefile
index d3183bfb4f01..d3a64ff38e7f 100644
--- a/print/freetype2/Makefile
+++ b/print/freetype2/Makefile
@@ -7,6 +7,7 @@
PORTNAME= freetype2
PORTVERSION= 2.1.7
+PORTREVISION= 1
CATEGORIES= print
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:S,%SUBDIR%,freetype,} \
http://sunsite.cnlab-switch.ch/ftp/mirror/freetype/%SUBDIR%/ \
diff --git a/print/freetype2/files/patch-src_bdf_bdfdrivr.c b/print/freetype2/files/patch-src_bdf_bdfdrivr.c
new file mode 100644
index 000000000000..ff5fb048906c
--- /dev/null
+++ b/print/freetype2/files/patch-src_bdf_bdfdrivr.c
@@ -0,0 +1,87 @@
+--- src/bdf/bdfdrivr.c.orig Thu Mar 18 16:44:44 2004
++++ src/bdf/bdfdrivr.c Thu Mar 18 16:50:09 2004
+@@ -315,17 +315,18 @@
+
+ {
+ FT_Bitmap_Size* bsize = root->available_sizes;
++ FT_Short resolution_x = 0, resolution_y = 0;
+
+
+ FT_MEM_ZERO( bsize, sizeof ( FT_Bitmap_Size ) );
+
+- prop = bdf_get_font_property( font, "PIXEL_SIZE" );
+- if ( prop != NULL )
+- bsize->height = (FT_Short)prop->value.int32;
++ bsize->height = font->font_ascent + font->font_descent;
+
+ prop = bdf_get_font_property( font, "AVERAGE_WIDTH" );
+ if ( prop != NULL )
+ bsize->width = (FT_Short)( ( prop->value.int32 + 5 ) / 10 );
++ else
++ bsize->width = bsize->height * 2/3;
+
+ prop = bdf_get_font_property( font, "POINT_SIZE" );
+ if ( prop != NULL )
+@@ -333,25 +334,29 @@
+ bsize->size =
+ (FT_Pos)( ( prop->value.int32 * 64 * 7200 + 36135L ) / 72270L );
+
++ prop = bdf_get_font_property( font, "PIXEL_SIZE" );
++
++ if ( prop )
++ bsize->y_ppem = (FT_Short)prop->value.int32 << 6;
++
+ prop = bdf_get_font_property( font, "RESOLUTION_X" );
+- if ( prop != NULL )
+- bsize->x_ppem =
+- (FT_Pos)( ( prop->value.int32 * bsize->size + 36 ) / 72 );
++ if ( prop )
++ resolution_x = (FT_Short)prop->value.int32;
+
+ prop = bdf_get_font_property( font, "RESOLUTION_Y" );
+- if ( prop != NULL )
+- bsize->y_ppem =
+- (FT_Pos)( ( prop->value.int32 * bsize->size + 36 ) / 72 );
+-
+- if ( bsize->height == 0 )
+- bsize->height = (FT_Short)( ( bsize->y_ppem + 32 ) / 64 );
++ if ( prop )
++ resolution_y = (FT_Short)prop->value.int32;
+
+- if ( bsize->height == 0 )
++ if ( bsize->y_ppem == 0 )
+ {
+- /* some fonts have a broken SIZE declaration (jiskan24.bdf) */
+- FT_ERROR(( "BDF_Face_Init: reading size\n" ));
+- bsize->height = (FT_Short)font->point_size;
++ bsize->y_ppem = bsize->size;
++ if ( resolution_y )
++ bsize->y_ppem = bsize->y_ppem * resolution_y / 72;
+ }
++ if ( resolution_x && resolution_y )
++ bsize->x_ppem = bsize->y_ppem * resolution_x / resolution_y;
++ else
++ bsize->x_ppem = bsize->y_ppem;
+ }
+
+ /* encoding table */
+@@ -481,13 +486,14 @@
+
+
+ FT_TRACE4(( "rec %d - pres %d\n",
+- size->metrics.y_ppem, root->available_sizes->height ));
++ size->metrics.y_ppem, root->available_sizes->y_ppem ));
+
+- if ( size->metrics.y_ppem == root->available_sizes->height )
++ if ( size->metrics.y_ppem == root->available_sizes->y_ppem >> 6 )
+ {
+- size->metrics.ascender = face->bdffont->bbx.ascent << 6;
+- size->metrics.descender = face->bdffont->bbx.descent * ( -64 );
+- size->metrics.height = face->bdffont->bbx.height << 6;
++ size->metrics.ascender = face->bdffont->font_ascent << 6;
++ size->metrics.descender = -face->bdffont->font_descent << 6;
++ size->metrics.height = ( face->bdffont->font_ascent +
++ face->bdffont->font_descent ) << 6;
+ size->metrics.max_advance = face->bdffont->bbx.width << 6;
+
+ return BDF_Err_Ok;
diff --git a/print/freetype2/files/patch-src_pcf_pcfdrivr.c b/print/freetype2/files/patch-src_pcf_pcfdrivr.c
new file mode 100644
index 000000000000..f1ace34da836
--- /dev/null
+++ b/print/freetype2/files/patch-src_pcf_pcfdrivr.c
@@ -0,0 +1,14 @@
+--- src/pcf/pcfdrivr.c.orig Thu Mar 18 16:43:18 2004
++++ src/pcf/pcfdrivr.c Thu Mar 18 16:53:25 2004
+@@ -336,9 +336,9 @@
+
+
+ FT_TRACE4(( "rec %d - pres %d\n", size->metrics.y_ppem,
+- face->root.available_sizes->height ));
++ face->root.available_sizes->y_ppem >> 6 ));
+
+- if ( size->metrics.y_ppem == face->root.available_sizes->height )
++ if ( size->metrics.y_ppem == face->root.available_sizes->y_ppem >> 6 )
+ {
+ size->metrics.ascender = face->accel.fontAscent << 6;
+ size->metrics.descender = face->accel.fontDescent * (-64);