le2d
v0.4.3
2D game engine framework
Loading...
Searching...
No Matches
font.hpp
Go to the documentation of this file.
1
#pragma once
2
#include <kvf/ttf.hpp>
3
#include <
le2d/resource/texture.hpp
>
4
#include <
le2d/text_height.hpp
>
5
6
namespace
le
{
8
class
IFontAtlas
:
public
IResource
{
9
public
:
10
using
Glyph
= kvf::ttf::Glyph;
11
using
GlyphLayout
= kvf::ttf::GlyphLayout;
12
13
virtual
auto
build
(gsl::not_null<kvf::ttf::Typeface*> face,
TextHeight
height) ->
bool
= 0;
14
15
[[nodiscard]]
virtual
auto
get_glyphs
() const -> std::span<
Glyph
const> = 0;
16
[[nodiscard]] virtual auto
get_texture
() const ->
ITexture
const& = 0;
17
[[nodiscard]] virtual auto
get_height
() const ->
TextHeight
= 0;
18
19
virtual auto
push_layouts
(std::vector<
GlyphLayout
>& out, std::string_view text,
float
n_line_height = 1.5f,
bool
use_tofu = true) const -> glm::vec2 = 0;
20
};
21
23
class
IFont
: public
IResource
{
24
public
:
25
virtual
auto
load_face
(std::vector<std::byte> font_bytes) ->
bool
= 0;
26
27
[[nodiscard]]
virtual
auto
get_name
() const -> klib::CString = 0;
28
29
[[nodiscard]] virtual auto get_atlas(
TextHeight
height) ->
IFontAtlas
& = 0;
30
};
31
}
// namespace le
le::IFontAtlas
Opaque interface for a Font Atlas.
Definition
font.hpp:8
le::IFontAtlas::get_texture
virtual auto get_texture() const -> ITexture const &=0
le::IFontAtlas::Glyph
kvf::ttf::Glyph Glyph
Definition
font.hpp:10
le::IFontAtlas::get_glyphs
virtual auto get_glyphs() const -> std::span< Glyph const >=0
le::IFontAtlas::build
virtual auto build(gsl::not_null< kvf::ttf::Typeface * > face, TextHeight height) -> bool=0
le::IFontAtlas::push_layouts
virtual auto push_layouts(std::vector< GlyphLayout > &out, std::string_view text, float n_line_height=1.5f, bool use_tofu=true) const -> glm::vec2=0
le::IFontAtlas::get_height
virtual auto get_height() const -> TextHeight=0
le::IFontAtlas::GlyphLayout
kvf::ttf::GlyphLayout GlyphLayout
Definition
font.hpp:11
le::IFont
Opaque interface for a Font.
Definition
font.hpp:23
le::IFont::get_name
virtual auto get_name() const -> klib::CString=0
le::IFont::load_face
virtual auto load_face(std::vector< std::byte > font_bytes) -> bool=0
le::IResource
Interface for all shared resources in the engine.
Definition
resource.hpp:6
le::ITexture
Concrete drawable Texture.
Definition
texture.hpp:31
le
Definition
animation.hpp:8
le::TextHeight
TextHeight
Strongly typed integer for text height.
Definition
text_height.hpp:6
text_height.hpp
texture.hpp
lib
include
le2d
resource
font.hpp
Generated by
1.9.8