Donner SVG main
0.8.0 ยท 382bd0190.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::svg::ScopedFontLoadInterruption Class Reference

Lets the calling thread abandon provider font loads that are no longer wanted. More...

#include "donner/svg/resources/FontCatalogTypes.h"

Public Member Functions

 ScopedFontLoadInterruption (std::function< bool()> interrupted)
 Install interrupted as this thread's interruption check.
 ~ScopedFontLoadInterruption ()
 Restore the enclosing scope, if any.
 ScopedFontLoadInterruption (const ScopedFontLoadInterruption &)=delete
ScopedFontLoadInterruption & operator= (const ScopedFontLoadInterruption &)=delete

Static Public Member Functions

static bool Requested ()
 Whether the innermost scope on this thread asks loads to stop.

Detailed Description

Lets the calling thread abandon provider font loads that are no longer wanted.

Background work, such as rendering a font preview, installs one for its duration so that a foreground render can preempt it even while it is inside a long FontFamilyProvider::loadFamilyData call. Install it only around work whose output is discarded once the scope reports an interruption: an interrupted load resolves to a fallback face that is not cached. An inner scope replaces the outer one until it ends.

Constructor & Destructor Documentation

◆ ScopedFontLoadInterruption()

donner::svg::ScopedFontLoadInterruption::ScopedFontLoadInterruption ( std::function< bool()> interrupted)
inlineexplicit

Install interrupted as this thread's interruption check.

Parameters
interruptedReturns true once loads on this thread should stop; called only on this thread, while this scope is the innermost one.

Member Function Documentation

◆ Requested()

bool donner::svg::ScopedFontLoadInterruption::Requested ( )
inlinestatic

Whether the innermost scope on this thread asks loads to stop.

Returns
False with no scope.

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