]> git.sesse.net Git - casparcg/blob - core/producer/text/utils/texture_font.h
[text_producer] Don't upload texture atlas to GPU every time the text or tracking...
[casparcg] / core / producer / text / utils / texture_font.h
1 #pragma once
2
3 #include <string>
4 #include <vector>
5 #include <common/memory.h>
6
7 #include "string_metrics.h"
8 #include "text_info.h"
9 #include "../../../frame/geometry.h"
10
11 namespace caspar { namespace core { namespace text {
12
13 class texture_atlas;
14 enum class unicode_block;
15
16 class texture_font
17 {
18         texture_font();
19         texture_font(const texture_font&);
20         const texture_font& operator=(const texture_font&);
21
22 public:
23         texture_font(texture_atlas&, const text_info&, bool normalize_coordinates);
24         void load_glyphs(unicode_block block, const color<double>& col);
25         void set_tracking(double tracking);
26         std::vector<frame_geometry::coord> create_vertex_stream(const std::wstring& str, int x, int y, int parent_width, int parent_height, string_metrics* metrics, double shear = 0.0);
27         string_metrics measure_string(const std::wstring& str);
28         std::wstring get_name() const;
29         double get_size() const;
30
31 private:
32         struct impl;
33         spl::shared_ptr<impl> impl_;
34 };
35
36 enum class unicode_block
37 {
38         Basic_Latin,
39         Latin_1_Supplement,
40         Latin_Extended_A,
41         Latin_Extended_B,
42         IPA_Extensions,
43         Spacing_Modifier_Letters,
44         Combining_Diacritical_Marks,
45         Greek_and_Coptic,
46         Cyrillic,
47         Cyrillic_Supplement,
48         Armenian,
49         Hebrew,
50         Arabic,
51         Syriac,
52         Arabic_Supplement,
53         Thaana,
54         NKo,
55         Samaritan,
56         Mandaic,
57         Arabic_Extended_A,
58         Devanagari,
59         Bengali,
60         Gurmukhi,
61         Gujarati,
62         Oriya,
63         Tamil,
64         Telugu,
65         Kannada,
66         Malayalam,
67         Sinhala,
68         Thai,
69         Lao,
70         Tibetan,
71         Myanmar,
72         Georgian,
73         Hangul_Jamo,
74         Ethiopic,
75         Ethiopic_Supplement,
76         Cherokee,
77         Unified_Canadian_Aboriginal_Syllabics,
78         Ogham,
79         Runic,
80         Tagalog,
81         Hanunoo,
82         Buhid,
83         Tagbanwa,
84         Khmer,
85         Mongolian,
86         Unified_Canadian_Aboriginal_Syllabics_Extended,
87         Limbu,
88         Tai_Le,
89         New_Tai_Lue,
90         Khmer_Symbols,
91         Buginese,
92         Tai_Tham,
93         Balinese,
94         Sundanese,
95         Batak,
96         Lepcha,
97         Ol_Chiki,
98         Sundanese_Supplement,
99         Vedic_Extensions,
100         Phonetic_Extensions,
101         Phonetic_Extensions_Supplement,
102         Combining_Diacritical_Marks_Supplement,
103         Latin_Extended_Additional,
104         Greek_Extended,
105         General_Punctuation,
106         Superscripts_and_Subscripts,
107         Currency_Symbols,
108         Combining_Diacritical_Marks_for_Symbols,
109         Letterlike_Symbols,
110         Number_Forms,
111         Arrows,
112         Mathematical_Operators,
113         Miscellaneous_Technical,
114         Control_Pictures,
115         Optical_Character_Recognition,
116         Enclosed_Alphanumerics,
117         Box_Drawing,
118         Block_Elements,
119         Geometric_Shapes,
120         Miscellaneous_Symbols,
121         Dingbats,
122         Miscellaneous_Mathematical_Symbols_A,
123         Supplemental_Arrows_A,
124         Braille_Patterns,
125         Supplemental_Arrows_B,
126         Miscellaneous_Mathematical_Symbols_B,
127         Supplemental_Mathematical_Operators,
128         Miscellaneous_Symbols_and_Arrows,
129         Glagolitic,
130         Latin_Extended_C,
131         Coptic,
132         Georgian_Supplement,
133         Tifinagh,
134         Ethiopic_Extended,
135         Cyrillic_Extended_A,
136         Supplemental_Punctuation,
137         CJK_Radicals_Supplement,
138         Kangxi_Radicals,
139         Ideographic_Description_Characters,
140         CJK_Symbols_and_Punctuation,
141         Hiragana,
142         Katakana,
143         Bopomofo,
144         Hangul_Compatibility_Jamo,
145         Kanbun,
146         Bopomofo_Extended,
147         CJK_Strokes,
148         Katakana_Phonetic_Extensions,
149         Enclosed_CJK_Letters_and_Months,
150         CJK_Compatibility,
151         CJK_Unified_Ideographs_Extension_A,
152         Yijing_Hexagram_Symbols,
153         CJK_Unified_Ideographs,
154         Yi_Syllables,
155         Yi_Radicals,
156         Lisu,
157         Vai,
158         Cyrillic_Extended_B,
159         Bamum,
160         Modifier_Tone_Letters,
161         Latin_Extended_D,
162         Syloti_Nagri,
163         Common_Indic_Number_Forms,
164         Phags_pa,
165         Saurashtra,
166         Devanagari_Extended,
167         Kayah_Li,
168         Rejang,
169         Hangul_Jamo_Extended_A,
170         Javanese,
171         Cham,
172         Myanmar_Extended_A,
173         Tai_Viet,
174         Meetei_Mayek_Extensions,
175         Ethiopic_Extended_A,
176         Meetei_Mayek,
177         Hangul_Syllables,
178         Hangul_Jamo_Extended_B,
179         High_Surrogates,
180         High_Private_Use_Surrogates,
181         Low_Surrogates,
182         Private_Use_Area,
183         CJK_Compatibility_Ideographs,
184         Alphabetic_Presentation_Forms,
185         Arabic_Presentation_Forms_A,
186         Variation_Selectors,
187         Vertical_Forms,
188         Combining_Half_Marks,
189         CJK_Compatibility_Forms,
190         Small_Form_Variants,
191         Arabic_Presentation_Forms_B,
192         Halfwidth_and_Fullwidth_Forms,
193         Specials,
194         Linear_B_Syllabary,
195         Linear_B_Ideograms,
196         Aegean_Numbers,
197         Ancient_Greek_Numbers,
198         Ancient_Symbols,
199         Phaistos_Disc,
200         Lycian,
201         Carian,
202         Old_Italic,
203         Gothic,
204         Ugaritic,
205         Old_Persian,
206         Deseret,
207         Shavian,
208         Osmanya,
209         Cypriot_Syllabary,
210         Imperial_Aramaic,
211         Phoenician,
212         Lydian,
213         Meroitic_Hieroglyphs,
214         Meroitic_Cursive,
215         Kharoshthi,
216         Old_South_Arabian,
217         Avestan,
218         Inscriptional_Parthian,
219         Inscriptional_Pahlavi,
220         Old_Turkic,
221         Rumi_Numeral_Symbols,
222         Brahmi,
223         Kaithi,
224         Sora_Sompeng,
225         Chakma,
226         Sharada,
227         Takri,
228         Cuneiform,
229         Cuneiform_Numbers_and_Punctuation,
230         Egyptian_Hieroglyphs,
231         Bamum_Supplement,
232         Miao,
233         Kana_Supplement,
234         Byzantine_Musical_Symbols,
235         Musical_Symbols,
236         Ancient_Greek_Musical_Notation,
237         Tai_Xuan_Jing_Symbols,
238         Counting_Rod_Numerals,
239         Mathematical_Alphanumeric_Symbols,
240         Arabic_Mathematical_Alphabetic_Symbols,
241         Mahjong_Tiles,
242         Domino_Tiles,
243         Playing_Cards,
244         Enclosed_Alphanumeric_Supplement,
245         Enclosed_Ideographic_Supplement,
246         Miscellaneous_Symbols_And_Pictographs,
247         Emoticons,
248         Transport_And_Map_Symbols,
249         Alchemical_Symbols,
250         CJK_Unified_Ideographs_Extension_B,
251         CJK_Unified_Ideographs_Extension_C,
252         CJK_Unified_Ideographs_Extension_D,
253         CJK_Compatibility_Ideographs_Supplement,
254         Tags,
255         Variation_Selectors_Supplement,
256         Supplementary_Private_Use_Area_A,
257         Supplementary_Private_Use_Area_B
258 };
259
260 }}}