[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] cmap in webdings
From: |
Dirck Blaskey |
Subject: |
[Devel] cmap in webdings |
Date: |
Mon, 20 May 2002 15:18:40 -0700 |
I have a pdf file with an embedded True Type font, webdings,
that has some oddities with its cmap, so FT_Get_Char_Index
wasn't working.
The cmap doesn't explicitly cover the character ranges,
most of the entries have startCount == endCount.
Here is a patch to Freetype 2.0.9 sfnt/ttcmap.c;
The patch should work with the current development snapshot.
In theory, there might be a problem with the patch,
when looking for characters that _really_ aren't there.
Maybe an additional check for startCount == endCount?
Is there any safe way to be sure?
A better fix might be to do some doctoring after the load;
the 'length' value from the dump looks right, maybe
that can be used to validate the fixups at load time.
The patch goes just above the:
return 0;
Found:
in code_to_index4().
Here's the patch:
735a736,753
>
> /* [[ 2002.5.20 for webdings.tt embedded in a pdf file
> the table doesn't cover the glyphs we want,
> but the information is there.
> if RangeOffset == 0 assuming endCount is next StartCount - 1
>
> the last_segment optimization above won't catch this
> */
> limit--;
> for ( seg4 = cmap4->segments; seg4 <= limit; seg4++ )
> {
> if ( seg4->idRangeOffset == 0 &&
> charCode >= (FT_UInt)seg4->startCount &&
> seg4 == limit || charCode < seg4[1].startCount )
> goto Found;
> }
> /* ]] */
>
Here's the cmap dump from the font:
Subtable 1. Platform ID: 0
Specific ID: 3
'cmap' Offset: 0x0000024A
->Format: 4 : Segment mapping to delta values
Length: 100
Version: 0
segCount: 9 (X2 = 18)
searchRange: 16
entrySelector: 3
rangeShift: 2
Seg 1 : St = 0009, En = 000A, D = 0, RO = 18, gId# = 0
Seg 2 : St = 000C, En = 000D, D = 0, RO = 20, gId# = 2
Seg 3 : St = 0020, En = 0020, D = -29, RO = 0, gId# = N/A
Seg 4 : St = 002F, En = 002F, D = -29, RO = 0, gId# = N/A
Seg 5 : St = 005C, En = 005C, D = -29, RO = 0, gId# = N/A
Seg 6 : St = 007C, En = 007C, D = -29, RO = 0, gId# = N/A
Seg 7 : St = 2028, En = 2029, D = 0, RO = 14, gId# = 4
Seg 8 : St = 21B8, En = 21B8, D = -8589, RO = 0, gId# = N/A
Seg 9 : St = FFFF, En = FFFF, D = 1, RO = 0, gId# = N/A
glyphIdArray[0] = 3 (Offset = 0058)
glyphIdArray[1] = 3 (Offset = 005A)
glyphIdArray[2] = 3 (Offset = 005C)
glyphIdArray[3] = 3 (Offset = 005E)
glyphIdArray[4] = 3 (Offset = 0060)
glyphIdArray[5] = 3 (Offset = 0062)
Which Means:
1. Char 0009 -> Index 3
Char 000A -> Index 3
2. Char 000C -> Index 3
Char 000D -> Index 3
3. Char 0020 -> Index 3
4. Char 002F -> Index 18
5. Char 005C -> Index 63
6. Char 007C -> Index 95
7. Char 2028 -> Index 3
Char 2029 -> Index 3
8. Char 21B8 -> Index 43
- [Devel] cmap in webdings,
Dirck Blaskey <=