* src/cache/ftccmap.c: the cmap cache now supports UCS-4 charmaps when available in Asian fonts * src/sfnt/ttload.c, src/base/ftobjs.c: changed "asian" to "Asian" in comments * src/truetype/ttdriver.c (Set_Char_Sizes): fixed a rounding bug when computing the scale factors for a given character size in points with resolution.
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
diff --git a/ChangeLog b/ChangeLog
index 53da3db..2bf5efb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,27 +1,38 @@
+2003-02-25 Anthony Fok <anthony@thizlinux.com>
+
+ * src/cache/ftccmap.c: the cmap cache now supports UCS-4 charmaps
+ when available in Asian fonts
+
+ * src/sfnt/ttload.c, src/base/ftobjs.c: changed "asian" to "Asian" in
+ comments
+
2003-02-25 David Turner <david@freetype.org>
* src/gzip/ftgzip.c: fixed a bug that caused FreeType to loop endlessly
when trying to read certain compressed gzip files. The following test
could be used to reveal the bug:
-
+
touch 0123456789 ; gzip 0123456789 ; ftdump 0123456789.gz
* src/pfr/pfrobjs.c, src/pfr/pfrload.c, src/pfr/pfrtypes.h: several
fixes to the PFR font driver:
-
+
- the list of available embedded bitmaps was not correctly set
in the root FT_FaceRec structure describing the face
-
+
- the glyph loader always tried to load the outlines when
FT_LOAD_SBITS_ONLY was specified
-
+
- the table loaded now scans for *undocumented* elements of a
physical font's auxiliary data record, this is necessary to
retrieve the "real" family and style names.
-
+
NOTE THAT THIS CHANGES THE FAMILY NAME OF MANY PFR FONTS !!
+ * src/truetype/ttdriver.c (Set_Char_Sizes): fixed a rounding bug when
+ computing the scale factors for a given character size in points with
+ resolution.
2003-02-18 David Turner <david@freetype.org>
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 3254738..433ebdb 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -739,7 +739,7 @@
* however, recent updates to the Apple and OpenType specifications
* introduced new formats that are capable of mapping 32-bit character
* codes as well. And these are already used on some fonts, mainly to
- * map non-BMP asian ideographs as defined in Unicode.
+ * map non-BMP Asian ideographs as defined in Unicode.
*
* for compatibility purposes, these fonts generally come with
* *several* Unicode charmaps:
diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index 4f575db..77e6ecb 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -23,6 +23,7 @@
#include FT_CACHE_MANAGER_H
#include FT_INTERNAL_MEMORY_H
#include FT_INTERNAL_DEBUG_H
+#include FT_TRUETYPE_IDS_H
#include "ftcerror.h"
@@ -189,10 +190,54 @@
break;
case FTC_CMAP_BY_ENCODING:
- for ( idx = 0; idx < count; idx++, cur++ )
- if ( cur[0]->encoding == desc->u.encoding )
- break;
+ if (desc->u.encoding == FT_ENCODING_UNICODE)
+ {
+ /* since the `interesting' table, with id's 3,10, is normally the
+ * last one, we loop backwards. This looses with type1 fonts with
+ * non-BMP characters (<.0001%), this wins with .ttf with non-BMP
+ * chars (.01% ?), and this is the same about 99.99% of the time!
+ */
+
+ FT_UInt unicmap_idx = count; /* some UCS-2 map, if we found it */
+
+ cur += count - 1;
+
+ for ( idx = 0; idx < count; idx++, cur-- )
+ {
+ if ( cur[0]->encoding == FT_ENCODING_UNICODE )
+ {
+ unicmap_idx = idx; /* record we found a Unicode charmap */
+
+ /* XXX If some new encodings to represent UCS-4 are added,
+ * they should be added here.
+ */
+ if ( ( cur[0]->platform_id == TT_PLATFORM_MICROSOFT &&
+ cur[0]->encoding_id == TT_MS_ID_UCS_4 ) ||
+ ( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE &&
+ cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32 ) )
+
+ /* Hurray! We found a UCS-4 charmap. We can stop the scan! */
+ {
+ idx = count - 1 - idx;
+ goto Found_idx_for_FTC_CMAP_BY_ENCODING;
+ }
+ }
+ }
+
+ /* We do not have any UCS-4 charmap. Sigh.
+ * Let's see if we have some other kind of Unicode charmap, though.
+ */
+ if ( unicmap_idx < count )
+ idx = count - 1 - unicmap_idx;
+ }
+ else
+ {
+ for ( idx = 0; idx < count; idx++, cur++ )
+ if ( cur[0]->encoding == desc->u.encoding )
+ break;
+ }
+ Found_idx_for_FTC_CMAP_BY_ENCODING:
hash = idx * 67;
break;
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index 530dff6..7a79503 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -1106,7 +1106,7 @@
if ( FT_STREAM_READ_FIELDS( name_table_fields, table ) )
goto Exit;
- /* Some popular asian fonts have an invalid `storageOffset' value */
+ /* Some popular Asian fonts have an invalid `storageOffset' value */
/* (it should be at least "6 + 12*num_names"). However, the string */
/* offsets, computed as "storageOffset + entry->stringOffset", are */
/* valid pointers within the name table... */
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index c4d1de4..cc58b06 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -208,8 +208,8 @@
/* we need to use rounding in the following computations. Otherwise,
* the resulting hinted outlines will be very slightly distorted
*/
- dim_x = ( ( ( char_width * horz_resolution ) / 72 ) + 32 ) & -64;
- dim_y = ( ( ( char_height * vert_resolution ) / 72 ) + 32 ) & -64;
+ dim_x = ( char_width * horz_resolution + 36 ) / 72;
+ dim_y = ( char_height * vert_resolution + 36 ) / 72;
metrics2->x_ppem = (FT_UShort)( dim_x >> 6 );
metrics2->y_ppem = (FT_UShort)( dim_y >> 6 );