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

In-memory representation of a single @font-face rule. More...

#include "donner/css/FontFace.h"

Public Member Functions

std::pair< double, double > normalizedFontStretchRange () const
 Return ordered, inclusive width percentages. Invalid programmatic ranges (negative or non-finite endpoints) fall back to fontStretch. Zero is canonicalized to positive zero.
std::pair< int, int > normalizedFontWeightRange () const
 Return ordered, inclusive endpoints. Programmatic endpoints are clamped to 1-1000; parsed out-of-range descriptors are rejected before constructing a face.

Static Public Member Functions

static double FontStretchPercentage (int stretch)
 Convert a legacy named width to its CSS percentage: normal (5) becomes 100.0.

Public Attributes

RcString familyName
 font-family descriptor
std::vector< FontFaceSource > sources
 ordered src list
int fontWeight = 400
 First weight endpoint (integer 1-1000, 400=normal, 700=bold).
int fontStyle = 0
 font-style descriptor (0=normal, 1=italic, 2=oblique)
int fontStretch = 5
 font-stretch descriptor (1-9, 5=normal, matching FontStretch enum) Optional second weight endpoint. Absence means the scalar fontWeight value.
std::optional< int > fontWeightMaximum
std::optional< std::pair< double, double > > fontStretchPercentRange
 Optional width endpoints in percent (100 means normal), overriding fontStretch when valid. A single percentage uses equal endpoints; absence preserves the legacy named-width field.

Detailed Description

In-memory representation of a single @font-face rule.

FontFaceIdentityKey covers every effective descriptor and source below. As explained for FontFaceSource, extend the key with any field added here; otherwise two rules differing only in the new field become one and the second is dropped.

Member Function Documentation

◆ FontStretchPercentage()

double donner::css::FontFace::FontStretchPercentage ( int stretch)
static

Convert a legacy named width to its CSS percentage: normal (5) becomes 100.0.

Parameters
stretchNamed-width ordinal, clamped to 1 (ultra-condensed) through 9 (ultra-expanded).
Returns
The corresponding percentage, from 50.0 through 200.0.

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