* add a (border #t) flag to fonts, that allows to use fonts which have
a 1px transparent border around glyphs, which is needed to get rid
of blending artifacts in OpenGL
-
-* Change Font code to use glyph.offset, instead of Rect() for variable
- width fonts, as using Rect leads to shadows being cut off
\f
Scenegraph and Physics Engine Restructuring
===========================================
Glyph glyph;
glyph.surface_idx = surface_idx;
- if( glyph_width == FIXED ) {
+ if( glyph_width == FIXED )
+ {
glyph.rect = Rectf(x, y, x + char_width, y + char_height);
glyph.offset = Vector(0, 0);
glyph.advance = char_width;
}
- else {
+ else
+ {
int left = x;
while (left < x + char_width && vline_empty(surface, left, y, y + char_height, 64))
left += 1;
while (right > left && vline_empty(surface, right, y, y + char_height, 64))
right -= 1;
- if (left <= right)
- glyph.rect = Rectf(left, y, right+1, y + char_height);
- else // glyph is completely transparent
- glyph.rect = Rectf(x, y, x + char_width, y + char_height);
-
- glyph.offset = Vector(0, 0);
- glyph.advance = glyph.rect.get_width() + 1; // FIXME: might be useful to make spacing configurable
+ if (left <= right)
+ {
+ glyph.offset = Vector(x-left, 0);
+ glyph.advance = right - left + 1 + 1; // FIXME: might be useful to make spacing configurable
+ }
+ else
+ { // glyph is completly transparent
+ glyph.offset = Vector(0, 0);
+ glyph.advance = char_width + 1; // FIXME: might be useful to make spacing configurable
+ }
+
+ glyph.rect = Rectf(x, y, x + char_width, y + char_height);
}
glyphs[*chr] = glyph;