Пример #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);
        }
Пример #2
0
        public decimal GetWidth(int characterCode)
        {
            var cid = CMap.ConvertToCid(characterCode);

            var fromFont = CidFont.GetWidthFromDictionary(cid);

            return(fromFont);
        }
Пример #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));
        }
Пример #4
0
        public PdfVector GetDisplacementVector(int characterCode)
        {
            var characterIdentifier = CMap.ConvertToCid(characterCode);

            return(CidFont.GetDisplacementVector(characterIdentifier).Scale(1 / 1000.0));
        }
Пример #5
0
        public PdfVector GetPositionVector(int characterCode)
        {
            var characterIdentifier = CMap.ConvertToCid(characterCode);

            return(CidFont.GetPositionVector(characterIdentifier).Scale(-1 / 1000.0));
        }
Пример #6
0
        public PdfRectangle GetBoundingBoxInGlyphSpace(int characterCode)
        {
            var characterIdentifier = CMap.ConvertToCid(characterCode);

            return(CidFont.GetBoundingBox(characterIdentifier));
        }