some fixes for 64-bit systems. Mainly changed some FT_TRACE calls to use %p instead of %lx when dumping a pointer address
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
diff --git a/CHANGES b/CHANGES
index 20c1c07..249665e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
LATEST_CHANGES
+ - some fixes for 64-bit systems (mainly changing some FT_TRACE calls
+ to use %p instead of %lx).. Thanks to Karl Robillard
+
- fixed some bugs in the sbit loader (src/base/sfnt/ttsbit.c) + added
a new flag, FT_LOAD_CROP_BITMAP to query that bitmaps be cropped when
loaded from a file (maybe I should move the bitmap cropper to the
diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h
index 5775667..d6dd15e 100644
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -358,7 +358,7 @@
TT_Load_Table_Func load_kerning;
TT_Load_Table_Func load_gasp;
-
+ TT_Load_Table_Func load_pclt;
/* see `ttsbit.h' */
TT_Load_Table_Func load_sbits;
diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
index 2a0f46c..a2df877 100644
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1971,6 +1971,7 @@
TTC_Header ttc_header;
+ FT_ULong format_tag;
TT_UShort num_tables;
TT_Table* dir_tables;
@@ -2018,6 +2019,9 @@
/* grid-fitting and scaling table */
TT_Gasp gasp; /* the `gasp' table */
+ /* PCL 5 table */
+ TT_PCLT pclt;
+
/* embedded bitmaps support */
TT_Int num_sbit_strikes;
TT_SBit_Strike* sbit_strikes;
diff --git a/include/freetype/tttables.h b/include/freetype/tttables.h
index 3cd9e4d..6bbe870 100644
--- a/include/freetype/tttables.h
+++ b/include/freetype/tttables.h
@@ -392,6 +392,34 @@
} TT_Postscript;
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_PCLT */
+ /* */
+ /* <Description> */
+ /* A structure used to model a TrueType PCLT table. All fields */
+ /* comply to the TrueType table. */
+ /* */
+ typedef struct TT_PCLT_
+ {
+ FT_Fixed Version;
+ FT_ULong FontNumber;
+ FT_UShort Pitch;
+ FT_UShort xHeight;
+ FT_UShort Style;
+ FT_UShort TypeFamily;
+ FT_UShort CapHeight;
+ FT_UShort SymbolSet;
+ FT_Char TypeFace[16];
+ FT_Char CharacterComplement[8];
+ FT_Char FileName[6];
+ FT_Char StrokeWeight[6];
+ FT_Char WidthType;
+ FT_Byte SerifStyle;
+ FT_Byte Reserved;
+
+ } TT_PCLT;
/*************************************************************************/
/* */
@@ -491,6 +519,7 @@
ft_sfnt_hhea = 3,
ft_sfnt_vhea = 4,
ft_sfnt_post = 5,
+ ft_sfnt_pclt = 6,
sfnt_max /* don't remove */
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 2feee69..f3d97ad 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -204,8 +204,8 @@
/* 32 bits, then the division is computed directly. Otherwise, we */
/* use a specialized version of the old FT_MulDiv64(). */
/* */
- EXPORT_FUNC(FT_Int32) FT_DivFix( FT_Long a,
- FT_Long b )
+ EXPORT_FUNC(FT_Long) FT_DivFix( FT_Long a,
+ FT_Long b )
{
FT_Int32 s;
FT_Word32 q;
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 81438e2..f87ccad 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -89,8 +89,8 @@
*P = NULL;
FT_TRACE2(( "FT_Alloc:" ));
- FT_TRACE2(( " size = %ld, block = 0x%08lx, ref = 0x%08lx\n",
- size, (long)*P, (long)P ));
+ FT_TRACE2(( " size = %ld, block = 0x%08p, ref = 0x%08p\n",
+ size, *P, P ));
return FT_Err_Ok;
}
@@ -193,8 +193,8 @@
void** P )
{
FT_TRACE2(( "FT_Free:" ));
- FT_TRACE2(( " Freeing block 0x%08lx, ref 0x%08lx\n",
- (long)P, (P ? (long)*P : -1) ));
+ FT_TRACE2(( " Freeing block 0x%08p, ref 0x%08p\n",
+ P, (P ? *P : (void*)0) ));
FT_Assert( P != 0 );
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index 23682c4..dcc163b 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -28,6 +28,7 @@
TT_Load_Kern,
TT_Load_Gasp,
+ TT_Load_PCLT,
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/* see `ttsbit.h' */
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index c764d28..20811fd 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -57,8 +57,8 @@
TT_Table* entry;
TT_Table* limit;
- FT_TRACE4(( "TT_LookUp_Table( %08lx, %c%c%c%c )\n",
- (TT_Long)face,
+ FT_TRACE4(( "TT_LookUp_Table( %08p, %c%c%c%c )\n",
+ face,
(TT_Char)(tag >> 24),
(TT_Char)(tag >> 16),
(TT_Char)(tag >> 8),
@@ -156,8 +156,8 @@
FT_FRAME_END };
#endif
- FT_TRACE2(( "TT_Load_Format_Tag(%08lx, %ld )\n",
- (TT_Long)face, faceIndex ));
+ FT_TRACE2(( "TT_Load_Format_Tag(%08p, %ld )\n",
+ face, faceIndex ));
face->ttc_header.Tag = 0;
face->ttc_header.version = 0;
@@ -269,8 +269,8 @@
UNUSED(faceIndex);
- FT_TRACE2(( "TT_Load_Directory( %08lx, %ld )\n",
- (TT_Long)face, faceIndex ));
+ FT_TRACE2(( "TT_Load_Directory( %08p, %ld )\n",
+ face, faceIndex ));
#ifdef READ_FIELDS
if ( READ_Fields( table_dir_fields, &tableDir ) )
@@ -462,7 +462,7 @@
FT_FRAME_END };
#endif
- FT_TRACE2(( "Load_TT_Header( %08lx )\n", (TT_Long)face ));
+ FT_TRACE2(( "Load_TT_Header( %08p )\n", face ));
error = face->goto_table( face, TTAG_head, stream, 0 );
if ( error )
@@ -558,7 +558,7 @@
FT_FRAME_END };
#endif
- FT_TRACE2(( "Load_TT_MaxProfile( %08lx )\n", (TT_Long)face ));
+ FT_TRACE2(( "Load_TT_MaxProfile( %08p )\n", face ));
error = face->goto_table( face, TTAG_maxp, stream, 0 );
if (error) goto Exit;
@@ -658,8 +658,8 @@
TT_LongMetrics** longs;
TT_ShortMetrics** shorts;
- FT_TRACE2(( "TT_Load_%s_Metrics( %08lx )\n",
- vertical ? "Vertical" : "Horizontal", (TT_Long)face ));
+ FT_TRACE2(( "TT_Load_%s_Metrics( %08p )\n",
+ vertical ? "Vertical" : "Horizontal", face ));
if ( vertical )
{
@@ -1413,7 +1413,7 @@
TT_Error error;
TT_Postscript* post = &face->postscript;
#ifdef READ_FIELDS
- const FT_Frame_Field post_fields[] = {
+ static const FT_Frame_Field post_fields[] = {
FT_FRAME_START(32),
FT_FRAME_ULONG( TT_Postscript, FormatType ),
FT_FRAME_ULONG( TT_Postscript, italicAngle ),
@@ -1464,6 +1464,70 @@
/*************************************************************************/
/* */
/* <Function> */
+ /* TT_Load_PCLT */
+ /* */
+ /* <Description> */
+ /* Loads the PCL 5 Table. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the target face object. */
+ /* stream :: A handle to the input stream. */
+ /* */
+ /* <Return> */
+ /* TrueType error code. 0 means success. */
+ /* */
+ LOCAL_FUNC
+ TT_Error TT_Load_PCLT( TT_Face face,
+ FT_Stream stream )
+ {
+ static const FT_Frame_Field pclt_fields[] = {
+ FT_FRAME_START( 20 ),
+ FT_FRAME_ULONG ( TT_PCLT, Version ),
+ FT_FRAME_ULONG ( TT_PCLT, FontNumber ),
+ FT_FRAME_USHORT( TT_PCLT, Pitch ),
+ FT_FRAME_USHORT( TT_PCLT, xHeight ),
+ FT_FRAME_USHORT( TT_PCLT, Style ),
+ FT_FRAME_USHORT( TT_PCLT, TypeFamily ),
+ FT_FRAME_USHORT( TT_PCLT, CapHeight ),
+ FT_FRAME_END };
+
+ static const FT_Frame_Field pclt_fields2[] = {
+ FT_FRAME_START( 4 ),
+ FT_FRAME_CHAR( TT_PCLT, StrokeWeight ),
+ FT_FRAME_CHAR( TT_PCLT, WidthType ),
+ FT_FRAME_BYTE( TT_PCLT, SerifStyle ),
+ FT_FRAME_BYTE( TT_PCLT, Reserved ),
+ FT_FRAME_END };
+
+ TT_Error error;
+ TT_PCLT* pclt = &face->pclt;
+
+ FT_TRACE2(( "PCLT " ));
+
+ /* optional table */
+ error = face->goto_table( face, TTAG_PCLT, stream, 0 );
+ if (error)
+ {
+ FT_TRACE2(( "missing (optional)\n" ));
+ pclt->Version = 0;
+ return 0;
+ }
+
+ if ( READ_Fields( pclt_fields, pclt ) ||
+ FILE_Read ( pclt->TypeFace, 16 ) ||
+ FILE_Read ( pclt->CharacterComplement, 8 ) ||
+ FILE_Read ( pclt->FileName, 6 ) ||
+ READ_Fields( pclt_fields2, pclt ) )
+ goto Exit;
+
+ FT_TRACE2(( "loaded\n" ));
+ Exit:
+ return error;
+ }
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
/* TT_Load_Gasp */
/* */
/* <Description> */
@@ -1487,7 +1551,7 @@
TT_GaspRange* gaspranges;
- FT_TRACE2(( "TT_Load_Gasp( %08lx )\n", (TT_Long)face ));
+ FT_TRACE2(( "TT_Load_Gasp( %08p )\n", face ));
/* the gasp table is optional */
error = face->goto_table( face, TTAG_gasp, stream, 0 );
diff --git a/src/sfnt/ttload.h b/src/sfnt/ttload.h
index d8ff20b..cde8401 100644
--- a/src/sfnt/ttload.h
+++ b/src/sfnt/ttload.h
@@ -103,6 +103,9 @@
TT_Error TT_Load_Hdmx( TT_Face face,
FT_Stream stream );
+ LOCAL_DEF
+ TT_Error TT_Load_PCLT( TT_Face face,
+ FT_Stream stream );
LOCAL_DEF
void TT_Free_Names( TT_Face face );
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 33b4123..1e8318a 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -651,6 +651,7 @@
case ft_sfnt_os2: table = (face->os2.version == 0xFFFF ? 0 : &face->os2 ); break;
case ft_sfnt_post: table = &face->postscript; break;
case ft_sfnt_maxp: table = &face->max_profile; break;
+ case ft_sfnt_pclt: table = face->pclt.Version ? &face->pclt : 0 ; break;
default:
table = 0;
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 64bce53..4fcdac8 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -435,8 +435,8 @@
TT_Error error;
- FT_TRACE1(( "TT.Create_Create: new object at 0x%08lx, parent = 0x%08lx\n",
- (long)exec, (long)face ));
+ FT_TRACE1(( "TT.Create_Create: new object at 0x%08p, parent = 0x%08p\n",
+ exec, face ));
/* XXX: We don't reserve arrays anymore, this is done automatically */
/* during a call to Context_Load(). */
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index faccdc3..8f2a60d 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -215,6 +215,9 @@
goto Exit;
}
+ /* store format tag */
+ face->format_tag = format_tag;
+
/* Load font directory */
error = sfnt->load_directory( face, stream, face_index );
if ( error ) goto Exit;
@@ -254,6 +257,7 @@
if ( LOAD_( hdmx ) ||
LOAD_( gasp ) ||
LOAD_( kerning ) ||
+ LOAD_( pclt ) ||
(error = TT_Load_Locations( face, stream )) != TT_Err_Ok ||
(error = TT_Load_CVT ( face, stream )) != TT_Err_Ok ||