C
QUL_FONT_CACHE_INDEX_SIZE
Note: This property is relevant only for the Monotype Spark font engine.
Description
The font engine remembers where in its cache it found the glyphs it has used recently, so that using such a glyph again takes it straight from there: a fast lookup. Each remembered glyph takes a slot, and the property sets how many slots there are. A glyph without a slot falls back to the regular lookup, which searches the font engine cache. Each slot costs 4 bytes on a 32-bit target; the default of 512 slots costs 2 kB. The value must be a power of two, up to 65536. Set it to 0 to disable the fast lookup.
The slots are allocated when the font engine starts, with the SparkCache allocation type, whether or not QUL_FONT_CACHE_PREALLOC is set, so they live where the platform puts the font engine cache. Without the cache (QUL_FONT_CACHE_SIZE set to 1) they are not allocated, and if the allocation fails, every glyph takes the regular lookup.
Two glyphs that need the same slot push each other out, and each of them then takes the regular lookup again. Which glyphs share a slot depends on the font engine's internal hashing of the glyph, its size and its font, so measure how the fast lookup behaves with the sizes and text of your application. The performance log calls the fast lookup the font cache index and shows how many lookups it answered, in a line such as:
Monotype font cache index: 812 of 812 lookups hit, 512 slots, dropped 0 times after Spark freed cache entries
If the share of hits stays well below the total on screens that use many different glyphs, such as Chinese, Japanese or Korean text, more slots can help.
The fast lookup saves CPU time on every glyph it answers. Whether that makes frames faster depends on what limits the frame time: if the CPU does, frames get faster; if the frame waits for the hardware to finish blending the glyphs, the saving leaves the CPU more time for other work instead.
Example
set_target_properties(<Executable Target> PROPERTIES
QUL_FONT_ENGINE "Spark"
QUL_FONT_FILES <Monotype Spark Font File>
QUL_FONT_CACHE_SIZE <Size>
QUL_FONT_CACHE_INDEX_SIZE 1024
)See also QUL_FONT_CACHE_SIZE.
Available under certain Qt licenses.
Find out more.