6#ifndef FONT_MANAGER_H_HEADER_GUARD
7#define FONT_MANAGER_H_HEADER_GUARD
10#include <bx/handlealloc.h>
17#define MAX_OPENED_FILES 512
18#define MAX_OPENED_FONT 512
20#define FONT_TYPE_ALPHA UINT32_C(0x00000100)
23#define FONT_TYPE_DISTANCE UINT32_C(0x00000400)
24#define FONT_TYPE_DISTANCE_SUBPIXEL UINT32_C(0x00000500)
25#define FONT_TYPE_DISTANCE_OUTLINE UINT32_C(0x00000600)
26#define FONT_TYPE_DISTANCE_OUTLINE_IMAGE UINT32_C(0x00001600)
27#define FONT_TYPE_DISTANCE_DROP_SHADOW UINT32_C(0x00002700)
28#define FONT_TYPE_DISTANCE_DROP_SHADOW_IMAGE UINT32_C(0x00003800)
29#define FONT_TYPE_DISTANCE_OUTLINE_DROP_SHADOW_IMAGE UINT32_C(0x00003900)
30#define FONT_TYPE_MASK_DISTANCE_IMAGE UINT32_C(0x00001000)
31#define FONT_TYPE_MASK_DISTANCE_DROP_SHADOW UINT32_C(0x00002000)
132BGFX_HANDLE(true_type_handle)
133BGFX_HANDLE(font_handle)
145 auto get_atlas(font_handle
handle)
const ->
Atlas*;
151 auto create_ttf(
const uint8_t* buffer, uint32_t
size) -> true_type_handle;
154 void destroy_ttf(true_type_handle
handle);
157 auto create_font_by_pixel_size(true_type_handle
handle,
158 uint32_t typeface_index,
161 uint16_t glyph_width_padding = 8,
162 uint16_t glyph_height_padding = 8) -> font_handle;
165 auto create_scaled_font_to_pixel_size(font_handle base_font_handle, uint32_t pixel_size) -> font_handle;
168 void destroy_font(font_handle
handle);
174 auto preload_glyph(font_handle
handle,
const wchar_t*
string,
const wchar_t*
end =
nullptr) -> bool;
175 auto preload_glyph(font_handle
handle,
const char*
string,
const char*
end =
nullptr) -> bool;
179 auto preload_glyph_ranges(font_handle
handle,
const code_point* ranges) -> bool;
181 auto add_glyph_bitmap(font_handle
handle,
187 const uint8_t* bitmap_buffer,
188 float glyph_offset_x,
189 float glyph_offset_y) -> bool;
210 uint32_t buffer_size;
215 uint16_t atlas_size_;
217 bx::HandleAllocT<MAX_OPENED_FONT> font_handles_;
220 bx::HandleAllocT<MAX_OPENED_FILES> file_handles_;
221 cached_file* cached_files_;
bool init(init_type init_data)
uint32_t code_point
Unicode value of a character.
void end(encoder *_encoder)
float line_gap
The spacing in pixels between one row's descent and the next row's ascent.
float xline
The extends above the baseline representing of the small letters.
float underline_thickness
The thickness of the under/hover/strike-trough line in pixels.
float underline_position
The position of the underline relatively to the baseline.
float ascender
The pixel extents above the baseline in pixels (typically positive).
float scale
Scale to apply to glyph data.
int16_t font_type
Rendering type used for the font.
float descender
The extents below the baseline in pixels (typically negative).
uint16_t pixel_size
The font height in pixel.
float max_advance_width
This field gives the maximum horizontal cursor advance for all glyphs in the font.
float capline
The extends above the baseline representing of the capital letters.
A structure that describe a glyph.
float bitmap_scale
Amount to scale a bitmap image glyph.
int32_t glyph_index
Index for faster retrieval.
float width
Glyph's width in pixels.
float offset_x
Glyph's left offset in pixels.
uint16_t region_index
Region index in the atlas storing textures.
float height
Glyph's height in pixels.