diff options
Diffstat (limited to 'src/font.hpp')
| -rw-r--r-- | src/font.hpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/font.hpp b/src/font.hpp index 5b3646c..4d0d0a7 100644 --- a/src/font.hpp +++ b/src/font.hpp @@ -6,19 +6,53 @@ #include "pk.h" #include <glm/vec2.hpp> +#include <glm/vec4.hpp> TypeSafeInt_H(FontTypeIndex, uint16_t, 0xFFFF); TypeSafeInt_H(FontRenderIndex, uint16_t, 0xFFFF); +enum FONT_RENDER_SURFACE_AREA_TYPE_FLAGS : uint8_t { + FONT_RENDER_SURFACE_AREA_TYPE_FLAGS_NONE = 0, + FONT_RENDER_SURFACE_AREA_TYPE_FLAGS_GROW_VERTICAL = (1 << 0), + FONT_RENDER_SURFACE_AREA_TYPE_FLAGS_GROW_HORIZONTAL = (1 << 1), + + FONT_RENDER_SURFACE_AREA_TYPE_FLAGS_STATIC = 0, + FONT_RENDER_SURFACE_AREA_TYPE_FLAGS_FLUID = (1 << 0) | (1 << 1), +}; + struct FontGlyphChar { - uint32_t unicode; + double advance; glm::vec2 sprite_region_min; glm::vec2 sprite_region_max; + glm::dvec4 baseline_bounding_box; + uint32_t unicode; + bool is_whitespace; +}; +struct FontRenderSettings { + float char_scale; + float line_height_scale; + float char_spacing_scale; + glm::ivec2 surface_area_size; + FONT_RENDER_SURFACE_AREA_TYPE_FLAGS surface_area_type_flags; }; struct FontRender { uint32_t len; FontTypeIndex index_ft; FontRenderIndex index_fr; + FontRenderSettings settings; +}; +struct FontTypeMSDFSettings { + float minimum_scale; + float px_range; +}; +struct FontTypeSpacing { + double geometryScale; + double em_size; + double ascender_y; + double descender_y; + double line_height; + double underline_y; + double underline_thickness; }; struct FontType : public Entity_Base { pk_cstr title; @@ -31,6 +65,8 @@ struct FontType : public Entity_Base { FontRenderIndex n_render = FontRenderIndex{0}; FontRenderIndex h_render = FontRenderIndex{0}; FontTypeIndex index_ft = FontTypeIndex{0}; + struct FontTypeMSDFSettings msdf_settings; + struct FontTypeSpacing spacing; struct FontTypeGraphics { VkDeviceMemory deviceMemoryVert = VK_NULL_HANDLE; VkDeviceMemory deviceMemoryTexture = VK_NULL_HANDLE; |
