Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public decimal GetWidth(int characterCode)
        {
            var cid = CMap.ConvertToCid(characterCode);

            var fromFont = CidFont.GetWidthFromDictionary(cid);

            return(fromFont);
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        public PdfVector GetDisplacementVector(int characterCode)
        {
            var characterIdentifier = CMap.ConvertToCid(characterCode);

            return(CidFont.GetDisplacementVector(characterIdentifier).Scale(1 / 1000.0));
        }
Ejemplo n.º 5
0
        public PdfVector GetPositionVector(int characterCode)
        {
            var characterIdentifier = CMap.ConvertToCid(characterCode);

            return(CidFont.GetPositionVector(characterIdentifier).Scale(-1 / 1000.0));
        }
Ejemplo n.º 6
0
        public PdfRectangle GetBoundingBoxInGlyphSpace(int characterCode)
        {
            var characterIdentifier = CMap.ConvertToCid(characterCode);

            return(CidFont.GetBoundingBox(characterIdentifier));
        }