internal Rect BoundGlyph(uint glyphIndex, StyleSimulations style) { var recip = 1 / (float)FtFace.UnitsPerEM; //var strength = 0.02f; var trm = AdjustGlyphWidth(glyphIndex); var m = new FTMatrix((int)trm.M11 * 65536, (int)trm.M21 * 65536, (int)trm.M12 * 65536, (int)trm.M22 * 65536); var v = new FTVector(Fixed16Dot16.FromDouble(trm.OffsetX * 65536), Fixed16Dot16.FromDouble(trm.OffsetY * 65536)); FtFace.SetCharSize(Fixed26Dot6.FromInt32(FtFace.UnitsPerEM), Fixed26Dot6.FromInt32(FtFace.UnitsPerEM), 72, 72); FtFace.SetTransform(m, v); FtFace.LoadGlyph(glyphIndex, LoadFlags.NoBitmap | LoadFlags.NoHinting, LoadTarget.Normal); /*if (style == StyleSimulations.BoldSimulation) * { * FtFace.Glyph.Outline.Embolden(Fixed26Dot6.FromDouble(strength * FtFace.UnitsPerEM)); * FtFace.Glyph.Outline.Translate((int) (-strength * 0.5 * FtFace.UnitsPerEM), (int) (-strength * 0.5 * FtFace.UnitsPerEM)); * }*/ var box = FtFace.Glyph.GetGlyph().GetCBox(GlyphBBoxMode.Pixels); var rect = new Rect(new Point(box.Left * recip, box.Top * recip), new Point(box.Right * recip, box.Bottom * recip)); if (rect.IsEmpty) { rect = new Rect(new Point(trm.OffsetX, trm.OffsetY), new Point(trm.OffsetX, trm.OffsetY)); } return(rect); }
public GlyphTypeface(Uri typefaceSource, StyleSimulations styleSimulations) { }
public GlyphTypeface(Uri typefaceSource, StyleSimulations styleSimulations) { }