Comments (2)
As a slightly more elaborate test, using https://fonts.google.com/noto/specimen/Noto+Sans+New+Tai+Lue:
const fs = require("fs");
const fontkit = require("fontkit");
const font = fs.readFileSync("./NotoSansNewTaiLue-Regular.ttf");
const fontObject = fontkit.create(font);
const glyphs = fontObject.glyphsForString(" ");
console.log(glyphs[0]);
console.log(glyphs[0].advanceWidth);
yields:
<ref *1> $f680320fa07ef53d$export$2e2bcd8739ae039 {
id: 440,
codePoints: [ 32 ],
_font: $0a8ef2660a6ce4b6$export$2e2bcd8739ae039 {
type: 'TTF',
defaultLanguage: null,
stream: $8ae20583b93e4933$export$c18b354bac7948e9 {
buffer: <Buffer 00 01 00 00 00 10 01 00 00 04 00 00 47 44 45 46 09 41 09 81 00 00 01 c8 00 00 00 54 47 50 4f 53 a6 ee 44 e4 00 00 25 00 00 00 1d 04 47 53 55 42 9a 2e ... 47330 more bytes>,
view: [DataView],
pos: 268,
length: 47380
},
variationCoords: null,
_directoryPos: 0,
_tables: { cmap: [Object] },
_glyphs: { '440': [Circular *1] },
directory: {
tag: '\x00\x01\x00\x00',
numTables: 16,
searchRange: 256,
entrySelector: 4,
rangeShift: 0,
tables: [Object]
}
},
isMark: false,
isLigature: false,
type: 'TTF'
}
d:\temp\node_modules\restructure\dist\main.cjs:91
const ret = this.view[key](this.pos, false);
^
RangeError: Offset is outside the bounds of the DataView
at DataView.getInt16 (<anonymous>)
at $8ae20583b93e4933$export$c18b354bac7948e9.<computed> [as readInt16BE] (d:\temp\node_modules\restructure\dist\main.cjs:91:35)
at $af65abf7bf65ac42$export$fffa67e515d04022.decode (d:\temp\node_modules\restructure\dist\main.cjs:268:40)
at $aa8b66bae6abe658$export$eabc71f011df675a._parseFields (d:\temp\node_modules\restructure\dist\main.cjs:732:29)
at $aa8b66bae6abe658$export$eabc71f011df675a.decode (d:\temp\node_modules\restructure\dist\main.cjs:703:14)
at $f680320fa07ef53d$export$2e2bcd8739ae039._getCBox (d:\temp\node_modules\fontkit\dist\main.cjs:10906:54)
at $f680320fa07ef53d$export$2e2bcd8739ae039._getMetrics (d:\temp\node_modules\fontkit\dist\main.cjs:11074:25)
at get advanceWidth (d:\temp\node_modules\fontkit\dist\main.cjs:10764:21)
at descriptor.get (d:\temp\node_modules\fontkit\dist\main.cjs:92:29)
at Object.<anonymous> (d:\temp\test.js:7:23)
Node.js v18.14.1
from fontkit.
Yup, indeed! The exception happens only when you access .advanceWidth
.
from fontkit.
Related Issues (20)
- font.layout crashing on esoteric unicode character
- Implementation question: availableFeatures HOT 1
- Support glyph path fill rule (non-zero winding / even-odd crossing / etc)
- Handle avar table version 2
- Exntend font.layout accept Array of Glyphs and return a GlyphRun? HOT 1
- .getImageForSize(100) returns "null" using "Apple Color Emoji.ttc" HOT 2
- when i use fontkit to genetate the subset of ttf file,but can not open the subset file,shows ‘not a valid font file’ HOT 3
- [Performance] WOFF font format for CJK languages is 5x slower in Chrome and Unresponsive in Firefox HOT 1
- seac-like endchar compatibility syntax not handled HOT 1
- Cannot use Fontkit on CodeSandbox.io HOT 3
- How to extract individual TTF from a font collection (TTC) file?
- Missing initialisation for pts variable for glyphs HOT 1
- Trouble with Kerning / Letter Spacing HOT 1
- fontkit library installing on react js project while importing we have issue
- fonkit 2.0.0 create from ArrayBuffer returns empty `variationAxes` and null parameters HOT 1
- Newest version of restructure doesn't support all string encodings HOT 6
- Empty _table object
- Fontkit.Font to Buffer
- Question: How to lookup name record by nameID
- postscriptname null in some version of fontkit HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fontkit.