Skip to content

Commit

Permalink
Make KERN table optional
Browse files Browse the repository at this point in the history
  • Loading branch information
robmeek committed May 29, 2024
1 parent ba8c5eb commit 53eb5a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/fonthx/opentype/BuildOptions.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class BuildOptions {

public var useFixedCoordinatesInCFF:Bool = false;
public var useSubroutinesInCFF:Bool = false;
public var includeDeprecatedKERNTable:Bool = false;
public var includeSVG:Bool = false; // todo general color config
public var includeCOLR:Bool = false;
public var sortGlyphs:Bool = true;
Expand Down
12 changes: 7 additions & 5 deletions src/fonthx/opentype/OpenTypeBuilder.hx
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ class OpenTypeBuilder {
ttf.addTable(createHorizontalMetricsTable(font));

if (font.hasKerning()) {
var numPairs = font.getKerningPairs().length;
if (numPairs > 10919) { // (((256 * 256) - 18) / 6);
trace('Too many kerning pairs ${numPairs}. KERN table will overflow. No KERN table will be written');
} else {
ttf.addTable(createKerningTable(font));
if (options.includeDeprecatedKERNTable) {
var numPairs = font.getKerningPairs().length;
if (numPairs > 10919) { // (((256 * 256) - 18) / 6);
trace('Too many kerning pairs ${numPairs}. KERN table will overflow. No KERN table will be written');
} else {
ttf.addTable(createKerningTable(font));
}
}
ttf.addTable(createGPOSTable(font));
}
Expand Down

0 comments on commit 53eb5a6

Please sign in to comment.