annotate src/texture-font.h @ 14:083c73ceb716

Get rid of the vorbis related code.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 05 Aug 2013 16:54:46 +0300
parents 785057719d9b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /* ============================================================================
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * Freetype GL - A C OpenGL Freetype engine
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 * Platform: Any
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 * WWW: http://code.google.com/p/freetype-gl/
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 * ----------------------------------------------------------------------------
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 * Copyright 2011,2012 Nicolas P. Rougier. All rights reserved.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 * Redistribution and use in source and binary forms, with or without
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 * modification, are permitted provided that the following conditions are met:
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 * 1. Redistributions of source code must retain the above copyright notice,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 * this list of conditions and the following disclaimer.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 * 2. Redistributions in binary form must reproduce the above copyright
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 * notice, this list of conditions and the following disclaimer in the
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 * documentation and/or other materials provided with the distribution.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 * THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER ''AS IS'' AND ANY EXPRESS OR
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 * EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 * The views and conclusions contained in the software and documentation are
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 * those of the authors and should not be interpreted as representing official
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 * policies, either expressed or implied, of Nicolas P. Rougier.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 * ============================================================================
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 #ifndef __TEXTURE_FONT_H__
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 #define __TEXTURE_FONT_H__
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 #include <stdlib.h>
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 #ifdef __cplusplus
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 extern "C" {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 #endif
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 #include "vector.h"
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 #include "texture-atlas.h"
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 * @file texture-font.h
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 * @author Nicolas Rougier (Nicolas.Rougier@inria.fr)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 * @defgroup texture-font Texture font
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 * Texture font.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 * Example Usage:
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 * @code
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 * #include "texture-font.h"
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 * int main( int arrgc, char *argv[] )
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 * {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 * return 0;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 * }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 * @endcode
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 * @{
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 * A structure that hold a kerning value relatively to a charcode.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 * This structure cannot be used alone since the (necessary) right charcode is
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 * implicitely held by the owner of this structure.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 typedef struct
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 * Left character code in the kern pair.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 wchar_t charcode;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 * Kerning value (in fractional pixels).
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 float kerning;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 } kerning_t;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 /*
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93 * Glyph metrics:
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 * --------------
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 * xmin xmax
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 * | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 * |<-------- width -------->|
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 * | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 * | +-------------------------+----------------- ymax
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 * | | ggggggggg ggggg | ^ ^
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 * | | g:::::::::ggg::::g | | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103 * | | g:::::::::::::::::g | | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 * | | g::::::ggggg::::::gg | | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 * | | g:::::g g:::::g | | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 * offset_x -|-------->| g:::::g g:::::g | offset_y |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 * | | g:::::g g:::::g | | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 * | | g::::::g g:::::g | | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109 * | | g:::::::ggggg:::::g | | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110 * | | g::::::::::::::::g | | height
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 * | | gg::::::::::::::g | | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 * baseline ---*---------|---- gggggggg::::::g-----*-------- |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113 * / | | g:::::g | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114 * origin | | gggggg g:::::g | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 * | | g:::::gg gg:::::g | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 * | | g::::::ggg:::::::g | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 * | | gg:::::::::::::g | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 * | | ggg::::::ggg | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 * | | gggggg | v
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120 * | +-------------------------+----------------- ymin
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 * | |
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 * |------------- advance_x ---------->|
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 * A structure that describe a glyph.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 typedef struct
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131 * Wide character this glyph represents
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 wchar_t charcode;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 * Glyph id (used for display lists)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 unsigned int id;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 * Glyph's width in pixels.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 size_t width;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 * Glyph's height in pixels.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 size_t height;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 * Glyph's left bearing expressed in integer pixels.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153 int offset_x;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 * Glyphs's top bearing expressed in integer pixels.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 * Remember that this is the distance from the baseline to the top-most
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159 * glyph scanline, upwards y coordinates being positive.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 int offset_y;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 * For horizontal text layouts, this is the horizontal distance (in
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 * fractional pixels) used to increment the pen position when the glyph is
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 * drawn as part of a string of text.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168 float advance_x;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171 * For vertical text layouts, this is the vertical distance (in fractional
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172 * pixels) used to increment the pen position when the glyph is drawn as
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 * part of a string of text.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 float advance_y;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178 * First normalized texture coordinate (x) of top-left corner
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 float s0;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 * Second normalized texture coordinate (y) of top-left corner
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185 float t0;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188 * First normalized texture coordinate (x) of bottom-right corner
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 float s1;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193 * Second normalized texture coordinate (y) of bottom-right corner
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195 float t1;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
196
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198 * A vector of kerning pairs relative to this glyph.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200 vector_t * kerning;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203 * Glyph outline type (0 = None, 1 = line, 2 = inner, 3 = outer)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205 int outline_type;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 * Glyph outline thickness
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210 float outline_thickness;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
212 } texture_glyph_t;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
216 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
217 * Texture font structure.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 typedef struct
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220 {
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
221 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
222 * Vector of glyphs contained in this font.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
223 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
224 vector_t * glyphs;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227 * Atlas structure to store glyphs data.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229 texture_atlas_t * atlas;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
231 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232 * Font filename
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234 char * filename;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
235
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
237 * Font size
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
238 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239 float size;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242 * Whether to use autohint when rendering font
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
244 int hinting;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
246 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
247 * Outline type (0 = None, 1 = line, 2 = inner, 3 = outer)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249 int outline_type;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
252 * Outline thickness
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 float outline_thickness;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257 * Whether to use our own lcd filter.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259 int filtering;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
260
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262 * Whether to use kerning if available
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 int kerning;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
266 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267 * LCD filter weights
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 unsigned char lcd_weights[5];
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272 * This field is simply used to compute a default line spacing (i.e., the
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273 * baseline-to-baseline distance) when writing text with this font. Note
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
274 * that it usually is larger than the sum of the ascender and descender
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
275 * taken as absolute values. There is also no guarantee that no glyphs
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
276 * extend above or below subsequent baselines when using this distance.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278 float height;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
279
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
280 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281 * This field is the distance that must be placed between two lines of
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282 * text. The baseline-to-baseline distance should be computed as:
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283 * ascender - descender + linegap
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285 float linegap;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
286
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
288 * The ascender is the vertical distance from the horizontal baseline to
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
289 * the highest 'character' coordinate in a font face. Unfortunately, font
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
290 * formats define the ascender differently. For some, it represents the
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
291 * ascent of all capital latin characters (without accents), for others it
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
292 * is the ascent of the highest accented character, and finally, other
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
293 * formats define it as being equal to bbox.yMax.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295 float ascender;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
296
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
297 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
298 * The descender is the vertical distance from the horizontal baseline to
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
299 * the lowest 'character' coordinate in a font face. Unfortunately, font
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
300 * formats define the descender differently. For some, it represents the
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
301 * descent of all capital latin characters (without accents), for others it
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
302 * is the ascent of the lowest accented character, and finally, other
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303 * formats define it as being equal to bbox.yMin. This field is negative
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304 * for values below the baseline.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306 float descender;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
307
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
309 * The position of the underline line for this face. It is the center of
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
310 * the underlining stem. Only relevant for scalable formats.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
311 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312 float underline_position;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
313
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
314 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
315 * The thickness of the underline for this face. Only relevant for scalable
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
316 * formats.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
317 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
318 float underline_thickness;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
319
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
320 } texture_font_t;
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
321
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
322
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
323
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
324 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
325 * This function creates a new texture font from given filename and size. The
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
326 * texture atlas is used to store glyph on demand. Note the depth of the atlas
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
327 * will determine if the font is rendered as alpha channel only (depth = 1) or
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
328 * RGB (depth = 3) that correspond to subpixel rendering (if available on your
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
329 * freetype implementation).
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
330 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
331 * @param atlas A texture atlas
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
332 * @param filename A font filename
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
333 * @param size Size of font to be created (in points)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
334 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
335 * @return A new empty font (no glyph inside yet)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
336 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
337 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
338 texture_font_t *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
339 texture_font_new( texture_atlas_t * atlas,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
340 const char * filename,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
341 const float size );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
342
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
343
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
344 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
345 * Delete a texture font. Note that this does not delete the glyph from the
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
346 * texture atlas.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
347 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
348 * @param self a valid texture font
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
349 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
350 void
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
351 texture_font_delete( texture_font_t * self );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
352
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
353
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
354 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
355 * Request a new glyph from the font. If it has not been created yet, it will
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
356 * be.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
357 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
358 * @param self A valid texture font
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
359 * @param charcode Character codepoint to be loaded.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
360 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
361 * @return A pointer on the new glyph or 0 if the texture atlas is not big
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
362 * enough
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
363 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
364 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365 texture_glyph_t *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
366 texture_font_get_glyph( texture_font_t * self,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
367 wchar_t charcode );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
368
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
369
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
370 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
371 * Request the loading of several glyphs at once.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
372 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
373 * @param self a valid texture font
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
374 * @param charcodes character codepoints to be loaded.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
375 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
376 * @return Number of missed glyph if the texture is not big enough to hold
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
377 * every glyphs.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
378 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
379 size_t
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
380 texture_font_load_glyphs( texture_font_t * self,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
381 const wchar_t * charcodes );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
382
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
383 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
384 * Get the kerning between two horizontal glyphs.
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
385 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
386 * @param self a valid texture glyph
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
387 * @param charcode codepoint of the peceding glyph
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
388 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
389 * @return x kerning value
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
390 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
391 float
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
392 texture_glyph_get_kerning( const texture_glyph_t * self,
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
393 const wchar_t charcode );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
394
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
395
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
396 /**
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
397 * Creates a new empty glyph
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
398 *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
399 * @return a new empty glyph (not valid)
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
400 */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
401 texture_glyph_t *
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
402 texture_glyph_new( void );
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
403
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
404 /** @} */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
405
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
406
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
407 #ifdef __cplusplus
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
408 }
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
409 #endif
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
410
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
411 #endif /* __TEXTURE_FONT_H__ */
785057719d9b Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
412