mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-17 13:08:32 +00:00
The Glyphs panel asked the face for its characters on every frame, and each call read the whole cmap, sorted it and removed repeated characters. A face now keeps the list the first time it is asked for (FontFace::mapped_chars) and shares it; FontFace::chars returns a copy of it, in the same order. The panel finds a Unicode subset's characters by searching the sorted list, and Entire Font uses the face's shared list of unencoded glyphs instead of copying it each frame. The cells the panel shows do not change. Measured in one release process, old read and shared list alternating, median of 7 samples of 100 calls, wall-clock times from a single run: - Source Sans 3 Regular, 1,614 characters: 0.0101 ms to 0.000004 ms - a test font of 50,000 characters: 0.2347 ms to 0.000004 ms The saving matters for fonts with large character maps, such as CJK fonts.