PolyMeilex / sctk-adwaita

Adwaita-like SCTK Frame
MIT License
26 stars 19 forks source link

Improvement: Use mmap for ab-glyph titles #17

Closed alexheretic closed 1 year ago

alexheretic commented 1 year ago

When we find a system font for the title text it is currently loaded into memory for use. If the font is a large one this will mean the program will use that much more memory. So it may be preferable to mmap the font instead to lower ram usage.

Currently there is no special support for mmap in _abglyph (though it could be built see https://github.com/alexheretic/owned-ttf-parser/issues/11). But the mmap could be created and the font parsed on each AbGlyphTitleText::render call. This perhaps would work fairly well as I think mmaps will be cached for such usage by the OS and parsing the font bytes each time, while wasteful, should not be too slow (will have to test).