Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::Font Class Reference

Loads font data and provides cached bitmap atlases per size. More...

#include <spk_font.hpp>

Collaboration diagram for spk::Font:
Collaboration graph

Classes

class  Bitmap
 Font atlas texture and glyph metadata for a specific size. More...
struct  Size
 Defines glyph and outline sizes for a font bitmap. More...

Public Member Functions

 Font (const std::vector< uint8_t > &p_rawData)
 Builds a font from raw font data.
Bitmapbitmap (const Size &p_fontSize)
 Returns a bitmap atlas for the requested size.

Static Public Member Functions

static Font fromFile (const std::filesystem::path &p_path)
 Loads a font from file.
static Font fromRawData (const std::vector< uint8_t > &p_rawData)
 Loads a font from raw data.

Detailed Description

Loads font data and provides cached bitmap atlases per size.

See also
Font::Bitmap
auto font = spk::Font::fromFile("font.ttf");
auto &bitmap = font.bitmap({16, 0});
static Font fromFile(const std::filesystem::path &p_path)
Loads a font from file.
Definition spk_font.cpp:390
Bitmap & bitmap(const Size &p_fontSize)
Returns a bitmap atlas for the requested size.
Definition spk_font.cpp:400

Constructor & Destructor Documentation

◆ Font()

spk::Font::Font ( const std::vector< uint8_t > & p_rawData)

Builds a font from raw font data.

Parameters
p_rawDataRaw font file bytes.
Here is the caller graph for this function:

Member Function Documentation

◆ bitmap()

Font::Bitmap & spk::Font::bitmap ( const Size & p_fontSize)

Returns a bitmap atlas for the requested size.

Parameters
p_fontSizeSize of glyphs and outline.
Returns
Bitmap atlas reference.

◆ fromFile()

Font spk::Font::fromFile ( const std::filesystem::path & p_path)
static

Loads a font from file.

Parameters
p_pathPath to the font file.
Returns
Loaded Font instance.
Here is the call graph for this function:

◆ fromRawData()

Font spk::Font::fromRawData ( const std::vector< uint8_t > & p_rawData)
static

Loads a font from raw data.

Parameters
p_rawDataRaw font file bytes.
Returns
Loaded Font instance.
Here is the call graph for this function:

The documentation for this class was generated from the following files:
  • includes/structure/graphics/spk_font.hpp
  • srcs/structure/graphics/spk_font.cpp