harfbuzz / harfbuzzjs

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

Documentation for demo example #22

Closed dakom closed 4 years ago

dakom commented 4 years ago

The demo example seems to be generating a SVG, not just sequencing together glyph images.

Is there some documentation explaining the thought process behind this, and how one might integrate this into their own project?

Thanks!

ebraminio commented 4 years ago

You noticed the demo is improved :) so easy, just call glyphToPath from a font object https://github.com/harfbuzz/harfbuzzjs/blob/6525bfb/hbjs.js#L43 note that it uses an experimental API of harfbuzz itself yet no need to worry for that here as we are able to keep the support here.

ebraminio commented 4 years ago

https://github.com/harfbuzz/harfbuzzjs/blob/master/examples/hbjs.example.js both shapes and returns glyphs used on the sequence

khaledhosny commented 4 years ago

not just sequencing together glyph images.

You need something to rasterize the glyphs, HarfBuzz does not have one and there is no web API that takes glyph IDs as input, so converting to SVG is a way to use the browser’s SVG renderer to rasterize the glyphs.

ebraminio commented 4 years ago

so guess things can be considered resolved here specially as documentation @simoncozens has put on README.md, thanks!