Open sidorares opened 8 years ago
I'm not sure how that would work.
You're talking about adding a javascript accessor to FontFace that returns its ftFace
pointer?
yes. I'm currently serializing it to JS as hex string and de-serialising back from string in harfbuzz binding:
https://github.com/sidorares/node-freetype2/blob/face-handle/src/FontFace.cc#L67-L74 https://github.com/sidorares/node-harfbuzz/blob/master/src/addon.cc#L36-L40
That seems a little wonky. How about this?
Yeah, I like your approach more. Can you think of some way of having freetype2 as peer dependency? They going to be used alongside
That seems a little wonky
It does. It kind of worked for me but only partially, hb_shape returns correct list of glyph infos but all glyph positions are garbage. I'll try your way, thanks a lot!
hmm, still the same problem. Maybe FT needs to be initialised in the same dynamic library to work properly? xAdvance is completely irrelevant
node index.js /Library/Fonts/Arial.ttf "test 123"
[ { xOffset: 0,
yOffset: 0,
xAdvance: 2492,
yAdvance: 0,
codepoint: 22,
cluster: 7,
mask: 1 },
{ xOffset: 0,
yOffset: 0,
xAdvance: 2492,
yAdvance: 0,
codepoint: 21,
cluster: 6,
mask: 1 },
{ xOffset: 0,
yOffset: 0,
xAdvance: 2492,
yAdvance: 0,
codepoint: 20,
cluster: 5,
mask: 1 },
{ xOffset: 0,
yOffset: 0,
xAdvance: 1245,
yAdvance: 0,
codepoint: 3,
cluster: 4,
mask: 1 },
{ xOffset: 0,
yOffset: 0,
xAdvance: 1245,
yAdvance: 0,
codepoint: 87,
cluster: 3,
mask: 1 },
{ xOffset: 0,
yOffset: 0,
xAdvance: 2240,
yAdvance: 0,
codepoint: 86,
cluster: 2,
mask: 1 },
{ xOffset: 0,
yOffset: 0,
xAdvance: 2492,
yAdvance: 0,
codepoint: 72,
cluster: 1,
mask: 1 },
{ xOffset: 0,
yOffset: 0,
xAdvance: 1245,
yAdvance: 0,
codepoint: 87,
cluster: 0,
mask: 1 } ]
There is the way I like from architecture point of view, but it's hard to implement ( and not very performant ). Instead of using hb_ft helpers that access all tables in the face directly, provide callbacks to hb module and implement all glyphs-measuring code on top
I'd like to implement harfbuzz node binding. At the same time I need to use FT2 font rendering. Harfbuzz code looks like this:
What do you think re adding raw FT_Face handle accessor?