IndexTextBLFont
BLFont Class Referencefinal

Font [C++ API].

Member Functions

Construction & Destruction
Overloaded Operators
Common Functionality
Create Functionality
Accessors
Glyphs & Text

Additional Inherited Members

- Public Attributes inherited from BLObjectCore

BLFont::BLFont()noexcept[1/3][¶]

Creates a default initialized font

A default initialized font is not a valid font that could be used for rendering. It can be considered an empty or null font, which has no family, no glyphs, no tables, it's essentially empty.

BLFont::BLFont(
const BLFont& other
)noexcept[2/3][¶]

Copy constructor makes a weak copy of the underlying representation of the other font.

BLFont::BLFont(
BLFont&& other
)noexcept[3/3][¶]

Move constructor moves the underlying representation of the other font into this newly created instance and resets the other font to a default constructed state.

BLFont::~BLFont()noexcept[¶]

Destroys the font.

BLFont::operator bool() constexplicitnoexcept[¶]

Returns whether the font is valid, which means that it was constructed from a valid BLFontFace.

BLResult BLFont::reset()noexcept[¶]

Resets the font to a default constructed state.

Note
This operation always succeeds and returns BL_SUCCESS.

void BLFont::swap(
BLFont& other
)noexcept[¶]

Swaps the underlying representation of this font with the other font.

BLResult BLFont::assign(
const BLFont& other
)noexcept[1/2][¶]

Copy assignment creates a weak copy of the underlying representation of the other font and stores it in this font.

BLResult BLFont::assign(
BLFont&& other
)noexcept[2/2][¶]

Move assignment moves the underlying representation of the other font into this font and then resets the other font to a default constructed state.

bool BLFont::isValid() constnoexcept[¶]

Tests whether the font is a valid instance.

bool BLFont::empty() constnoexcept[¶]

Tests whether the font is empty, which is the same as !isValid().

bool BLFont::equals(
const BLFontCore& other
) constnoexcept[¶]

Tests whether this and other fonts are equal.

BLResult BLFont::createFromFace(
const BLFontFaceCore& face,
float size
)noexcept[1/3][¶]

Creates a new font from the existing font face scaled to the given size.

BLResult BLFont::createFromFace(
const BLFontFaceCore& face,
float size,
const BLFontFeatureSettingsCore& featureSettings
)noexcept[2/3][¶]

Creates a new font from the existing font face scaled to the given size.

This is an overloaded function that takes additional argument `featureSettings.

BLResult BLFont::createFromFace(
const BLFontFaceCore& face,
float size,
const BLFontFeatureSettingsCore& featureSettings,
const BLFontVariationSettingsCore& variationSettings
)noexcept[3/3][¶]

Creates a new font from the existing font face scaled to the given size.

This is an overloaded function that takes additional arguments, which are used to override font featureSettings and font variationSettings.

BLFontFaceType BLFont::faceType() constnoexcept[¶]

Returns the type of the font's associated font face.

BLFontFaceFlags BLFont::faceFlags() constnoexcept[¶]

Returns the flags of the font.

float BLFont::size() constnoexcept[¶]

Returns the size of the font (as float).

BLResult BLFont::setSize(
float size
)noexcept[¶]

Sets the font size to size.

const BLFontFace& BLFont::face() constnoexcept[¶]

Returns the font's associated font face.

Returns the same font face, which was passed to createFromFace().

uint32_t BLFont::weight() constnoexcept[¶]

Returns the weight of the font.

uint32_t BLFont::stretch() constnoexcept[¶]

Returns the stretch of the font.

uint32_t BLFont::style() constnoexcept[¶]

Returns the style of the font.

int BLFont::unitsPerEm() constnoexcept[¶]

Returns the "units per em" (UPEM) of the font's associated font face.

const BLFontMatrix& BLFont::matrix() constnoexcept[¶]

Returns a 2x2 matrix of the font.

The returned BLFontMatrix is used to scale fonts from design units into user units. The matrix usually has a negative m11 member as fonts use a different coordinate system than Blend2D.

const BLFontMetrics& BLFont::metrics() constnoexcept[¶]

Returns the scaled metrics of the font.

The returned metrics is a scale of design metrics that match the font size and its options.

const BLFontDesignMetrics& BLFont::designMetrics() constnoexcept[¶]

Returns the design metrics of the font.

The returned metrics is compatible with the metrics of BLFontFace associated with this font.

const BLFontFeatureSettings& BLFont::featureSettings() constnoexcept[¶]

Returns font feature settings.

BLResult BLFont::setFeatureSettings(
const BLFontFeatureSettingsCore& featureSettings
)noexcept[¶]

Sets font feature settings to featureSettings.

BLResult BLFont::resetFeatureSettings()noexcept[¶]

Resets font feature settings.

const BLFontVariationSettings& BLFont::variationSettings() constnoexcept[¶]

Returns font variation settings.

BLResult BLFont::setVariationSettings(
const BLFontVariationSettingsCore& variationSettings
)noexcept[¶]

Sets font variation settings to variationSettings.

BLResult BLFont::resetVariationSettings()noexcept[¶]

Resets font variation settings.

BLResult BLFont::getGlyphOutlines(
BLGlyphId glyphId,
BLPathCore& out,
BLPathSinkFunc sink = nullptr,
void* userData = nullptr
) constnoexcept[1/2][¶]

Retrieves outlines of a single glyph into the out path.

Optionally, a user can provide a sink function with userData, which will be called periodically by the glyph outline decoder. The sink can be used to immediately process the outline to prevent accumulating a large path in out.

BLResult BLFont::getGlyphOutlines(
BLGlyphId glyphId,
const BLMatrix2D& userTransform,
BLPathCore& out,
BLPathSinkFunc sink = nullptr,
void* userData = nullptr
) constnoexcept[2/2][¶]

Retrieves outlines of a single glyph into the out path transformed by userTransform.

Optionally, a user can provide a sink function with userData, which will be called periodically by the glyph outline decoder. The sink can be used to immediately process the outline to prevent accumulating a large path in out.

BLResult BLFont::getGlyphRunOutlines(
const BLGlyphRun& glyphRun,
BLPathCore& out,
BLPathSinkFunc sink = nullptr,
void* userData = nullptr
) constnoexcept[1/2][¶]

Retrieves outlines of a glyph run into the out path.

Optionally, a user can provide a sink function with userData, which will be called periodically by the glyph outline decoder. The sink can be used to immediately process the outline to prevent accumulating a large path in out.

BLResult BLFont::getGlyphRunOutlines(
const BLGlyphRun& glyphRun,
const BLMatrix2D& userTransform,
BLPathCore& out,
BLPathSinkFunc sink = nullptr,
void* userData = nullptr
) constnoexcept[2/2][¶]

Retrieves outlines of a glyph run into the out path transformed by userTransform.

Optionally, a user can provide a sink function with userData, which will be called periodically by the glyph outline decoder. The sink can be used to immediately process the outline to prevent accumulating a large path in out.