Unravel Engine C++ Reference
Loading...
Searching...
No Matches
gfx::font_manager Class Reference

#include <font_manager.h>

Classes

struct  cached_font
 

Public Member Functions

 font_manager (uint16_t texture_side_width=512)
 linear filtering.
 
 ~font_manager ()
 
auto get_atlas (font_handle handle) const -> Atlas *
 Retrieve the atlas used by the font manager (e.g. to add stuff to it)
 
auto create_ttf (const uint8_t *buffer, uint32_t size) -> true_type_handle
 
void destroy_ttf (true_type_handle handle)
 Unload a TrueType font (free font memory) but keep loaded glyphs.
 
auto create_font_by_pixel_size (true_type_handle handle, uint32_t typeface_index, uint32_t pixel_size, uint32_t font_type=FONT_TYPE_ALPHA, uint16_t glyph_width_padding=8, uint16_t glyph_height_padding=8) -> font_handle
 Return a font whose height is a fixed pixel size.
 
auto create_scaled_font_to_pixel_size (font_handle base_font_handle, uint32_t pixel_size) -> font_handle
 Return a scaled child font whose height is a fixed pixel size.
 
void destroy_font (font_handle handle)
 destroy a font (truetype or baked)
 
auto preload_glyph (font_handle handle, const wchar_t *string, const wchar_t *end=nullptr) -> bool
 
auto preload_glyph (font_handle handle, const char *string, const char *end=nullptr) -> bool
 
auto preload_glyph (font_handle handle, code_point character) -> bool
 Preload a single glyph, return true on success.
 
auto preload_glyph_ranges (font_handle handle, const code_point *ranges) -> bool
 
auto add_glyph_bitmap (font_handle handle, code_point character, uint16_t width, uint16_t height, uint16_t pitch, float extra_scale, const uint8_t *bitmap_buffer, float glyph_offset_x, float glyph_offset_y) -> bool
 
auto get_font_info (font_handle handle) const -> const font_info &
 
auto get_glyph_info (font_handle handle, code_point code_point) -> const glyph_info *
 
auto get_kerning (font_handle handle, code_point prev_code_point, code_point code_point) -> float
 
auto get_white_glyph (font_handle handle) const -> const glyph_info &
 

Detailed Description

Definition at line 135 of file font_manager.h.

Constructor & Destructor Documentation

◆ font_manager()

gfx::font_manager::font_manager ( uint16_t texture_side_width = 512)

linear filtering.

Create the font manager and create the texture cube as BGRA8 with

Definition at line 397 of file font_manager.cpp.

◆ ~font_manager()

gfx::font_manager::~font_manager ( )

Definition at line 409 of file font_manager.cpp.

Member Function Documentation

◆ add_glyph_bitmap()

auto gfx::font_manager::add_glyph_bitmap ( font_handle handle,
code_point character,
uint16_t width,
uint16_t height,
uint16_t pitch,
float extra_scale,
const uint8_t * bitmap_buffer,
float glyph_offset_x,
float glyph_offset_y ) -> bool

Definition at line 734 of file font_manager.cpp.

◆ create_font_by_pixel_size()

auto gfx::font_manager::create_font_by_pixel_size ( true_type_handle handle,
uint32_t typeface_index,
uint32_t pixel_size,
uint32_t font_type = FONT_TYPE_ALPHA,
uint16_t glyph_width_padding = 8,
uint16_t glyph_height_padding = 8 ) -> font_handle

Return a font whose height is a fixed pixel size.

Definition at line 470 of file font_manager.cpp.

◆ create_scaled_font_to_pixel_size()

auto gfx::font_manager::create_scaled_font_to_pixel_size ( font_handle base_font_handle,
uint32_t pixel_size ) -> font_handle

Return a scaled child font whose height is a fixed pixel size.

Definition at line 508 of file font_manager.cpp.

◆ create_ttf()

auto gfx::font_manager::create_ttf ( const uint8_t * buffer,
uint32_t size ) -> true_type_handle

Load a TrueType font from a given buffer. The buffer is copied and thus can be freed or reused after this call.

Returns
invalid handle if the loading fail

Definition at line 449 of file font_manager.cpp.

◆ destroy_font()

void gfx::font_manager::destroy_font ( font_handle handle)

destroy a font (truetype or baked)

Definition at line 541 of file font_manager.cpp.

◆ destroy_ttf()

void gfx::font_manager::destroy_ttf ( true_type_handle handle)

Unload a TrueType font (free font memory) but keep loaded glyphs.

Definition at line 461 of file font_manager.cpp.

◆ get_atlas()

auto gfx::font_manager::get_atlas ( font_handle handle) const -> Atlas*

Retrieve the atlas used by the font manager (e.g. to add stuff to it)

Definition at line 442 of file font_manager.cpp.

◆ get_font_info()

auto gfx::font_manager::get_font_info ( font_handle handle) const -> const font_info&

Return the font descriptor of a font.

Remarks
the handle is required to be valid

Definition at line 788 of file font_manager.cpp.

◆ get_glyph_info()

auto gfx::font_manager::get_glyph_info ( font_handle handle,
code_point code_point ) -> const glyph_info*

Return the rendering information about the glyph region. Load the glyph from a TrueType font if possible

Definition at line 814 of file font_manager.cpp.

◆ get_kerning()

auto gfx::font_manager::get_kerning ( font_handle handle,
code_point prev_code_point,
code_point code_point ) -> float

Definition at line 800 of file font_manager.cpp.

◆ get_white_glyph()

auto gfx::font_manager::get_white_glyph ( font_handle handle) const -> const glyph_info&

Definition at line 794 of file font_manager.cpp.

◆ preload_glyph() [1/3]

auto gfx::font_manager::preload_glyph ( font_handle handle,
code_point character ) -> bool

Preload a single glyph, return true on success.

Definition at line 657 of file font_manager.cpp.

◆ preload_glyph() [2/3]

auto gfx::font_manager::preload_glyph ( font_handle handle,
const char * string,
const char * end = nullptr ) -> bool

Definition at line 594 of file font_manager.cpp.

◆ preload_glyph() [3/3]

auto gfx::font_manager::preload_glyph ( font_handle handle,
const wchar_t * string,
const wchar_t * end = nullptr ) -> bool

Preload a set of glyphs from a TrueType file.

Returns
True if every glyph could be preloaded, false otherwise if the Font is a baked font, this only do validation on the characters.

Definition at line 629 of file font_manager.cpp.

◆ preload_glyph_ranges()

auto gfx::font_manager::preload_glyph_ranges ( font_handle handle,
const code_point * ranges ) -> bool

Definition at line 563 of file font_manager.cpp.


The documentation for this class was generated from the following files: