servo / font-kit

A cross-platform font loading library written in Rust
Apache License 2.0
660 stars 98 forks source link

Reset char size even if bitmap buffer is null #243

Closed indefini closed 2 months ago

indefini commented 2 months ago

I was getting incorrect bounds for glyphs after rasterizing the space(' ') glyph.

In rasterize_glyph(), there is an early return if the bitmap buffer is null (as it is a space) and because of that the char size is not reset correctly. Then if you call raster_bounds for another glyph it loads it with the rasterize char size.

So I just removed the early return and add an else block, so the reset is called at the end.