[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Devel] Possible bug in ftxpost.c ?
From: |
Jean-Christophe Dubacq |
Subject: |
Re: [Devel] Possible bug in ftxpost.c ? |
Date: |
Thu, 4 Jul 2002 16:48:35 +0200 |
User-agent: |
Mutt/1.4i |
OK, I now post a patch. I know it's for freetype1, but lots of
applications still use this (ttf2{tfm,pk} among them, gfontview also...
in fact, all the font utilities I used).
I worked a bit, and I found a fix. It is a very simple patch to
ftxpost.c, in lib/extend. (see at end of mail).
I checked freetype2, and the fix is almost exactly the same. There is a
trick a bit more complicated to use the least possible memory, but it
didn't matter muchi (equivalent function is in src/sfnt/ttpost.c).
How difficult is it to port an application from freetype1 to freetype2 ?
--- ftxpost.c.old Thu Jul 4 16:26:20 2002
+++ ftxpost.c Thu Jul 4 16:24:39 2002
@@ -126,7 +126,7 @@
{
DEFINE_LOAD_LOCALS( input->stream );
- UShort nameindex, n, num;
+ UShort nameindex, n, k, num;
Byte len;
@@ -177,10 +177,10 @@
/* Now we can read the glyph names which are stored in */
/* Pascal string format. */
- for ( n = 0; n < num; n++ )
+ for ( k=0, n = 0; n < num; n++ )
{
nameindex = post20->glyphNameIndex[n];
-
+ /* nameindex is only useful to count the glyphs */
if ( nameindex < 258 )
; /* default Mac glyph, do nothing */
else
@@ -192,13 +192,14 @@
FORGET_Frame();
- if ( ALLOC_ARRAY( post20->glyphNames[nameindex - 258],
+ if ( ALLOC_ARRAY( post20->glyphNames[k],
len + 1, Char ) ||
- FILE_Read( post20->glyphNames[nameindex - 258], len ) )
+ FILE_Read( post20->glyphNames[k], len ) )
goto Fail1;
/* we make a C string */
- post20->glyphNames[nameindex - 258][len] = '\0';
+ post20->glyphNames[k][len] = '\0';
+ k++;
}
}
--
Jean-Christophe Dubacq -- ATER en informatique à la faculté d'Orsay.
Tel: 01 69 15 76 43 / 06 64 86 10 56 --- Email: address@hidden
[Devel] FreeType2PDF?, Lance Dyas, 2002/07/03