Giter Club home page Giter Club logo

Comments (6)

moyogo avatar moyogo commented on August 20, 2024 2

hb_input does that (for GSUB): https://github.com/googlei18n/nototools/blob/master/nototools/hb_input.py

from fontkit.

devongovett avatar devongovett commented on August 20, 2024 1

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.

devongovett avatar devongovett commented on August 20, 2024 1

See http://github.com/devongovett/apple-color-emoji

from fontkit.

devongovett avatar devongovett commented on August 20, 2024 1

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.

carlossless avatar carlossless commented on August 20, 2024

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.

Pomax avatar Pomax commented on August 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.