ericfreese/node-freetype2

glyph rendering

Closed this issue · 8 comments

hi,
Do you have plans to add rasterization functions to your library? I need font rasterizer for my X11-based ui toolkit ( https://github.com/sidorares/ntk , https://github.com/sidorares/node-x11 ) to be used together with XRender CreateGlyphSet / AddGlyphs / CompositeGlyphs8/16/32 requests.

Data I need:
input: font file, font size + dpi (maybe optionally list of glyphs to render)
output

  • glyps:
    ( w x h x grayscale pixels )
    advance x,y
    line height
  • kerning pairs

If you don't have plans to add this yourself, would you be interested in PR?

Hey, I'm out of town for the next few days, but am definitely open to talking more about this and taking pull requests. I don't have plans right now to personally add rasterization functions to the library, but the idea for the module is to match the functionality of the freetype library, so I'd say as long as it's possible with the freetype library, we should build support for it here.

I already have basic rendering but it looks like I'm going to add a whole lot of other functionality. Expect PRs :)

Sounds great :)

hey @sidorares i'm also interested in this lately (been doing a lot of bitmap font stuff in JS). I noticed you've been making some progress on your fork; I'd be willing to help out. 👍

@mattdesl great! I'm currently working on freetype+harfbuzz bindings - output would be glyph bitmaps + positioned glyphs for given utf8 string

main reason for having harfbuzz+freetype together - I'd like to handle complex scripts + a lot of fonts don't have kern table so freetype kerning is useless, harfbuzz gives support for gpos-based kerning

Sounds ambitious. What about layout for those languages? Something like Pango?

Just FYI opentype.js has added basic GPOS kerning. 😄

maybe pango later :) given that I already re-implemented xlib+xrender+many others I'm not scared
I'm doing this more to be able learn internals rather than to make production ready library, so I might give a try to make manual layout on top of harfbuzz ( maybe using fribidi ) and after that start using pango