opentype.js
opentype.js copied to clipboard
Lets Make a List of ToDos and RoadMap file
Just wanted to ask if it was possible to make a ToDo list , so that new contributors will be able to know where to start, and what to do , like a ROADMAP.
things like ::
- GPOS Table Writing
- GSUB Subtables Writing : 2,5,6,7,8,9
- others ...
Fix test failures?
that goes into implementing remaining tables, currently 17 tables are supported, we need to add the remaining tables ::
Remaining Tables : TrueType Font Tables : 'acnt' , 'ankr' , 'avar' , 'bdat' , 'bhed' , 'bloc' , 'bsln' , 'cvar' , 'cvt ' , 'EBSC' , 'fdsc' , 'feat' , 'fmtx' , 'fond' , 'fpgm' , 'gasp' , 'gcid' , 'gvar' , 'hdmx' , 'just' , 'kerx' , 'lcar' , 'mort' , 'morx' , 'opbd' , 'prep' , 'prop' , 'sbix' , 'trak' , 'vhea' , 'vmtx' , 'xref' , 'Zapf' ,
Important Opentype Tables BASE,CBDT,CBLC,COLR,CPAL,DSIG,EBDT,EBLC,GDEF,HVAR,JSTF,LTSH,MATH,MERG
we need to sort the remaining tables by priority , i mean the tables that need to be supported earlier and implemented immediately .
I'm in no position to define a roadmap, but personally I'd recommend starting with the missing parts of cmap; then fixing shaping (GSUB/GPOS). The latter will need GDEF (easy), various barely-documented script-specific shaping engines (painful) plus the Universal Shaping Engine USE. The fontkit project has ported HarfBuzz to JavaScript, so have a look at the fontkit sources. Once all that is done, OpenType.js will be able to correctly render Unicode text.
Personally, I would recommend looking at variable fonts (gvar, hvar, avar, HVAR), color fonts, AAT tables, etc. only after the basics of text rendering are working without bugs. Just my personal two cents of course; others might have different opinions.
Having a list sorted by priority would be great indeed! Thanks @brawer for your input.
@bawarkamalqader are you interested in something specific?
Adding (and first finding) good fonts with the associated tables to the list would be great as well to make sure everything works well.
About cmap adding the missing parts will probably need some refactoring but not for GSUB. So starting there will be easier. Also I recommend to start on the implementing reading first and then writing, both with tests.
I was able to compose an overview of the current library status, what's been done and what needs to be done. each item has a severity value to indicate the importance of this item. I slightly adjusted Jakob's Nielsen Severity Scale to match the context of this document.
Severity Scale
0 = I don't agree that this is a usability problem at all 1 = Need not be fixed unless extra time is available 2 = Minor usability problem: fixing this should be given low priority 3 = Major usability problem: important to fix, so should be given high priority 4 = Usability catastrophe: imperative to fix this before product can be released
Required Tables
description | status |
---|---|
cmap character to glyph mapping | ✔️ |
head font header | ✔️ |
hhea horizontal header | ✔️ |
hmtx horizontal metrics | ✔️ |
loca index to location | ✔️ |
maxp maximum profile | ✔️ |
name naming | ✔️ |
post PostScript | ✔️ |
Optional Tables
description | status | severity | reference |
---|---|---|---|
cvt control value | missing | 2 | reference |
fpgm font program | missing | 2 | reference |
hdmx horizontal device metrics | missing | 2 | reference |
kern kerning | ✔️ | 4 | |
OS/2 OS/2 | ✔️ | 3 | |
prep control value program | missing | 2 | reference |
VORG Vertical Origin | missing | 2 | reference |
gasp Grid-fitting/Scan-conversion | missing | 2 | reference |
DSIG Digital signature | missing | 1 | reference |
LTSH Linear threshold data | missing | 2 | reference |
MERG Merge | missing | 2 | reference |
meta Metadata | missing | 1 | reference |
STAT Style attributes | missing | 3 | reference |
PCLT PCL 5 data | missing | 0 | reference |
VDMX Vertical device metrics | missing | 1 | reference |
vhea Vertical Metrics header | missing | 2 | reference |
vmtx Vertical Metrics | missing | 2 | reference |
Outlines Tables
description | status |
---|---|
glyf glyph data for TrueType | ✔️ |
CFF Compact Font Format 1.0 | ✔️ |
CFF2 Compact Font Format 2.0 | ✔️ |
Font Variations Tables
description | status | severity | reference |
---|---|---|---|
avar Axis variations | missing | 3 | reference |
cvar CVT variations (TrueType outlines only) | missing | 3 | reference |
fvar Font variations | ✔️ | ||
gvar Glyph variations (TrueType outlines only) | missing | 3 | reference |
HVAR Horizontal metrics variations | missing | 3 | reference |
MVAR Metrics variations | missing | 3 | reference |
STAT Style attributes (required for variable fonts, optional for non-variable fonts) | missing | 3 | reference |
VVAR Vertical metrics variations | missing | 3 | reference |
Advanced Typographic Tables
description | status | severity | reference |
---|---|---|---|
BASE Baseline data | missing | 4 | reference |
GDEF Glyph definition data | missing | 4 | reference |
GPOS Glyph positioning data | partial | 4 | reference |
GSUB Glyph substitution data | partial | 4 | reference |
JSTF Justification data | missing | 3 | reference |
MATH Math layout data | missing | 2 | reference |
GSUB table status
description | status | severity | reference |
---|---|---|---|
1.1 Single Substitution format 1 | missing | 4 | reference |
1.2 Single Substitution format 2 | ✔️ | ||
2.1 Multiple Substitution format 1 | ✔️ | ||
3.1 Alternate Substitution | missing | 4 | reference |
4.1 Ligature Substitution | missing | 4 | reference |
5.1 Context Substitution Format 1 | missing | 4 | reference |
5.1 Context Substitution Format 2 | missing | 4 | reference |
5.1 Context Substitution Format 3 | missing | 4 | reference |
6.1 Chaining Context Substitution Format 1 | missing | 4 | reference |
6.2 Chaining Context Substitution Format 2 | missing | 4 | reference |
6.3 Chaining Context Substitution Format 3 | ✔️ |
GPOS table status
description | status | severity | reference |
---|---|---|---|
1 Single adjustment | ✔️ | ||
2 Pair adjustment | ✔️ | ||
3 Cursive attachment | missing | 4 | reference |
4 MarkToBase attachment | missing | 4 | reference |
5 MarkToLigature attachment | missing | 4 | reference |
6 MarkToMark attachment | missing | 4 | reference |
7 Context positioning | missing | 4 | reference |
8 Chained Context positioning | missing | 4 | reference |
9 Extension positioning | missing | 4 | reference |
Color Fonts & Bitmap Glyphs Tables
description | status | severity | reference |
---|---|---|---|
COLR Color table | missing | 2 | reference |
CPAL Color palette table | missing | 2 | reference |
CBDT Color bitmap data | missing | 2 | reference |
CBLC Color bitmap location data | missing | 2 | reference |
sbix Standard bitmap graphics | missing | 2 | reference |
SVG The SVG (Scalable Vector Graphics) table | missing | 2 | reference |
EBDT Embedded bitmap data | missing | 2 | reference |
EBLC Embedded bitmap location data | missing | 2 | reference |
EBSC Embedded bitmap scaling data | missing | 2 | reference |
-
(!) Hint,
Some tables like GSUB and GPOS requires multiple steps to be completed in a certain order, for example For a certain feature in GSUB table to be fully implemented, the library should support
-
parsing ( reading data from font file )
-
re-structuring data for future lookups
-
the lookup logic that handles data retrieval to be used in rendering, ... etc.
please make sure that you don't repeat yourself as some features has been already implemented and you can use it's existing logic or refactor it if you think you can do better.
-
Tooling
description | status | severity |
---|---|---|
Glyph Inspector Find a glyph by name, unicode or index | missing | 3 |
Glyph Inspector Add sidebearing marks | missing | 2 |
Glyph Inspector Fonts presets to easily inspect multiple languages | missing | 4 |
Font Inspector Add formatting and syntax highlighting to GSUB and cmap table data | missing | 4 |
Technical
-
I recommend using Typescript 3.0
using typescript will ensure that typings are synced with implementation unlike JSDocs. plus all the gains of using JSDocs. and it'll greatly improve code quality. what I propose is removing JSDocs type annotations while keeping description blocks and use typescript annotations instead.
I believe I didn't cover everything, please feel free to update existing items or add more items.
Is there a plan to support Color Fonts?
woff2 decompression would be great (to be on the list).
I'm very new to this world, so forgive me if I'm off-base. But I think I'm experiencing a problem using opentype.js because my font contains some GSUB lookup tables of type 7, extension substitution, which seem to be something like wrappers around lookup tables of other types (in my case, type 4, ligatures, which are otherwise working fine). Is there any plan to support GSUB type 7? Perhaps @bawarkamalqader was referring to this in the first post here, but @solomancode 's table cut off at 6.
Ah, apologies. I was looking at a version of opentype.js that was a couple years old. It looks like extension substitution lookup tables may already be supported now. Thank you.
I added the Release 2.0.0 milestone, so we can re-evaluate the status quo. We should especially
- update the nice overview in https://github.com/opentypejs/opentype.js/issues/374#issuecomment-485134088 and port it over to a more prominent place in either the Discussions or a new Wiki
- have https://rawgit.com/unicode-org/text-rendering-tests/master/reports/OpenType.js.html updated with either a pre-release of 2.0.0 or at least 2.0.0 itself, so we can get a clearer perspective of what's next moving on from there
woff2 decompression would be great (to be on the list).
Woff2 decompression is out of scope for the library, you can use other libraries to do the decompression and then pass the results to opentype.js see https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025
I made a repository where I will store test reports from that tool for different versions and commits from the master branch. The reports are directly available to view on GitHub Pages here: https://connum.github.io/opentypejs-reports/