![]() |
Verovio
Source code documentation
|
This class registers OpenType fonts at runtime and gives access to their glyph metrics, outlines, and anchors, and to shaped text. More...
#include <fontstore.h>
Classes | |
| struct | Counters |
| The amount of work done by the store, for checking that the glyph data is extracted lazily. More... | |
| struct | FaceIdentity |
| The identity of a face, which is the same for identical font data. More... | |
| struct | FontFile |
| A registered font file, kept in the format it was registered with (e.g., WOFF2 is not decompressed) More... | |
| struct | GlyphAnchor |
| A SMuFL anchor of a glyph, in staff spaces. More... | |
| struct | GlyphMetrics |
| The metrics of a glyph, in font units. More... | |
| struct | GlyphPlacement |
| The placement of a glyph in a shaped run, in font units. More... | |
| struct | ShapedRun |
| A shaped text run. More... | |
Public Types | |
| enum class | Kind { Music , Text } |
| enum class | Weight { Normal , Bold } |
| enum class | Style { Normal , Italic } |
Public Member Functions | |
| std::optional< ShapedRun > | ShapeText (const std::string &family, const std::u32string &text, Weight weight=Weight::Normal, Style style=Style::Normal, const std::string &musicFamily="", const std::string &musicFallbackFamily="") const |
| Shape a text with a text family. More... | |
| uint64_t | GetGeneration () const |
| Return a value changed with each registration. | |
| void | PinBundledData () |
| Pin the currently registered bundled faces in the process cache. | |
| Counters | GetCounters () const |
| Return the amount of work done by the store. | |
Constructors, destructors, and other standard methods | |
| FontStore () | |
| ~FontStore () | |
| FontStore (FontStore &&) noexcept | |
| FontStore & | operator= (FontStore &&) noexcept |
| FontStore (const FontStore &)=delete | |
| FontStore & | operator= (const FontStore &)=delete |
Register a font from OTF, TTF, WOFF, or WOFF2 data. | |
Return the canonical family name, or an empty string if the font could not be registered. The alias is an additional family name for the font. | |
| std::string | RegisterTextFont (const unsigned char *data, int length, const std::string &alias="") |
| std::string | RegisterMusicFont (const unsigned char *data, int length, const std::string &smuflMetadataJson, const std::string &alias="") |
Getters for the registered faces | |
| bool | HasFace (Kind kind, const std::string &family, Weight weight=Weight::Normal, Style style=Style::Normal) const |
| std::optional< GlyphMetrics > | GetGlyphMetrics (Kind kind, const std::string &family, char32_t codepoint, Weight weight=Weight::Normal, Style style=Style::Normal) const |
| std::optional< GlyphMetrics > | GetGlyphMetrics (FaceIdentity face, int glyphId) const |
| std::optional< std::string > | GetGlyphOutline (Kind kind, const std::string &family, int glyphId, Weight weight=Weight::Normal, Style style=Style::Normal) const |
| std::optional< std::string > | GetGlyphOutline (FaceIdentity face, int glyphId) const |
| std::vector< GlyphAnchor > | GetMusicGlyphAnchors (const std::string &family, const std::string &glyphName) const |
| std::vector< FontFile > | GetFontFiles (Kind kind, const std::string &family) const |
| Return the files of all faces registered for a family (or alias), without synthesized faces. | |
Static Public Member Functions | |
| static std::vector< unsigned char > | ReadFile (const std::string &filename) |
| Read a font or metadata file, which is empty if it cannot be read or is too large to be registered. | |
This class registers OpenType fonts at runtime and gives access to their glyph metrics, outlines, and anchors, and to shaped text.
Fonts are decoded once and their glyph data is extracted lazily.
| std::optional<ShapedRun> vrv::FontStore::ShapeText | ( | const std::string & | family, |
| const std::u32string & | text, | ||
| Weight | weight = Weight::Normal, |
||
| Style | style = Style::Normal, |
||
| const std::string & | musicFamily = "", |
||
| const std::string & | musicFallbackFamily = "" |
||
| ) | const |
Shape a text with a text family.
Clusters missing in the text family are taken from the music families and from Tinos.