Re: Please patch gdttf.c

From: Date: Fri, 07 Jul 2000 03:06:20 +0000
Subject: Re: Please patch gdttf.c
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-23766@lists.php.net to get a copy of this message
This patch stops me from using any of my TTF fonts that worked previously. I always get the Sorry, this font doesn't contain any Unicode mapping table. Stig, did you test this thing? -Rasmus On Wed, 5 Jul 2000, Rob Goodwin wrote: > Hi there, > > I'm starting by posting this here... if there is a better place please let > me know... I've been having problems with the TTF functions in gdttf.c for > some time now... Since php 3.0.7 actually. At that time somebody helped > me out with a patch which fixed the problem as I am not a Truetype > programmer... I assumed this patch would have been applied to the next > version... it was not... So finally when 3.0.11 came out and the patch was > still not put in the cvs I sent the code and was assured it would be... > Still it was not. Currently 4.0.1 still has these problems and I am getting > tired of manually applying the changes to the source tree each time a new > version comes out. Please, somebody apply this patch to gdttf.c so that > it will work with all the TTF files in our database. > > If I can post this somewhere else where it will be of more use please let me > know... > > thanks, > > Rob Goodwin > developer > www.myfonts.com > > > this is the diff for the gdttf.c found in 4.0.1 > ============== > > > 83c83,84 > < TT_CharMap char_map; > --- > > TT_CharMap char_map_Unicode, char_map_Big5, char_map_Roman; > > int have_char_map_Unicode, have_char_map_Big5, have_char_map_Roman; > 155a157,158 > > > > > 331c334 > < int i, n; > --- > > int i, n, map_found; > 374a378,381 > > map_found = 0; > > a->have_char_map_Unicode = 0; > > a->have_char_map_Big5 = 0; > > a->have_char_map_Roman = 0; > 388,400c395,415 > < TT_Get_CharMap_ID(a->face, i, &platform, &encoding); > < if ((platform == 3 && encoding == 1) || > < (platform == 2 && encoding == 1) || > < (platform == 0)) { > < TT_Get_CharMap(a->face, i, &a->char_map); > < i = n+1; > < } > < } > < > < if (i == n) { > < *error = "Sorry, but this font doesn't contain any Unicode mapping table"; > < return NULL; > < } > --- > > TT_Get_CharMap_ID(a->face, i, &platform, &encoding); > > if ((platform == 3 && encoding == 1) /* Windows Unicode */ > > || (platform == 0 && encoding == 0)) { /* ?? Unicode */ > > TT_Get_CharMap(a->face, i, &a->char_map_Unicode); > > a->have_char_map_Unicode = 1; > > map_found++; > > } else if (platform == 3 && encoding == 4) { /* Windows Big5 */ > > TT_Get_CharMap(a->face, i, &a->char_map_Big5); > > a->have_char_map_Big5 = 1; > > map_found++; > > } else if (platform == 1 && encoding == 0) { /* Apple Roman */ > > TT_Get_CharMap(a->face, i, &a->char_map_Roman); > > a->have_char_map_Roman = 1; > > map_found++; > > } > > } > > > > if (! map_found) { > > *error = "Unable to find a CharMap that I can handle"; > > return NULL; > > } > 465c480,486 > < glyph_code = TT_Char_Index(b->font->char_map, a->character); > --- > > if (b->font->have_char_map_Unicode) { > > glyph_code = TT_Char_Index(b->font->char_map_Unicode, a->character); > > } else if (a->character < 161 && b->font->have_char_map_Roman) { > > glyph_code = TT_Char_Index(b->font->char_map_Roman, a->character); > > } else if ( b->font->have_char_map_Big5) { > > glyph_code = TT_Char_Index(b->font->char_map_Big5, a->character); > > } > 660,661c681,697 > < len = gdTcl_UtfToUniChar(*next, &ch); > < *next += len; > --- > > if (font->have_char_map_Unicode) { /* use UTF-8 mapping from ASCII */ > > len = gdTcl_UtfToUniChar(*next, &ch); > > *next += len; > > } else { > > /* > > * Big 5 mapping: > > * use "JIS-8 half-width katakana" coding from 8-bit characters. Ref: > > * > > ftp://ftp.ora.com/pub/examples/nutshell/ujip/doc/japan.inf-032092.sjs > > */ > > ch = (**next) & 255; /* don't extend sign */ > > (*next)++; > > if (ch >= 161 /* first code of JIS-8 pair */ > > && **next) { /* don't advance past '\0' */ > > ch = (ch * 256) + **next; > > (*next)++; > > } > > } > > > >

« previous php.dev (#23766) next »