… | |
… | |
100 | } |
100 | } |
101 | |
101 | |
102 | static void |
102 | static void |
103 | font_render_glyph (Glyph *glyph, PangoFont *font, int glyph_index) |
103 | font_render_glyph (Glyph *glyph, PangoFont *font, int glyph_index) |
104 | { |
104 | { |
|
|
105 | FT_Face face; |
|
|
106 | |
105 | if (glyph_index & PANGO_GLYPH_UNKNOWN_FLAG) |
107 | if (glyph_index & PANGO_GLYPH_UNKNOWN_FLAG) |
106 | { |
108 | { |
107 | PangoFontMetrics *metrics; |
109 | PangoFontMetrics *metrics; |
108 | |
110 | |
109 | if (!font) |
111 | if (!font) |
… | |
… | |
120 | pango_font_metrics_unref (metrics); |
122 | pango_font_metrics_unref (metrics); |
121 | |
123 | |
122 | return; |
124 | return; |
123 | } |
125 | } |
124 | |
126 | |
125 | FT_Face face = pango_opengl_font_get_face (font); |
127 | face = pango_opengl_font_get_face (font); |
126 | |
128 | |
127 | if (face) |
129 | if (face) |
128 | { |
130 | { |
129 | PangoOpenGLFont *glfont = (PangoOpenGLFont *)font; |
131 | PangoOpenGLFont *glfont = (PangoOpenGLFont *)font; |
130 | |
132 | |
… | |
… | |
157 | |
159 | |
158 | static void |
160 | static void |
159 | draw_glyph (PangoRenderer *renderer_, PangoFont *font, PangoGlyph glyph, double x, double y) |
161 | draw_glyph (PangoRenderer *renderer_, PangoFont *font, PangoGlyph glyph, double x, double y) |
160 | { |
162 | { |
161 | PangoOpenGLRenderer *renderer = PANGO_OPENGL_RENDERER (renderer_); |
163 | PangoOpenGLRenderer *renderer = PANGO_OPENGL_RENDERER (renderer_); |
|
|
164 | glyph_info *g; |
|
|
165 | float x1, y1, x2, y2; |
162 | |
166 | |
163 | if (glyph & PANGO_GLYPH_UNKNOWN_FLAG) |
167 | if (glyph & PANGO_GLYPH_UNKNOWN_FLAG) |
164 | { |
168 | { |
165 | glyph = pango_opengl_get_unknown_glyph (font); |
169 | glyph = pango_opengl_get_unknown_glyph (font); |
166 | |
170 | |
167 | if (glyph == PANGO_GLYPH_EMPTY) |
171 | if (glyph == PANGO_GLYPH_EMPTY) |
168 | glyph = PANGO_GLYPH_UNKNOWN_FLAG; |
172 | glyph = PANGO_GLYPH_UNKNOWN_FLAG; |
169 | } |
173 | } |
170 | |
174 | |
171 | glyph_info *g = _pango_opengl_font_get_cache_glyph_data (font, glyph); |
175 | g = _pango_opengl_font_get_cache_glyph_data (font, glyph); |
172 | |
176 | |
173 | if (!g) |
177 | if (!g) |
174 | { |
178 | { |
175 | Glyph bm; |
179 | Glyph bm; |
176 | font_render_glyph (&bm, font, glyph); |
180 | font_render_glyph (&bm, font, glyph); |
… | |
… | |
200 | } |
204 | } |
201 | |
205 | |
202 | x += g->left; |
206 | x += g->left; |
203 | y -= g->top; |
207 | y -= g->top; |
204 | |
208 | |
205 | float x1 = g->tex.x * (1. / TC_WIDTH ); |
209 | x1 = g->tex.x * (1. / TC_WIDTH ); |
206 | float y1 = g->tex.y * (1. / TC_HEIGHT); |
210 | y1 = g->tex.y * (1. / TC_HEIGHT); |
207 | float x2 = g->tex.w * (1. / TC_WIDTH ) + x1; |
211 | x2 = g->tex.w * (1. / TC_WIDTH ) + x1; |
208 | float y2 = g->tex.h * (1. / TC_HEIGHT) + y1; |
212 | y2 = g->tex.h * (1. / TC_HEIGHT) + y1; |
209 | |
213 | |
210 | if (g->tex.name != renderer->curtex) |
214 | if (g->tex.name != renderer->curtex) |
211 | { |
215 | { |
212 | if (renderer->curtex) |
216 | if (renderer->curtex) |
213 | glEnd (); |
217 | glEnd (); |