Skip to content

Commit

Permalink
fix: errors in vmtx where p doesn't exist (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
yisibl authored Oct 13, 2023
1 parent 7e8ae1d commit 94d6955
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib-font.browser.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/opentype/tables/simple/other/vmtx.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SimpleTable } from "../../simple-table.js";
import lazy from "../../../../lazy.js";

/**
* The OpenType `vmtx` table.
Expand All @@ -11,15 +12,15 @@ import { SimpleTable } from "../../simple-table.js";
*/
class vmtx extends SimpleTable {
constructor(dict, dataview, tables) {
super(dict, dataview);
const { p } = super(dict, dataview);
const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics;
const numGlyphs = tables.maxp.numGlyphs;

const metricsStart = p.currentPosition;
lazy(this, `vMetrics`, () => {
p.currentPosition = metricsStart;
return [...new Array(numOfLongVerMetrics)].map(
(_) => new LongVertMetric(p.uint16, p.int16)
(_) => new LongVerMetric(p.uint16, p.int16)
);
});

Expand All @@ -35,7 +36,8 @@ class vmtx extends SimpleTable {
}
}

class LongVertMetric {
class LongVerMetric {
// https://learn.microsoft.com/en-us/typography/opentype/spec/vmtx#vertical-metrics-table-format
constructor(h, b) {
this.advanceHeight = h;
this.topSideBearing = b;
Expand Down

0 comments on commit 94d6955

Please sign in to comment.