Closed samchouse closed 2 years ago
I think you are encountering a difference between rusttype and _abglyph APIs. You cannot draw pixels using the glyph position & char byte index.
calculate_glyphs
here is providing you with positioned glyphs. To draw you use the ab_glyph font to outline_glyph
and then OutlinedGlyph::px_bounds
& OutlinedGlyph::draw
.
For drawing glyphs into an image I would look at the ab_glyph image
example
Also see the ab_glyph readme example & docs.
I'm trying to update all the dependencies of https://github.com/codepunkt/wasm-layout-text and now the text isn't drawing. I'm not entirely sure what I'm doing and it seems like a lot of the methods are gone and me replacing with them with what I think is their counterparts hasn't gone well.
First of all, how would I draw the text? I'm also a little confused about bounds, I'm not entirely sure what they are. How would I re-implement them into the updated code, I can't find any similar methods attached to
section_glyph
? Would it be something like this?