harfbuzz / harfbuzzjs

Providing HarfBuzz shaping library for client/server side JavaScript projects
https://harfbuzz.github.io/harfbuzzjs/
Other
204 stars 35 forks source link

When to destroy blob and face #14

Closed Harachie closed 4 years ago

Harachie commented 4 years ago

Hi HarfBuzz masters,

thank you very much for this awesome library!

Can you please let me know when it's correct/ok to destroy the blob and face? The code says "/ issue destroy only when you are done with the buffer, not before /" for the create blob method.

I want to cache the font objects for subsequent shaping. Is it valid to destroy the blob and face and only keep the face once the font has been created? The c++ version is fine with it I think. But this comment from above makes me wonder ;).

Thank you for your support and kind regards

ebraminio commented 4 years ago

Oooh, I am very sorry about it, it was fixed with c2b6703 but I forgot to remove the comment. Thank you so much for pointing it out. Let me know anything you face with the work. Thanks!

ebraminio commented 4 years ago

Is it valid to destroy the blob and face and only keep the face once the font has been created?

Yes, since c2b6703, AFAIK and as my tests.

ebraminio commented 4 years ago

I will also try to provide https://github.com/harfbuzz/harfbuzzjs/blob/master/raqm.js/raqm.html#L79-L83 in the hbjs.js as soon as it gets stable in HarfBuzz itself, I believe it will be very useful for the places hbjs is used but feel free to use it just now :) (the API needs this C support)

Harachie commented 4 years ago

Thank you very much for clarification! I am also looking forward for the raqm stuff! It looks super nice and I would love to use the glyph extraction methods as well.

ebraminio commented 4 years ago

Oh, here is a working example, https://harfbuzz.github.io/harfbuzzjs/raqm/raqm.html hbjs_ot_glyph_svg just is going to be named hbjs_glyph_svg if we don't move the whole thing to HarfBuzz itself!

Harachie commented 4 years ago

Thank you! Do I understand it correctly, that raqm will apply the BiDi algorithm and is suitable for mixed unicode text? Would you also tell me your dev environment? My crappy Windows cannot build the FriBiDi library, so I need to do it on another machine ;).

ebraminio commented 4 years ago

Do I understand it correctly, that raqm will apply the BiDi algorithm and is suitable for mixed unicode text?

Correct! It uses fribidi as bidi algorithm, glues things together.

Would you also tell me your dev environment?

I use Linux (Manjaro Linux) but am leaving this comment using a Windows machine which isn't mine somehow :)

cannot build the FriBiDi library, so I need to do it on another machine ;).

It is my fault actually, fribidi source needs some bootstrapping to generate some header files that aren't placed in the repo itself using this command, meson build -Ddocs=false; ninja -Cbuild meaning fribidi/build/gen.tab/ and fribidi/build/lib are fribidi's compile time generated files, they don't need to be built wasm specifically, just bootstrapped once which our https://github.com/harfbuzz/harfbuzzjs/blob/master/fribidi.js/build.sh should be able to do so, I should've added the command on raqm build also.