Closed glennw closed 6 years ago
cc @kvark @nical
It turns out that we want to do the subpixel selection based on the local position anyway (otherwise we get 'swimming' of glyphs within a word in some animation cases). Although this code is still in a hot spot, we can handle that by caching text runs between frames and display lists.
Currently, we handle subpixel positioning of glyphs (along the layout axis direction), by selecting which glyph to use on the CPU based on the subpixel offset.
Instead, we should do this:
This has several benefits:
[1] Once a glyph is used, it's likely that somewhere on the page will require each of the subpx variations, so this shouldn't add any overhead in most normal cases. [2] If we arrange the four glyphs in a 2x2 configuration, this will keep the allocation sizes square-ish enough to work well with the texture cache slab allocator.