mapbox / mapbox/node-fontnik

Extract kerning and shaping tables from fonts?

Open
#85 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement jira-sync-complete
Dominant language
C++
Stars
248
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**tl;dr** Can we use ICU or HarfBuzz to extract shaping and kerning tables from a font?

From discussion with @nickidlugash on adding kerning support:

> FreeType only supports kerning via the (rather simple) ‘kern’ table. For the interpretation of kerning data in the (highly sophisticated) ‘GPOS’ table you need a higher-level library like ICU or HarfBuzz since it can be context dependent (this is, the kerning may vary depending on the position within a text string, for example).
> http://freetype.org/freetype2/docs/glyphs/glyphs-4.html
- FreeType has [limited support](http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_FACE_FLAG_KERNING) for reading kerning tables and running [`FT_Get_Kerning`](http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Get_Kerning) for all possible glyph pairs seems like a terrible idea.
- We'll need to integrate HarfBuzz (and a JavaScript equivalent?) into our rendering engines at some point for [complex text shaping](https://github.com/mapbox/mapbox-gl-js/issues/471), could we handle kerning at this point too?
- Is it possible to use ICU or HarfBuzz to extract shaping and kerning tables from a font at upload time to be stashed on S3 and used later for rendering, rather than having to load the full font file into HarfBuzz/ICU?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by investigating the rendering engines and the proposed upload-time workflow described in the issue, including ICU or HarfBuzz, FreeType, and storing extracted data on S3; done means a decided approach for shaping and kerning data extraction.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.