void ParseKerningPairXml(ref LinkedList<KerningInfo> lstKernings, FileInfo file, XmlReader reader) { KerningInfo info = new KerningInfo(); while(!reader.EOF) { reader.Read(); if(reader.Name == "KerningPairs" && reader.NodeType == XmlNodeType.EndElement) break; if(reader.Name == "KerningPair") { if(reader.NodeType == XmlNodeType.Element) info = new KerningInfo(); else if(reader.NodeType == XmlNodeType.EndElement) lstKernings.AddLast(info); continue; } if(reader.NodeType != XmlNodeType.Element) continue; switch(reader.Name) { case "LeftChar": { reader.Read(); uint code = uint.Parse(reader.Value, System.Globalization.NumberStyles.HexNumber); info.LeftChar = code; } break; case "RightChar": { reader.Read(); uint code = uint.Parse(reader.Value, System.Globalization.NumberStyles.HexNumber); info.RightChar = code; } break; case "HorizontalAdjust": { reader.Read(); info.HorizontalAdjust = Double.Parse(reader.Value); } break; case "VerticalAdjust": { reader.Read(); info.VerticalAdjust = Double.Parse(reader.Value); } break; } } }
public static KerningInfo CreateKerningInfo(uint leftIndex, uint rightIndex) { KerningInfo info = new KerningInfo(); FT_Vector vector = new FT_Vector(); FT.FT_Get_Kerning(ftFace, leftIndex, rightIndex, (uint)FT_Kerning_Mode.FT_KERNING_DEFAULT, out vector); info.HorizontalAdjust = ((double)vector.x) / 64.0d; info.VerticalAdjust = ((double)vector.y) / 64.0d; return info; }