Comments (6)
hb_input does that (for GSUB): https://github.com/googlei18n/nototools/blob/master/nototools/hb_input.py
from fontkit.
This is a very hard problem. It would essentially involve doing glyph substitution in reverse, from glyphs to characters instead of characters to glyphs. GSUB coverage tables may make this possible for opentype, but it would certainly not be easy especially when you consider the chaining substitution tables that are available. AAT uses state tables, so it would also be difficult if not impossible to go backward from matching states to the character sequences that might produce them. There may be an infinite number of combinations of characters that yield a single glyph.
from fontkit.
See http://github.com/devongovett/apple-color-emoji
from fontkit.
Played around with this a bit this weekend. See #60. It works for AAT-based fonts like Apple Color Emoji for now. You can try it out on that branch like this (I'll add a public API at some point). It returns an array of possible strings that would produce the given glyph.
font._layoutEngine.getStringsForGlyph(1039);
// => ['\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}']
font._layoutEngine.getStringsForGlyph(730);
// => ['\u{1F3C3}', '\u{1F3C3}\u200D\u2642', '\u{1F3C3}\u200D\u2642\uFE0F']
Will probably update my apple-color-emoji
package to use this at some point. Much easier to maintain.
from fontkit.
Thank you for this illuminating answer. Main reason why I wanted this feature was to extract all SBIX glyph PNGs and assign them their appropriate unicode name. I guess there should be other better ways of parsing the font in order to get those resources.
from fontkit.
You could mine the CMAP table data for that particular use case, since Unicode characters are unrelated to the visual changes that GSUB can effect. Find the coverage ranges, and run through the supported glyphs, resolving their glyph outline(s) one entry at a time?
from fontkit.
Related Issues (20)
- .getImageForSize(100) returns "null" using "Apple Color Emoji.ttc" HOT 2
- when i use fontkit to genetate the subset of ttf file,but can not open the subset file,shows โnot a valid font fileโ HOT 3
- [Performance] WOFF font format for CJK languages is 5x slower in Chrome and Unresponsive in Firefox HOT 1
- seac-like endchar compatibility syntax not handled HOT 1
- Cannot use Fontkit on CodeSandbox.io HOT 3
- How to extract individual TTF from a font collection (TTC) file?
- Missing initialisation for pts variable for glyphs HOT 1
- Trouble with Kerning / Letter Spacing HOT 1
- fontkit library installing on react js project while importing we have issue
- fonkit 2.0.0 create from ArrayBuffer returns empty `variationAxes` and null parameters HOT 1
- Newest version of restructure doesn't support all string encodings HOT 6
- Empty _table object
- Fontkit.Font to Buffer
- Question: How to lookup name record by nameID
- postscriptname null in some version of fontkit HOT 2
- OS/2 vs hhea font metrics for ascender/descender
- Due to a bug in vhea.js, the advanceHeight is not taken correctly.
- Problem with TTFGlyph caching for Arabic Presentation Forms
- Vulnerability - Malware in legacy-swc-helpers HOT 6
- Latest npm version (2.0.3) throws an error TypeError: (0 , $parcel$interopDefault(...)) is not a function HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fontkit.