Pad gpu cache glyphs II
Created by: alexheretic
This pr addresses the texture bleeding issues from other glyphs in the gpu texture. This happens after some sort of transforms causes the texture lookups to be interpolated by the shader, introducing enough error for the alpha values to be potentially affected at the edges. See #28 (closed), https://github.com/alexheretic/gfx-glyph/issues/20.
The problem is tackled by packing all glyphs with a single extra zero-alpha pixel on the bottom & right. This increases glyph texture size by +1 vertical and +1 horizontal pixels on all sides, increases glyph texture usage height/width by +2 pixels. Compared with #36 this change preserves API compatibility and introduces CacheBuilder
to use glyph padding, it also includes "unpadding" logic in rect_for
making padding invisible to rendering.
The change is not breaking. You need to change usage from Cache::new
-> CacheBuilder
to make use of padding.
Benchmark movement is within 1% of control.
closes #36 fixes #28 (closed)