Mercurial > projects > mde
annotate mde/resource/font.d @ 45:0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Moved the implementable widgets from mde.gui.widget.Widget to miscWidgets, leaving base widgets in Widget.
Rewrote some of GridLayoutWidget's implementation. Made many operations general to work for either columns or rows. Some optimisations were intended but ended up being removed due to problems.
Allowed layout's to resize from either direction (only with window resizes).
committer: Diggory Hardy <diggory.hardy@gmail.com>
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Thu, 22 May 2008 11:34:09 +0100 |
parents | 07bd1a09e161 |
children | a98ffb64f066 |
rev | line source |
---|---|
44
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
1 /* LICENSE BLOCK |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
2 Part of mde: a Modular D game-oriented Engine |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
3 Copyright © 2007-2008 Diggory Hardy |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
4 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
5 This program is free software: you can redistribute it and/or modify it under the terms |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
6 of the GNU General Public License as published by the Free Software Foundation, either |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
7 version 2 of the License, or (at your option) any later version. |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
8 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
11 See the GNU General Public License for more details. |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
12 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
13 You should have received a copy of the GNU General Public License |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
15 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
16 /// Sets up freetype (in a basic way). |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
17 module mde.resource.font; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
18 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
19 import mde.resource.exception; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
20 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
21 import derelict.freetype.ft; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
22 import derelict.opengl.gl; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
23 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
24 import tango.stdc.stringz; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
25 import tango.util.log.Log : Log, Logger; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
26 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
27 private Logger logger; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
28 static this () { |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
29 logger = Log.getLogger ("mde.resource.font"); |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
30 } |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
31 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
32 /** Font class. |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
33 * |
45
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
34 * Particular to a font and size. (Maybe not size?) |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
35 * |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
36 * Note: it is not currently intended to be thread-safe. */ |
44
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
37 class Font |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
38 { |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
39 //BEGIN Static: manager |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
40 static { |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
41 /** Load the freetype library. */ |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
42 void initialize () { |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
43 if (FT_Init_FreeType (&library)) |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
44 throw new fontException ("error initialising the FreeType library"); |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
45 } |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
46 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
47 //FIXME: don't use GC for Font resources |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
48 /** Cleanup: delete all fonts. */ |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
49 void cleanup () { |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
50 if (font) |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
51 delete font; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
52 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
53 FT_Done_FreeType (library); |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
54 } |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
55 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
56 /** Get a font. |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
57 * |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
58 * Later specify font/size. |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
59 * |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
60 * Throws: |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
61 * fontLoadException when unable to load the font. */ |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
62 Font get(char[] path) { |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
63 if (font is null) font = new Font(path); |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
64 return font; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
65 } |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
66 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
67 private: |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
68 FT_Library library; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
69 Font font; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
70 } |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
71 //END Static |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
72 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
73 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
74 /** Load & cache a new font. */ |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
75 this (char[] path) |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
76 in { |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
77 assert (library !is null, "font: library is null"); |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
78 } body { |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
79 if (FT_New_Face (library, toStringz(path), 0, &face)) |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
80 throw new fontLoadException ("Unable to read font: "~path); |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
81 |
45
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
82 if (FT_Set_Pixel_Sizes (face, 0,16)) |
44
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
83 throw new fontLoadException ("Unable to set pixel size"); |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
84 } |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
85 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
86 void drawStr (int x, int y, char[] str) { |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
87 FT_Vector pen = { x*64, y*64 }; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
88 auto g = face.glyph; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
89 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
90 FT_Matrix m; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
91 m.xx = 0x10000; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
92 m.xy = m.yx = 0; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
93 m.yy = -0x10000; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
94 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
95 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
96 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
97 FT_Pos y_adj = 0; // y adjustment (for height) |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
98 |
45
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
99 FT_Bool useKerning = FT_HAS_KERNING (face); |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
100 FT_UInt previous = 0; |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
101 |
44
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
102 foreach (chr; str) { |
45
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
103 auto gi = FT_Get_Char_Index (face, chr); |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
104 |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
105 if (useKerning && previous && gi) |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
106 { |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
107 FT_Vector delta; |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
108 |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
109 |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
110 FT_Get_Kerning (face, previous, gi, FT_Kerning_Mode.FT_KERNING_DEFAULT, &delta); |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
111 |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
112 pen.x += delta.x; |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
113 } |
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
114 |
44
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
115 FT_Set_Transform(face, &m, &pen); |
45
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
116 if (FT_Load_Glyph(face, gi, FT_LOAD_RENDER)) |
44
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
117 return; // give up |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
118 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
119 if (y_adj < g.metrics.height) y_adj = g.metrics.height; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
120 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
121 auto b = g.bitmap; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
122 if (b.pixel_mode != FT_Pixel_Mode.FT_PIXEL_MODE_GRAY || b.num_grays != 256) { |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
123 char[128] tmp; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
124 logger.warn (logger.format (tmp,"Unsupported freetype bitmap format: {}, {}", b.pixel_mode, b.num_grays)); |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
125 return; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
126 } |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
127 if (b.pitch != b.width) |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
128 logger.info ("b.pitch != b.width"); |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
129 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
130 //NOTE: y direction! |
45
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
131 glRasterPos2i (g.bitmap_left,g.bitmap_top /+ (y_adj >> 6)+/); |
44
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
132 glDrawPixels (b.width, b.rows, GL_LUMINANCE, GL_UNSIGNED_BYTE, cast(void*) b.buffer); |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
133 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
134 pen.x += g.advance.x; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
135 pen.y += g.advance.y; |
45
0fd51d2c6c8a
Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
44
diff
changeset
|
136 previous = gi; |
44
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
137 } |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
138 } |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
139 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
140 ~this () { |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
141 FT_Done_Face (face); |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
142 } |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
143 |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
144 private: |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
145 FT_Face face; |
07bd1a09e161
Started implementing text rendering.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
146 } |