* src/sfnt/ttcmap.c, src/sfnt/ttcmap.h: s/TT_CMAP_FLAG_OVERLAPPED/TT_CMAP_FLAG_OVERLAPPING/.
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
diff --git a/ChangeLog b/ChangeLog
index 8f3283e..bc7686d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
* docs/CHANGES: Document ftdump's `-v' option.
Document latest charmap code changes.
+ * src/sfnt/ttcmap.c, src/sfnt/ttcmap.h:
+ s/TT_CMAP_FLAG_OVERLAPPED/TT_CMAP_FLAG_OVERLAPPING/.
+
2005-11-30 Chia-I Wu <b90201047@ntu.edu.tw>
* src/sfnt/ttcmap.c (tt_cmap4_char_map_binary,
@@ -10,28 +13,27 @@
2005-11-29 Chia-I Wu <b90201047@ntu.edu.tw>
- Major update to distinguish between unsorted and overlapped segments
- for cmap format 4. For overlapped but sorted segments, which is
- previously considered unsorted, we still use binary search.
+ Major update to distinguish between unsorted and overlapping
+ segments for cmap format 4. For overlapping but sorted segments,
+ which is previously considered unsorted, we still use binary search.
- * src/sfnt/ttcmap.h (struct TT_CMapRec_): Replace `unsorted' by
- `flags'.
+ * src/sfnt/ttcmap.h (TT_CMapRec_): Replace `unsorted' by `flags'.
(TT_CMAP_FLAG_UNSORTED, TT_CMAP_FLAG_OVERLAPPED): New macros.
* src/sfnt/ttcmap.c (OPT_CMAP4): Removed as it is always defined.
- (struct TT_CMap4Rec_): Remove `old_charcode' and `table_length'.
+ (TT_CMap4Rec_): Remove `old_charcode' and `table_length'.
(tt_cmap4_reset): Removed.
(tt_cmap4_init): Updated accordingly.
(tt_cmap4_next): Updated accordingly.
- Take care of overlapped segments.
+ Take care of overlapping segments.
(tt_cmap4_validate): Make sure the subtable is large enough.
Do not check glyph_ids because some fonts set the length wrongly.
- Also, when all segments have offset 0, glyph_ids is always invalid. It
- does not cause any problem so far only because the check misses
+ Also, when all segments have offset 0, glyph_ids is always invalid.
+ It does not cause any problem so far only because the check misses
equality.
- Distinguish between unsorted and overlapped segments.
- (tt_cmap4_char_map_linear, tt_cmap4_char_map_binary): New functions to
- do "charcode => glyph index" by linear/binary search.
+ Distinguish between unsorted and overlapping segments.
+ (tt_cmap4_char_map_linear, tt_cmap4_char_map_binary): New functions
+ to do `charcode => glyph index' by linear/binary search.
(tt_cmap4_char_index, tt_cmap4_char_next): Use
tt_cmap4_char_map_linear and tt_cmap4_char_map_binary.
(tt_face_build_cmaps): Treat the return value of validator as flags
@@ -39,10 +41,10 @@
2005-11-29 Chia-I Wu <b90201047@ntu.edu.tw>
- * src/sfnt/ttcmap.c (struct TT_CMap12Rec_, tt_cmap12_init,
- tt_cmap12_next): New struct/function for fast "next char".
- (tt_cmap12_char_map_binary): New function to do "charcode => glyph
- index" by binary search.
+ * src/sfnt/ttcmap.c (TT_CMap12Rec_, tt_cmap12_init, tt_cmap12_next):
+ New structures and functions for fast `next char'.
+ (tt_cmap12_char_map_binary): New function to do `charcode => glyph
+ index' by binary search.
(tt_cmap12_char_index, tt_cmap12_char_next): Use
tt_cmap12_char_map_binary.
(tt_face_build_cmaps): Check table and offset correctly (equality is
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index e20fd79..9deb483 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -700,10 +700,10 @@
}
- /* find the index of the charcode next to cmap->cur_charcode; */
- /* caller should call tt_cmap4_set_range with proper range */
- /* before calling this function */
- /* */
+ /* search the index of the charcode next to cmap->cur_charcode; */
+ /* caller should call tt_cmap4_set_range with proper range */
+ /* before calling this function */
+ /* */
static void
tt_cmap4_next( TT_CMap4 cmap )
{
@@ -894,7 +894,7 @@
if ( last_start > start || last_end > end )
error |= TT_CMAP_FLAG_UNSORTED;
else
- error |= TT_CMAP_FLAG_OVERLAPPED;
+ error |= TT_CMAP_FLAG_OVERLAPPING;
}
}
@@ -947,7 +947,7 @@
}
last_start = start;
- last_end = end;
+ last_end = end;
}
}
@@ -964,7 +964,7 @@
FT_Int delta;
FT_UInt i, num_segs;
FT_UInt32 charcode = *pcharcode;
- FT_UInt gindex = 0;
+ FT_UInt gindex = 0;
FT_Byte* p;
@@ -1029,15 +1029,15 @@
static FT_UInt
- tt_cmap4_char_map_binary( TT_CMap cmap,
- FT_UInt* pcharcode,
- FT_Bool next )
+ tt_cmap4_char_map_binary( TT_CMap cmap,
+ FT_UInt* pcharcode,
+ FT_Bool next )
{
FT_UInt num_segs2, start, end, offset;
FT_Int delta;
FT_UInt max, min, mid, num_segs;
FT_UInt charcode = *pcharcode;
- FT_UInt gindex = 0;
+ FT_UInt gindex = 0;
FT_Byte* p;
@@ -1074,13 +1074,13 @@
min = mid + 1;
else
{
- p += num_segs2;
- delta = TT_PEEK_SHORT( p );
- p += num_segs2;
- offset = TT_PEEK_USHORT( p );
+ p += num_segs2;
+ delta = TT_PEEK_SHORT( p );
+ p += num_segs2;
+ offset = TT_PEEK_USHORT( p );
- /* find the first segment containing `charcode' */
- if ( cmap->flags & TT_CMAP_FLAG_OVERLAPPED )
+ /* search the first segment containing `charcode' */
+ if ( cmap->flags & TT_CMAP_FLAG_OVERLAPPING )
{
FT_UInt i;
@@ -1091,7 +1091,7 @@
if ( offset == 0xFFFFU )
mid = max + 1;
- /* find in segments before the current segment */
+ /* search in segments before the current segment */
for ( i = max ; i > 0; i-- )
{
FT_UInt prev_end;
@@ -1103,13 +1103,13 @@
if ( charcode > prev_end )
break;
- end = prev_end;
- p += 2 + num_segs2;
- start = TT_PEEK_USHORT( p );
- p += num_segs2;
- delta = TT_PEEK_SHORT( p );
- p += num_segs2;
- offset = TT_PEEK_USHORT( p );
+ end = prev_end;
+ p += 2 + num_segs2;
+ start = TT_PEEK_USHORT( p );
+ p += num_segs2;
+ delta = TT_PEEK_SHORT( p );
+ p += num_segs2;
+ offset = TT_PEEK_USHORT( p );
if ( offset != 0xFFFFU )
mid = i - 1;
@@ -1120,38 +1120,38 @@
{
if ( i != max )
{
- p = cmap->data + 14 + max * 2;
- end = TT_PEEK_USHORT( p );
- p += 2 + num_segs2;
- start = TT_PEEK_USHORT( p );
- p += num_segs2;
- delta = TT_PEEK_SHORT( p );
- p += num_segs2;
- offset = TT_PEEK_USHORT( p );
+ p = cmap->data + 14 + max * 2;
+ end = TT_PEEK_USHORT( p );
+ p += 2 + num_segs2;
+ start = TT_PEEK_USHORT( p );
+ p += num_segs2;
+ delta = TT_PEEK_SHORT( p );
+ p += num_segs2;
+ offset = TT_PEEK_USHORT( p );
}
mid = max;
- /* find in segments after the current segment */
+ /* search in segments after the current segment */
for ( i = max + 1; i < num_segs; i++ )
{
FT_UInt next_end, next_start;
- p = cmap->data + 14 + i * 2;
- next_end = TT_PEEK_USHORT( p );
- p += 2 + num_segs2;
- next_start = TT_PEEK_USHORT( p );
+ p = cmap->data + 14 + i * 2;
+ next_end = TT_PEEK_USHORT( p );
+ p += 2 + num_segs2;
+ next_start = TT_PEEK_USHORT( p );
if ( charcode < next_start )
break;
- end = next_end;
- start = next_start;
- p += num_segs2;
- delta = TT_PEEK_SHORT( p );
- p += num_segs2;
- offset = TT_PEEK_USHORT( p );
+ end = next_end;
+ start = next_start;
+ p += num_segs2;
+ delta = TT_PEEK_SHORT( p );
+ p += num_segs2;
+ offset = TT_PEEK_USHORT( p );
if ( offset != 0xFFFFU )
mid = i;
@@ -1167,17 +1167,17 @@
}
}
- /* end, start, delta and offset are for the i'th segment */
+ /* end, start, delta, and offset are for the i'th segment */
if ( mid != i )
{
- p = cmap->data + 14 + mid * 2;
- end = TT_PEEK_USHORT( p );
- p += 2 + num_segs2;
- start = TT_PEEK_USHORT( p );
- p += num_segs2;
- delta = TT_PEEK_SHORT( p );
- p += num_segs2;
- offset = TT_PEEK_USHORT( p );
+ p = cmap->data + 14 + mid * 2;
+ end = TT_PEEK_USHORT( p );
+ p += 2 + num_segs2;
+ start = TT_PEEK_USHORT( p );
+ p += num_segs2;
+ delta = TT_PEEK_SHORT( p );
+ p += num_segs2;
+ offset = TT_PEEK_USHORT( p );
}
}
else
@@ -1247,7 +1247,7 @@
tt_cmap4_char_index( TT_CMap cmap,
FT_UInt32 char_code )
{
- if ( char_code >= 0x10000U )
+ if ( char_code >= 0x10000UL )
return 0;
if ( cmap->flags & TT_CMAP_FLAG_UNSORTED )
@@ -1927,14 +1927,14 @@
FT_CALLBACK_DEF( FT_Error )
tt_cmap12_init( TT_CMap12 cmap,
- FT_Byte* table )
+ FT_Byte* table )
{
- cmap->cmap.data = table;
+ cmap->cmap.data = table;
- table += 12;
- cmap->num_groups = FT_PEEK_ULONG( table );
+ table += 12;
+ cmap->num_groups = FT_PEEK_ULONG( table );
- cmap->valid = 0;
+ cmap->valid = 0;
return SFNT_Err_Ok;
}
@@ -1992,9 +1992,9 @@
}
- /* find the index of the charcode next to cmap->cur_charcode */
- /* cmap->cur_group should be set up properly by caller */
- /* */
+ /* search the index of the charcode next to cmap->cur_charcode */
+ /* cmap->cur_group should be set up properly by caller */
+ /* */
static void
tt_cmap12_next( TT_CMap12 cmap )
{
@@ -2071,10 +2071,10 @@
while ( min < max )
{
mid = ( min + max ) >> 1;
- p = cmap->data + 16 + 12 * mid;
+ p = cmap->data + 16 + 12 * mid;
- start = TT_NEXT_ULONG( p );
- end = TT_NEXT_ULONG( p );
+ start = TT_NEXT_ULONG( p );
+ end = TT_NEXT_ULONG( p );
if ( char_code < start )
max = mid;
@@ -2105,9 +2105,9 @@
return 0;
}
- cmap12->valid = 1;
+ cmap12->valid = 1;
cmap12->cur_charcode = char_code;
- cmap12->cur_group = mid;
+ cmap12->cur_group = mid;
if ( !gindex )
{
@@ -2304,7 +2304,8 @@
FT_CMap ttcmap;
- if ( !FT_CMap_New( (FT_CMap_Class)clazz, cmap, &charmap, &ttcmap ) )
+ if ( !FT_CMap_New( (FT_CMap_Class)clazz,
+ cmap, &charmap, &ttcmap ) )
{
/* it is simpler to directly set `flags' than adding */
/* a parameter to FT_CMap_New */
diff --git a/src/sfnt/ttcmap.h b/src/sfnt/ttcmap.h
index fb03107..a10a3e2 100644
--- a/src/sfnt/ttcmap.h
+++ b/src/sfnt/ttcmap.h
@@ -28,8 +28,8 @@
FT_BEGIN_HEADER
-#define TT_CMAP_FLAG_UNSORTED 1
-#define TT_CMAP_FLAG_OVERLAPPED 2
+#define TT_CMAP_FLAG_UNSORTED 1
+#define TT_CMAP_FLAG_OVERLAPPING 2
typedef struct TT_CMapRec_
{