* src/pcf/pcfdriver.c (pcf_cmap_char_next): fixed a bug that caused the function to return invalid values.
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 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447
diff --git a/ChangeLog b/ChangeLog
index 27fc633..483fc0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,14 @@
2002-06-08 David Turner <david@freetype.org>
+ * src/pcf/pcfdriver.c (pcf_cmap_char_next): fixed a bug that caused
+ the function to return invalid values.
+
* src/cache/ftccache.i: removing a typo that prevented
- the source's compilation
+ the source's compilation
- * src/cache/ftccache.c (ftc_node_hash_unlink): fixed a
+ * src/cache/ftccache.c (ftc_node_hash_unlink): fixed a
bug that caused nasty memory overwrites. the hash table's
- buckets array wasn't correctly resized when shrinked.
+ buckets array wasn't correctly resized when shrinked.
2002-06-08 Detlef Würkner <TetiSoft@apg.lahn.de>
@@ -167,7 +170,7 @@
* include/freetype/ftxf86.h, src/base/ftxf86.c: New files.
They provide a new API (FT_Get_X11_Font_Format) to retrieve an
- X11-compatible string describing the font format of a given face.
+ X11-compatible string describing the font format of a given face.
This was put in a new optional base source file, corresponding to a
new public header (named FT_XFREE86_H since this function should
only be used within the XFree86 font server IMO).
diff --git a/builds/win32/ftdebug.c b/builds/win32/ftdebug.c
index 8294550..7615172 100644
--- a/builds/win32/ftdebug.c
+++ b/builds/win32/ftdebug.c
@@ -48,11 +48,11 @@
#ifdef FT_DEBUG_LEVEL_ERROR
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
+# include <stdarg.h>
+# include <stdlib.h>
+# include <string.h>
-#include <windows.h>
+# include <windows.h>
FT_EXPORT_DEF( void )
@@ -85,22 +85,22 @@
}
-#ifdef FT_DEBUG_LEVEL_TRACE
+# ifdef FT_DEBUG_LEVEL_TRACE
/* array of trace levels, initialized to 0 */
int ft_trace_levels[trace_count];
/* define array of trace toggle names */
-#define FT_TRACE_DEF( x ) #x ,
+# define FT_TRACE_DEF( x ) #x ,
static const char* ft_trace_toggles[trace_count + 1] =
- {
-#include FT_INTERNAL_TRACE_H
+ {
+# include FT_INTERNAL_TRACE_H
NULL
};
-#undef FT_TRACE_DEF
+# undef FT_TRACE_DEF
/*************************************************************************/
@@ -125,49 +125,49 @@
ft_debug_init( void )
{
const char* ft2_debug = getenv( "FT2_DEBUG" );
-
+
if ( ft2_debug )
{
const char* p = ft2_debug;
const char* q;
-
+
for ( ; *p; p++ )
{
/* skip leading whitespace and separators */
if ( *p == ' ' || *p == '\t' || *p == ':' || *p == ';' || *p == '=' )
continue;
-
+
/* read toggle name, followed by '=' */
q = p;
while ( *p && *p != '=' )
p++;
-
+
if ( *p == '=' && p > q )
{
int n, i, len = p - q;
int level = -1, found = -1;
-
+
for ( n = 0; n < trace_count; n++ )
{
const char* toggle = ft_trace_toggles[n];
-
+
for ( i = 0; i < len; i++ )
{
if ( toggle[i] != q[i] )
break;
}
-
+
if ( i == len && toggle[i] == 0 )
{
found = n;
break;
}
}
-
+
/* read level */
p++;
if ( *p )
@@ -176,7 +176,7 @@
if ( level < 0 || level > 6 )
level = -1;
}
-
+
if ( found >= 0 && level >= 0 )
{
if ( found == trace_any )
@@ -194,7 +194,7 @@
}
-#else /* !FT_DEBUG_LEVEL_TRACE */
+# else /* !FT_DEBUG_LEVEL_TRACE */
FT_BASE_DEF( void )
@@ -204,7 +204,8 @@
}
-#endif /* !FT_DEBUG_LEVEL_TRACE */
+# endif /* !FT_DEBUG_LEVEL_TRACE */
+#endif /* FT_DEBUG_LEVEL_ERROR */
/* END */
diff --git a/docs/CHANGES b/docs/CHANGES
index fc2de8c..446f932 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -23,7 +23,7 @@ LATEST CHANGES BETWEEN 2.1.1 and 2.1.0
- The TrueType name table loader has been improved to support many
popular though buggy Asian fonts. It now ignores empty name entries,
- invalid pointer offsets and a few other incorrect subtleties.
+ invalid pointer offsets and a few other incorrect subtleties.
Moreover, name strings are now loaded on demand, which reduces the
memory load of many faces (e.g. the ARIAL.TTF font file contains a
10kByte name table with 70 names).
@@ -41,14 +41,27 @@ LATEST CHANGES BETWEEN 2.1.1 and 2.1.0
(using a slightly extended BDF format).
* A Type42 font driver, contributed by Roberto Alameda. It is
- still experimental but seems to work relatively well. Currently,
- charmap support is not fully implemented.
+ still experimental but seems to work relatively well.
* A PFR font driver, contributed by David Turner himself. It doesn't
support PFR hinting -- note that BitStream has at least two patents
on this format!
+ III. MISCELLANEOUS
+
+ - The cache sub-system has been optimized in important ways. Cache hits are
+ now significantly faster. For example, using the CMap cache is about
+ twice faster than calling FT_Get_Char_Index on most platforms. Similarly,
+ using a SBit cache is about 5x faster than loading the bitmaps from a
+ bitmap file, and 300x to 500x than generating them from a scalable
+ format :-)
+
+ Note that you should recompile your sources if you designed a custom
+ cache class for the FT2 Cache subsystem, since the changes performed
+ are source, but not binary, compatible...
+
+
========================================================================
LATEST CHANGES BETWEEN 2.1.0 and 2.0.9
diff --git a/src/pcf/pcfdriver.c b/src/pcf/pcfdriver.c
index 9fb14b5..a1636e0 100644
--- a/src/pcf/pcfdriver.c
+++ b/src/pcf/pcfdriver.c
@@ -48,7 +48,7 @@ THE SOFTWARE.
FT_CMapRec cmap;
FT_UInt num_encodings;
PCF_Encoding encodings;
-
+
} PCF_CMapRec, *PCF_CMap;
@@ -56,22 +56,22 @@ THE SOFTWARE.
pcf_cmap_init( PCF_CMap cmap )
{
PCF_Face face = (PCF_Face)FT_CMAP_FACE( cmap );
-
+
cmap->num_encodings = (FT_UInt)face->nencodings;
cmap->encodings = face->encodings;
-
+
return FT_Err_Ok;
}
-
+
FT_CALLBACK_DEF( void )
pcf_cmap_done( PCF_CMap cmap )
{
- cmap->encodings = NULL;
+ cmap->encodings = NULL;
cmap->num_encodings = 0;
}
-
+
FT_CALLBACK_DEF( FT_UInt )
pcf_cmap_char_index( PCF_CMap cmap,
@@ -80,33 +80,33 @@ THE SOFTWARE.
PCF_Encoding encodings = cmap->encodings;
FT_UInt min, max, mid;
FT_UInt result = 0;
-
+
min = 0;
max = cmap->num_encodings;
-
+
while ( min < max )
{
FT_UInt32 code;
-
+
mid = ( min + max ) >> 1;
code = encodings[mid].enc;
-
+
if ( charcode == code )
{
result = encodings[mid].glyph;
break;
}
-
+
if ( charcode < code )
max = mid;
else
min = mid + 1;
}
-
+
return result;
- }
+ }
FT_CALLBACK_DEF( FT_UInt )
@@ -117,42 +117,42 @@ THE SOFTWARE.
FT_UInt min, max, mid;
FT_UInt32 charcode = *acharcode + 1;
FT_UInt result = 0;
-
+
min = 0;
max = cmap->num_encodings;
-
+
while ( min < max )
{
FT_UInt32 code;
-
+
mid = ( min + max ) >> 1;
code = encodings[mid].enc;
-
+
if ( charcode == code )
{
result = encodings[mid].glyph;
goto Exit;
}
-
+
if ( charcode < code )
max = mid;
else
min = mid + 1;
}
-
+
charcode = 0;
- if ( ++min < cmap->num_encodings )
+ if ( min < cmap->num_encodings )
{
charcode = encodings[min].enc;
result = encodings[min].glyph;
}
-
+
Exit:
*acharcode = charcode;
return result;
- }
+ }
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec pcf_cmap_class =
@@ -204,7 +204,7 @@ THE SOFTWARE.
FT_TRACE4(( "get_next_char %ld\n", char_code ));
-
+
char_code++;
low = 0;
high = face->nencodings - 1;
@@ -222,7 +222,7 @@ THE SOFTWARE.
if ( high < 0 )
high = 0;
-
+
while ( high < face->nencodings )
{
if ( en_table[high].enc >= char_code )
@@ -259,20 +259,20 @@ THE SOFTWARE.
{
PCF_Property prop = face->properties;
FT_Int i;
-
+
for ( i = 0; i < face->nprops; i++ )
{
prop = &face->properties[i];
-
+
FT_FREE( prop->name );
if ( prop->isString )
FT_FREE( prop->value );
}
-
+
FT_FREE( face->properties );
}
-
+
FT_FREE( face->toc.tables );
FT_FREE( face->root.family_name );
FT_FREE( face->root.available_sizes );
@@ -325,20 +325,20 @@ THE SOFTWARE.
{
FT_CharMapRec charmap;
-
+
charmap.face = FT_FACE( face );
charmap.encoding = ft_encoding_none;
charmap.platform_id = 0;
charmap.encoding_id = 0;
-
+
if ( unicode_charmap )
{
charmap.encoding = ft_encoding_unicode;
charmap.platform_id = 3;
charmap.encoding_id = 1;
}
-
+
error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL );
}
@@ -358,15 +358,15 @@ THE SOFTWARE.
face->charmap.platform_id = 3;
face->charmap.encoding_id = 1;
}
-
+
face->charmap.face = &face->root;
face->charmap_handle = &face->charmap;
face->root.charmap = face->charmap_handle;
-#endif /* !FT_CONFIG_OPTION_USE_CMAPS */
-
+#endif /* !FT_CONFIG_OPTION_USE_CMAPS */
+
}
-
+
Exit:
return error;
@@ -552,7 +552,7 @@ THE SOFTWARE.
(FT_Slot_LoadFunc) PCF_Glyph_Load,
-#ifndef FT_CONFIG_OPTION_USE_CMAPS
+#ifndef FT_CONFIG_OPTION_USE_CMAPS
(FT_CharMap_CharIndexFunc)PCF_Char_Get_Index,
#else
(FT_CharMap_CharIndexFunc)0,
@@ -566,7 +566,7 @@ THE SOFTWARE.
(FT_CharMap_CharNextFunc) PCF_Char_Get_Next,
#else
(FT_CharMap_CharNextFunc) 0
-#endif
+#endif
};