Euphoria
loadedfont.h
Go to the documentation of this file.
1#pragma once
2
3
4
5#include <map>
6
7#include "core/image.h"
8
9
10namespace eu
11{
12 struct MemoryChunk;
13}
14
15namespace eu::core
16{
17 // This represents a loaded glyph not yet placed on a texture image
19 {
20 //
21 // width_
22 // <--------->
23 // +---------+
24 // bearingX | | | |
25 // -------> | | | bearingY |
26 // origin | | | | height
27 // X.........|.........|....... baseline |
28 // | | |
29 // | | |
30 // +---------+
31 //
32 // ------------------------------> advance (x to next glyph)
33 //
34
35 bool valid = false;
36 int code_point = 0;
37 int bearing_x = 0;
38 int bearing_y = 0;
39 int advance = 0;
41 float size = 0.0f;
42 };
43
44
45 using KerningMap = std::map<std::pair<int, int>, float>;
46
47
48 // represent a loaded font (or a part), but it not yet been converted
49 // into a renderable data and texture.
51 {
52 std::map<int, LoadedGlyph> codepoint_to_glyph;
54 std::map<std::string, int> private_use_aliases;
55 int next_private_use = 0xE000;
56 int line_height = -1;
57
58 int
60
61 void
63 };
64
67 (
69 int font_size,
70 const std::string& chars
71 );
72
75 (
76 const std::string& image_file,
77 const std::string& image_alias,
78 float image_scale,
79 float image_bearing_x,
80 float image_bearing_y,
81 float image_advance
82 );
83
86 (
87 const Image& image,
88 const std::string& image_alias,
89 float image_scale,
90 float image_bearing_x,
91 float image_bearing_y,
92 float image_advance
93 );
94}
95
LoadedFont get_characters_from_font(const MemoryChunk &file_memory, int font_size, const std::string &chars)
std::map< std::pair< int, int >, float > KerningMap
Definition loadedfont.h:45
LoadedFont get_characters_from_single_image(const std::string &image_file, const std::string &image_alias, float image_scale, float image_bearing_x, float image_bearing_y, float image_advance)
Definition assert.h:111
A (inclusive) range between two values.
Definition range.h:19
A simple sRGB(A) image.
Definition image.h:18
int generate_new_index_from_private_use(const std::string &alias)
void combine_with(const LoadedFont &fc)
std::map< int, LoadedGlyph > codepoint_to_glyph
Definition loadedfont.h:52
std::map< std::string, int > private_use_aliases
Definition loadedfont.h:54