108 |
/** Get the number of pixels each line should |
/** Get the number of pixels each line should |
109 |
* be below the previous one. |
* be below the previous one. |
110 |
*/ |
*/ |
111 |
virtual int getLineHeight() = 0; |
virtual float getLineHeight() = 0; |
112 |
/** Get the y coordinate where the first line |
/** Get the y coordinate where the first line |
113 |
* should be rendered. |
* should be rendered. |
114 |
*/ |
*/ |
115 |
virtual int getLineOffset() = 0; |
virtual float getLineOffset() = 0; |
116 |
}; |
}; |
117 |
|
|
118 |
/** A freetype font. |
/** A freetype font. |
120 |
class FTFont : public Font { |
class FTFont : public Font { |
121 |
FT_Face face; |
FT_Face face; |
122 |
int pixsize; |
int pixsize; |
123 |
|
float scale; // The scale of all metrics. |
124 |
public: |
public: |
125 |
/** Create from file. |
/** Create from file. |
126 |
* @param pixsize The pixel (texel) size to load the font at |
* @param pixsize The pixel (texel) size to load the font at |
128 |
FTFont(string filename, int pixsize) ; |
FTFont(string filename, int pixsize) ; |
129 |
~FTFont(); |
~FTFont(); |
130 |
virtual Glyph getRaster(int unicode); |
virtual Glyph getRaster(int unicode); |
131 |
virtual int getLineHeight(); |
virtual float getLineHeight(); |
132 |
virtual int getLineOffset(); |
virtual float getLineOffset(); |
133 |
class Error { } ; |
class Error { } ; |
134 |
}; |
}; |
135 |
|
|
153 |
Glyph g = f->getRaster(unicode); |
Glyph g = f->getRaster(unicode); |
154 |
return g.withBorder(bwidth); |
return g.withBorder(bwidth); |
155 |
} |
} |
156 |
virtual int getLineHeight() { |
virtual float getLineHeight() { |
157 |
return f->getLineHeight(); |
return f->getLineHeight(); |
158 |
} |
} |
159 |
virtual int getLineOffset() { |
virtual float getLineOffset() { |
160 |
return f->getLineOffset(); |
return f->getLineOffset(); |
161 |
} |
} |
162 |
|
|