예제 #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
파일: Type0Font.cs 프로젝트: lulzzz/PdfPig
        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));
        }