summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner <david@freetype.org>2002-06-10 22:41:57 +0000
committerDavid Turner <david@freetype.org>2002-06-10 22:41:57 +0000
commitb1d8f73df686862cc12dc00def031ecff028d151 (patch)
tree16a4c465c402583c59d3efdfe71ff8199441861f
parent4d12d89dcd96bf2a7512b47d1fa3e04d52273ce2 (diff)
downloadfreetype2-b1d8f73df686862cc12dc00def031ecff028d151.tar.gz
* src/pcf/pcfdriver.c (pcf_cmap_char_next): fixed a bug that caused
the function to return invalid values.
-rw-r--r--ChangeLog11
-rw-r--r--builds/win32/ftdebug.c41
-rw-r--r--docs/CHANGES19
-rw-r--r--src/pcf/pcfdriver.c74
4 files changed, 81 insertions, 64 deletions
diff --git a/ChangeLog b/ChangeLog
index 27fc63338..483fc0a5f 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 82945503e..7615172ed 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 fc2de8caf..446f9320f 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 9fb14b561..a1636e04b 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
};