Пример #1
0
 internal FreeTypeGlyphSlot(FreeTypeFace face, IntPtr slot)
 {
     this.face = face;
     this.slot = slot;
 }
 internal Ttf(AGS.Types.Font font, string path)
     : base(font)
 {
     face = FreeType.NewFace(path, 0);
     face.SetCharSize(font.PointSize * 64, font.PointSize * 64, 72, 69);
     for (int i = 0; i < face.NumGlyphs; i++)
     {
         using (FreeTypeGlyphSlot slot = face.LockGlyph((uint)i, FT_LoadFlags.LoadMonochrome))
         using (FreeTypeGlyph glyph = slot.GetGlyph())
         {
             glyph.ToBitmap(FT_RenderMode.Mono, true);
             Bitmap bmp = glyph.GetBitmap();
             chars.Add(new AgsFontChar(
                 bmp,
                 (int)Math.Ceiling(slot.Metrics_HorizontalLayout_Advance / 64.0),
                 (int)Math.Ceiling(slot.Metrics_HorizontalLayout_Left / 64.0),
                 (int)Math.Ceiling(slot.Metrics_HorizontalLayout_Top / 64.0)));
         }
     }
 }