harmonink 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/measure.js +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harmonink",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Tiny font metric normalizer — makes any font render at a consistent, readable x-height",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/measure.js CHANGED
@@ -111,6 +111,7 @@ export function measure(buf, opts = {}) {
111
111
 
112
112
  const head = new Reader(tables.head, 18);
113
113
  const unitsPerEm = head.u16();
114
+ if (!unitsPerEm) throw corrupt('units per em is zero'); // every ratio below divides by it
114
115
  const indexToLocFormat = new Reader(tables.head, 50).i16();
115
116
  const numGlyphs = new Reader(tables.maxp, 4).u16();
116
117
  const numHMetrics = new Reader(tables.hhea, 34).u16();