wxMaxima
Loading...
Searching...
No Matches
Public Member Functions
FontRenderabilityCache Class Reference

Caches which characters each font can actually render. More...

#include <FontRenderabilityCache.h>

Public Member Functions

bool FontRendersChar (wxUniChar ch, const wxFont &font)
 True if we are confident that the font renders this char.
 
void ClearValues ()
 Forgets the cached verdicts (the known font names stay as empty entries).
 
void ReadFrom (wxConfigBase *config)
 Reads the persisted verdicts from the configuration storage.
 
void WriteTo (wxConfigBase *config) const
 Persists the verdicts to the configuration storage.
 

Detailed Description

Caches which characters each font can actually render.

wxWidgets doesn't offer such a test, and no perfect one is known: missing glyphs can end up with size 0 (or draw nothing), as identical blank boxes, or as boxes containing the character's codepoint digits - depending on the font and the platform's renderer. What we can do instead: draw the character to a bitmap and see if any pixel changed (catches the draws-nothing case), and compare its rendering against characters that are guaranteed to have no real glyph (if they are identical we most probably got the font's missing-glyph box). The digit-box case is the remaining blind spot: such a box contains the probed character's own codepoint, so there is no reference rendering to compare it against.

The per-platform glyph-coverage APIs wouldn't help, by the way: they answer "does this font contain the glyph", but what the user sees is what appears after the renderer's font fallback, which is what the bitmap probe measures.

Both probes are costly, hence the per-font cache, which is also persisted in the configuration storage between runs.


The documentation for this class was generated from the following files: