scimesh 0.3.4
Headless CPU-only 3D software renderer for scientific mesh visualization
Loading...
Searching...
No Matches
scimesh::Font::Impl Struct Reference

Shared font state: the font bytes, the parsed font and the glyph cache. More...

Collaboration diagram for scimesh::Font::Impl:

Public Member Functions

 Impl (std::shared_ptr< const std::vector< uint8_t > > bytes, float size, std::string path)
 

Public Attributes

std::shared_ptr< const std::vector< uint8_t > > data
 Raw font file bytes.
 
std::string source_path
 Origin of the font, if any.
 
stbtt_fontinfo info {}
 Parsed font tables.
 
float pixel_size = 0.0f
 Em size in pixels.
 
float scale = 0.0f
 Font units to pixel scale.
 
FontMetrics metrics
 Vertical metrics in pixels.
 
std::mutex mutex
 Guards cache; makes a Font safe to share between threads.
 
std::map< uint32_t, GlyphBitmap > cache
 Rasterized glyphs, filled on demand.
 

Detailed Description

Shared font state: the font bytes, the parsed font and the glyph cache.

Held by std::shared_ptr so that copying a Font is cheap and all copies share the rasterized glyphs. The raw bytes are kept alive because stbtt_fontinfo stores pointers into them.

Definition at line 125 of file font.cpp.

Constructor & Destructor Documentation

◆ Impl()

scimesh::Font::Impl::Impl ( std::shared_ptr< const std::vector< uint8_t > >  bytes,
float  size,
std::string  path 
)
inline

Definition at line 126 of file font.cpp.

Member Data Documentation

◆ cache

std::map<uint32_t, GlyphBitmap> scimesh::Font::Impl::cache
mutable

Rasterized glyphs, filled on demand.

A std::map is used because inserting into it never invalidates pointers to existing elements (glyph() hands those out).

Definition at line 163 of file font.cpp.

◆ data

std::shared_ptr<const std::vector<uint8_t> > scimesh::Font::Impl::data

Raw font file bytes.

Definition at line 150 of file font.cpp.

◆ info

stbtt_fontinfo scimesh::Font::Impl::info {}

Parsed font tables.

Definition at line 152 of file font.cpp.

◆ metrics

FontMetrics scimesh::Font::Impl::metrics

Vertical metrics in pixels.

Definition at line 155 of file font.cpp.

◆ mutex

std::mutex scimesh::Font::Impl::mutex
mutable

Guards cache; makes a Font safe to share between threads.

Definition at line 158 of file font.cpp.

◆ pixel_size

float scimesh::Font::Impl::pixel_size = 0.0f

Em size in pixels.

Definition at line 153 of file font.cpp.

◆ scale

float scimesh::Font::Impl::scale = 0.0f

Font units to pixel scale.

Definition at line 154 of file font.cpp.

◆ source_path

std::string scimesh::Font::Impl::source_path

Origin of the font, if any.

Definition at line 151 of file font.cpp.


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