fix ubuntu-64 support (Tao.FreeType was quite bogus.)

This commit is contained in:
Chris Forbes
2010-10-04 20:17:08 +13:00
committed by Paul Chote
parent 7cb8da411d
commit 49a645cd2d
2 changed files with 6 additions and 3 deletions

View File

@@ -80,17 +80,20 @@ namespace OpenRA.Graphics
GlyphInfo CreateGlyph(Pair<char,Color> c) GlyphInfo CreateGlyph(Pair<char,Color> c)
{ {
var index = FT.FT_Get_Char_Index(face, (uint)c.First); var index = FT.FT_Get_Char_Index(face, (uint)c.First);
FT.FT_Load_Glyph(face, index, FT.FT_LOAD_RENDER); if (0 != FT.FT_Load_Glyph(face, index, FT.FT_LOAD_RENDER))
throw new InvalidOperationException( "FT_Load_Glyph failed." );
var _face = (FT_FaceRec)Marshal.PtrToStructure(face, typeof(FT_FaceRec)); var _face = (FT_FaceRec)Marshal.PtrToStructure(face, typeof(FT_FaceRec));
var _glyph = (FT_GlyphSlotRec)Marshal.PtrToStructure(_face.glyph, typeof(FT_GlyphSlotRec)); var _glyph = (FT_GlyphSlotRec)Marshal.PtrToStructure(_face.glyph, typeof(FT_GlyphSlotRec));
var s = builder.Allocate(new Size(_glyph.metrics.width >> 6, _glyph.metrics.height >> 6)); var s = builder.Allocate(
new Size(_glyph.metrics.width.ToInt32() >> 6,
_glyph.metrics.height.ToInt32() >> 6));
var g = new GlyphInfo var g = new GlyphInfo
{ {
Sprite = s, Sprite = s,
Advance = _glyph.metrics.horiAdvance / 64f, Advance = _glyph.metrics.horiAdvance.ToInt32() / 64f,
Offset = { X = _glyph.bitmap_left, Y = -_glyph.bitmap_top } Offset = { X = _glyph.bitmap_left, Y = -_glyph.bitmap_top }
}; };

Binary file not shown.