NovaSVG 0.11.5
An SVG library
Loading...
Searching...
No Matches
nova::vg Namespace Reference

Classes

class  box
 Represents a 2D axis-aligned bounding box. More...

Functions

int add_font_file (const std::string &path)
 Registers every face in a font file with the font cache that text rendering and measure_text() use.
void set_system_fonts_enabled (bool enabled)
 Whether the fonts installed on the machine are used for text. They are by default.
bool system_fonts_enabled ()
 The setting of set_system_fonts_enabled().

Function Documentation

◆ add_font_file()

int nova::vg::add_font_file ( const std::string & path)

Registers every face in a font file with the font cache that text rendering and measure_text() use.

Each face is filed under the family name, weight range and italic flag the font itself declares, so there is nothing to pass but the path. A variable font is registered with the weight range of its wght axis.

Parameters
pathA font file (a .ttc collection registers all its faces).
Returns
The number of faces registered: 0 if the file is not a font or cannot be read, and -1 in a build that cannot load font files (NOVA_DISABLE_FONT_FACE_CACHE_LOAD).

References NOVA_API.

◆ set_system_fonts_enabled()

void nova::vg::set_system_fonts_enabled ( bool enabled)

Whether the fonts installed on the machine are used for text. They are by default.

Fonts you added yourself (add_font_file(), @font-face) are always used, and so are the fonts built into the library, which draw text for a family nothing else provides. With the installed fonts switched off, a document is laid out and drawn the same on every machine, whatever it has installed.

It may be called at any time, from any thread; it takes effect on the next lookup and can be undone. Switched off before the first text is drawn, the installed fonts are never even read.

Parameters
enabledfalse to leave the installed fonts out.

References NOVA_API.

◆ system_fonts_enabled()

bool nova::vg::system_fonts_enabled ( )

The setting of set_system_fonts_enabled().

References NOVA_API.