mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-14 15:57:49 +00:00
A document's composite fonts were lent by writing them into the font database's shared map, and a second lend of another definition of the same name was skipped while the first was held. A document drawn in a tiled or floating window while the front document drew, a document placed in one that defines the name differently, and an export made while another document is in front could draw their type in the other document's definition. Registering the front document's fonts during a render could also change the definition mid-render. Lending now applies on the lending thread only: each guard pushes the document's definitions onto a per-thread stack that lookups read before the database's own fonts, latest loan first, and removes them when it drops, also when the thread unwinds. The guard is neither Send nor Sync. Lending no longer changes the database or its generation; while a thread lends definitions other than the database's, FontDb::generation gives a number of its own for them, so kept layouts and render caches made in one document's definitions are not used for another's.