public Vector2 GetKerning(int size, int codepoint1, int codepoint2) { GlyphInstance aInstance = FontInstance.GetGlyph(codepoint1); Vector2 offset = FontInstance.GetOffset(FontInstance.GetGlyph(codepoint2), aInstance); return(offset * size / FontInstance.EmSize); }
public bool TryGetKerning(out Vector2[,] kerningOffsets) { kerningOffsets = null; if (!IncludeKerningIfPresent) { return(false); } for (int a = FirstChar; a <= LastChar; a++) { GlyphInstance aInstance = FontInstance.GetGlyph(a); for (int b = FirstChar; b <= LastChar; b++) { Vector2 offset = FontInstance.GetOffset(FontInstance.GetGlyph(b), aInstance); if (offset.X != 0 || offset.Y != 0) { if (kerningOffsets == null) { kerningOffsets = new Vector2[CharCount, CharCount]; } kerningOffsets[a - FirstChar, b - FirstChar] = offset * Size * (DrawDpi / CalcDpi) / FontInstance.EmSize; } } } return(kerningOffsets != null); }