public CharacterBoundingBox GetBoundingBox(int characterCode) { if (boundingBoxCache.TryGetValue(characterCode, out var cached)) { return(cached); } var matrix = GetFontMatrix(); var boundingBox = GetBoundingBoxInGlyphSpace(characterCode); boundingBox = matrix.Transform(boundingBox); var characterIdentifier = CMap.ConvertToCid(characterCode); var width = CidFont.GetWidthFromFont(characterIdentifier); var advanceWidth = matrix.TransformX(width); var result = new CharacterBoundingBox(boundingBox, advanceWidth); boundingBoxCache[characterCode] = result; return(result); }
public decimal GetWidth(int characterCode) { var cid = CMap.ConvertToCid(characterCode); var fromFont = CidFont.GetWidthFromDictionary(cid); return(fromFont); }
public CharacterBoundingBox GetBoundingBox(int characterCode) { var matrix = GetFontMatrix(); var boundingBox = GetBoundingBoxInGlyphSpace(characterCode); boundingBox = matrix.Transform(boundingBox); var characterIdentifier = CMap.ConvertToCid(characterCode); var width = CidFont.GetWidthFromFont(characterIdentifier); var advanceWidth = matrix.Transform(new PdfPoint(width, 0)).X; return(new CharacterBoundingBox(boundingBox, advanceWidth)); }
public PdfVector GetDisplacementVector(int characterCode) { var characterIdentifier = CMap.ConvertToCid(characterCode); return(CidFont.GetDisplacementVector(characterIdentifier).Scale(1 / 1000.0)); }
public PdfVector GetPositionVector(int characterCode) { var characterIdentifier = CMap.ConvertToCid(characterCode); return(CidFont.GetPositionVector(characterIdentifier).Scale(-1 / 1000.0)); }
public PdfRectangle GetBoundingBoxInGlyphSpace(int characterCode) { var characterIdentifier = CMap.ConvertToCid(characterCode); return(CidFont.GetBoundingBox(characterIdentifier)); }