Skip to content

Glyph lifetimes for Font::glyphs_for & Font::layout

Vitaliy requested to merge kuviman/rusttype:layout-lifetimes into master

Currently using Cache<'static> with Font<'static> is only really possible without using Font::glyphs_for or Font::layout, only with Font::glyph.

This is because &'a Font::<'font>::glyph() creates a glyph that only references 'font, but these two methods currently produce glyphs which reference 'a.

This merge request fixes this issue. I have made a slight change in gpu_cache::test::cache_test (only changed lifetime on Cache from '_ to 'static) to demonstrate this. The test was not working before, but is working now.

Also fixed the error in documentation on the layout method - current code did not change the state of the scanning iterator.

Merge request reports