cmap.unicode doesn't work for symbol fonts
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
Research direction
Start in lib/ttfunk/table/cmap/subtable.rb at the unicode? method and inspect how encoding_id is filtered. Reproduce with the Webdings.ttf example from the issue; done means cmap.unicode returns the symbol font's Unicode mapping instead of an empty list.
Written by the indexing model from the issue text.
Description
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 # => []
- Dominant language
- Ruby
- Stars
- 144
- Forks
- 100
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from prawnpdf/ttfunk
-
Difficulty 4/5 3-5 days Newbie friendliness 40/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
JWT::EncodedToken raises TypeError for a non-object headerPossibly taken @anakinj claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
jwt/ruby-jwt#780 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
zold-io/zold-ruby-sdk#85 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day