Add 10x12 bold font
This commit is contained in:
parent
d14763792d
commit
ab6da3b212
4 changed files with 114 additions and 7 deletions
|
|
@ -68,5 +68,6 @@ namespace psemek::ui
|
||||||
|
|
||||||
std::unique_ptr<font> make_default_monospace_9x12_font();
|
std::unique_ptr<font> make_default_monospace_9x12_font();
|
||||||
std::unique_ptr<font> make_default_9x12_font();
|
std::unique_ptr<font> make_default_9x12_font();
|
||||||
|
std::unique_ptr<font> make_default_10x12_bold_font();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
97
libs/ui/resources/font_10x12_bold_glyphs.txt
Normal file
97
libs/ui/resources/font_10x12_bold_glyphs.txt
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
# <character-id> <texcoord-start-x> <texcoord-start-y> <size-x> <size-y> <offset-x> <offset-y> <advance>
|
||||||
|
|
||||||
|
32 0 0 1 0 0 0 7 # ' '
|
||||||
|
33 17 3 2 8 0 0 3 # !
|
||||||
|
34 27 3 6 3 0 5 7 # "
|
||||||
|
35 39 3 6 9 0 -1 7 # #
|
||||||
|
36 51 3 5 9 0 -1 6 # $
|
||||||
|
37 63 3 6 8 0 0 7 # %
|
||||||
|
38 75 5 6 6 0 0 7 # &
|
||||||
|
39 89 3 2 4 0 4 3 # '
|
||||||
|
40 101 2 3 10 0 -1 4 # (
|
||||||
|
41 112 2 3 10 0 -1 4 # )
|
||||||
|
42 123 3 6 5 0 3 7 # *
|
||||||
|
43 134 4 8 7 0 0 9 # +
|
||||||
|
44 148 9 4 4 0 -2 5 # ,
|
||||||
|
45 159 7 6 1 0 3 7 # -
|
||||||
|
46 172 9 3 2 0 0 4 # .
|
||||||
|
47 183 3 6 9 0 -1 7 # /
|
||||||
|
48 3 17 6 8 0 0 7 # 0
|
||||||
|
49 15 17 6 8 0 0 7 # 1
|
||||||
|
50 27 17 6 8 0 0 7 # 2
|
||||||
|
51 39 17 6 8 0 0 7 # 3
|
||||||
|
52 51 17 7 8 0 0 8 # 4
|
||||||
|
53 63 17 6 8 0 0 7 # 5
|
||||||
|
54 75 17 6 8 0 0 7 # 6
|
||||||
|
55 87 17 6 8 0 0 7 # 7
|
||||||
|
56 99 17 6 8 0 0 7 # 8
|
||||||
|
57 111 17 6 8 0 0 7 # 9
|
||||||
|
58 124 19 3 6 0 0 4 # :
|
||||||
|
59 136 19 4 7 0 -1 5 # ;
|
||||||
|
60 146 18 7 7 0 0 8 # <
|
||||||
|
61 159 20 6 3 0 2 7 # =
|
||||||
|
62 170 18 7 7 0 0 8 # >
|
||||||
|
63 184 18 5 7 0 0 6 # ?
|
||||||
|
64 3 30 6 10 0 -1 7 # @
|
||||||
|
65 14 31 8 8 0 0 9 # A
|
||||||
|
66 26 31 7 8 0 0 8 # B
|
||||||
|
67 39 31 6 8 0 0 7 # C
|
||||||
|
68 50 31 7 8 0 0 8 # D
|
||||||
|
69 62 31 7 8 0 0 8 # E
|
||||||
|
70 74 31 7 8 0 0 8 # F
|
||||||
|
71 87 31 7 8 0 0 8 # G
|
||||||
|
72 98 31 8 8 0 0 9 # H
|
||||||
|
73 111 31 6 8 0 0 7 # I
|
||||||
|
74 123 31 6 8 0 0 7 # J
|
||||||
|
75 134 31 8 8 0 0 9 # K
|
||||||
|
76 147 31 6 8 0 0 7 # L
|
||||||
|
77 158 31 8 8 0 0 9 # M
|
||||||
|
78 170 31 8 8 0 0 9 # N
|
||||||
|
79 183 31 6 8 0 0 7 # O
|
||||||
|
80 3 45 6 8 0 0 7 # P
|
||||||
|
81 15 45 6 9 0 -1 7 # Q
|
||||||
|
82 26 45 8 8 0 0 9 # R
|
||||||
|
83 39 45 6 8 0 0 7 # S
|
||||||
|
84 50 45 8 8 0 0 9 # T
|
||||||
|
85 62 45 8 8 0 0 9 # U
|
||||||
|
86 74 45 8 8 0 0 9 # V
|
||||||
|
87 85 45 8 8 0 0 9 # W
|
||||||
|
88 98 45 8 8 0 0 9 # X
|
||||||
|
89 110 45 8 8 0 0 9 # Y
|
||||||
|
90 123 45 6 8 0 0 7 # Z
|
||||||
|
91 136 44 4 10 0 -1 5 # [
|
||||||
|
92 147 45 5 9 0 -1 6 # \
|
||||||
|
93 160 44 4 10 0 -1 5 # ]
|
||||||
|
94 171 45 6 4 0 4 7 # ^
|
||||||
|
95 182 54 8 1 0 -2 9 # _
|
||||||
|
96 5 58 3 2 0 7 4 # `
|
||||||
|
97 15 61 7 6 0 0 8 # a
|
||||||
|
98 26 59 7 8 0 0 8 # b
|
||||||
|
99 39 61 6 6 0 0 7 # c
|
||||||
|
100 51 59 7 8 0 0 8 # d
|
||||||
|
101 63 61 6 6 0 0 7 # e
|
||||||
|
102 75 59 6 8 0 0 7 # f
|
||||||
|
103 87 61 7 8 0 -2 8 # g
|
||||||
|
104 98 59 8 8 0 0 9 # h
|
||||||
|
105 111 59 6 8 0 0 7 # i
|
||||||
|
106 123 59 5 10 0 -2 6 # j
|
||||||
|
107 134 59 7 8 0 0 8 # k
|
||||||
|
108 147 59 6 8 0 0 7 # l
|
||||||
|
109 158 61 8 6 0 0 9 # m
|
||||||
|
110 170 61 8 6 0 0 9 # n
|
||||||
|
111 183 61 6 6 0 0 7 # o
|
||||||
|
112 2 75 7 8 0 -2 8 # p
|
||||||
|
113 15 75 7 8 0 -2 8 # q
|
||||||
|
114 27 75 6 6 0 0 7 # r
|
||||||
|
115 39 75 6 6 0 0 7 # s
|
||||||
|
116 50 74 7 7 0 0 8 # t
|
||||||
|
117 62 75 8 6 0 0 9 # u
|
||||||
|
118 73 75 9 6 0 0 10 # v
|
||||||
|
119 85 75 9 6 0 0 10 # w
|
||||||
|
120 99 75 7 6 0 0 8 # x
|
||||||
|
121 110 75 8 8 0 -2 9 # y
|
||||||
|
122 123 75 6 6 0 0 7 # z
|
||||||
|
123 136 72 4 10 0 -1 5 # {
|
||||||
|
124 149 72 2 9 0 0 3 # |
|
||||||
|
125 160 72 4 10 0 -1 5 # }
|
||||||
|
126 171 73 6 2 0 6 7 # ~
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
49 14 17 5 8 0 0 6 # 1
|
49 14 17 5 8 0 0 6 # 1
|
||||||
50 25 17 5 8 0 0 6 # 2
|
50 25 17 5 8 0 0 6 # 2
|
||||||
51 36 17 5 8 0 0 6 # 3
|
51 36 17 5 8 0 0 6 # 3
|
||||||
52 47 17 6 8 0 0 7 # 4
|
52 47 17 5 8 0 0 6 # 4
|
||||||
53 58 17 5 8 0 0 6 # 5
|
53 58 17 5 8 0 0 6 # 5
|
||||||
54 69 17 5 8 0 0 6 # 6
|
54 69 17 5 8 0 0 6 # 6
|
||||||
55 80 17 5 8 0 0 6 # 7
|
55 80 17 5 8 0 0 6 # 7
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include <psemek/gfx/resource/font_9x12_png.hpp>
|
#include <psemek/gfx/resource/font_9x12_png.hpp>
|
||||||
#include <psemek/ui/resources/font_9x12_glyphs_txt.hpp>
|
#include <psemek/ui/resources/font_9x12_glyphs_txt.hpp>
|
||||||
|
#include <psemek/gfx/resource/font_10x12_bold_png.hpp>
|
||||||
|
#include <psemek/ui/resources/font_10x12_bold_glyphs_txt.hpp>
|
||||||
|
|
||||||
#include <psemek/io/memory_stream.hpp>
|
#include <psemek/io/memory_stream.hpp>
|
||||||
|
|
||||||
|
|
@ -44,12 +46,9 @@ namespace psemek::ui
|
||||||
return std::make_unique<monospace_font>(range, name, size, std::move(atlas), std::move(texcoords));
|
return std::make_unique<monospace_font>(range, name, size, std::move(atlas), std::move(texcoords));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<font> make_default_9x12_font()
|
static std::unique_ptr<font> make_default_font(std::string_view name, geom::vector<int, 2> const & size, rs::resource const & atlas_resource, rs::resource const & glyphs_resource)
|
||||||
{
|
{
|
||||||
std::string_view name = "default_9x12";
|
gfx::texture_2d atlas = gfx::texture_2d::from_pixmap(gfx::read_png_monochrome(io::memory_istream{atlas_resource.data}));
|
||||||
geom::vector<int, 2> size{9, 12};
|
|
||||||
|
|
||||||
gfx::texture_2d atlas = gfx::texture_2d::from_pixmap(gfx::read_png_monochrome(io::memory_istream{gfx::resource::font_9x12_png.data}));
|
|
||||||
atlas.nearest_filter();
|
atlas.nearest_filter();
|
||||||
atlas.clamp();
|
atlas.clamp();
|
||||||
gl::TexParameteri(atlas.target, gl::TEXTURE_SWIZZLE_G, gl::RED);
|
gl::TexParameteri(atlas.target, gl::TEXTURE_SWIZZLE_G, gl::RED);
|
||||||
|
|
@ -58,7 +57,7 @@ namespace psemek::ui
|
||||||
|
|
||||||
std::unordered_map<char32_t, kerned_font::glyph_data> glyphs;
|
std::unordered_map<char32_t, kerned_font::glyph_data> glyphs;
|
||||||
{
|
{
|
||||||
std::istringstream is{std::string(ui::resources::font_9x12_glyphs_txt.data)};
|
std::istringstream is{std::string(glyphs_resource.data)};
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
while (std::getline(is, line))
|
while (std::getline(is, line))
|
||||||
|
|
@ -81,4 +80,14 @@ namespace psemek::ui
|
||||||
return std::make_unique<kerned_font>(name, size, 2, std::move(atlas), std::move(glyphs));
|
return std::make_unique<kerned_font>(name, size, 2, std::move(atlas), std::move(glyphs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<font> make_default_9x12_font()
|
||||||
|
{
|
||||||
|
return make_default_font("default_9x12", {9, 12}, gfx::resource::font_9x12_png, ui::resources::font_9x12_glyphs_txt);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<font> make_default_10x12_bold_font()
|
||||||
|
{
|
||||||
|
return make_default_font("default_10x12_bold", {10, 12}, gfx::resource::font_10x12_bold_png, ui::resources::font_10x12_bold_glyphs_txt);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue