Skip to content

cmap.unicode doesn't work for symbol fonts #7

@graza

Description

@graza

When getting the Unicode character map from the cmap table list, TTFunk only allows a value of 1 for "encoding_id" (which seems to equate to language code although I'm not sure).

According to Apple's spec for the cmap table the language code in Format 4 can be 0 for language independent fonts. This seems to be the case for Microsoft's symbol fonts (Webdings and Wingdings*).

So I think the unicode? method of subtable should allow encoding_id of 1 or 0. Currently symbol fonts' unicode character mapping can't be used. This is preventing me from outputting symbols to PDFs generated by Prawn, even though there's a Unicode mapping to the glyphs.

require 'ttfunk'
cmap = TTFunk::File.open("Webdings.ttf").cmap

cmap.tables[1].platform_id # => 3
cmap.tables[1].encoding_id # => 0
cmap.tables[1].format $ => 4
cmap.unicode # => []

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions