Exemple #1
0
        public Type1FontSimple(NameToken name, int firstChar, int lastChar, double[] widths, FontDescriptor fontDescriptor, Encoding encoding,
                               CMap toUnicodeCMap,
                               Union <Type1Font, CompactFontFormatFontCollection> fontProgram)
        {
            this.firstChar      = firstChar;
            this.lastChar       = lastChar;
            this.widths         = widths;
            this.fontDescriptor = fontDescriptor;
            this.encoding       = encoding;
            this.fontProgram    = fontProgram;
            this.toUnicodeCMap  = new ToUnicodeCMap(toUnicodeCMap);

            var matrix = DefaultTransformationMatrix;

            if (fontProgram != null)
            {
                if (fontProgram.TryGetFirst(out var t1Font))
                {
                    matrix = t1Font.FontMatrix;
                }
                else if (fontProgram.TryGetSecond(out var cffFont))
                {
                    matrix = cffFont.GetFirstTransformationMatrix();
                }
            }

            fontMatrix = matrix;

            Name = name;
        }
 public Type1FontSimple(NameToken name, int firstChar, int lastChar, decimal[] widths, FontDescriptor fontDescriptor, Encoding encoding, CMap toUnicodeCMap)
 {
     this.firstChar      = firstChar;
     this.lastChar       = lastChar;
     this.widths         = widths;
     this.fontDescriptor = fontDescriptor;
     this.encoding       = encoding;
     this.toUnicodeCMap  = new ToUnicodeCMap(toUnicodeCMap);
     Name = name;
 }
Exemple #3
0
        public Type3Font(NameToken name, PdfRectangle boundingBox, TransformationMatrix fontMatrix,
                         Encoding encoding, int firstChar, int lastChar, decimal[] widths,
                         CMap toUnicodeCMap)
        {
            Name = name;

            this.boundingBox   = boundingBox;
            this.fontMatrix    = fontMatrix;
            this.encoding      = encoding;
            this.firstChar     = firstChar;
            this.lastChar      = lastChar;
            this.widths        = widths;
            this.toUnicodeCMap = new ToUnicodeCMap(toUnicodeCMap);
        }
Exemple #4
0
        public TrueTypeSimpleFont(CosName name, int firstCharacterCode, int lastCharacterCode, decimal[] widths,
                                  FontDescriptor descriptor,
                                  [CanBeNull] CMap toUnicodeCMap,
                                  [CanBeNull] Encoding encoding)
        {
            this.firstCharacterCode = firstCharacterCode;
            this.lastCharacterCode  = lastCharacterCode;
            this.widths             = widths;
            this.descriptor         = descriptor;
            this.encoding           = encoding;

            Name       = name;
            IsVertical = false;
            ToUnicode  = new ToUnicodeCMap(toUnicodeCMap);
        }
        public TrueTypeSimpleFont(NameToken name,
                                  FontDescriptor descriptor,
                                  [CanBeNull] CMap toUnicodeCMap,
                                  [CanBeNull] Encoding encoding,
                                  [CanBeNull] TrueTypeFontProgram fontProgram,
                                  int firstCharacter,
                                  decimal[] widths)
        {
            this.descriptor     = descriptor;
            this.encoding       = encoding;
            this.fontProgram    = fontProgram;
            this.firstCharacter = firstCharacter;
            this.widths         = widths;

            Name       = name;
            IsVertical = false;
            ToUnicode  = new ToUnicodeCMap(toUnicodeCMap);
        }
Exemple #6
0
        public Type1FontSimple(NameToken name, int firstChar, int lastChar, decimal[] widths, FontDescriptor fontDescriptor, Encoding encoding,
                               CMap toUnicodeCMap,
                               Union <Type1FontProgram, CompactFontFormatFontProgram> fontProgram)
        {
            this.firstChar      = firstChar;
            this.lastChar       = lastChar;
            this.widths         = widths;
            this.fontDescriptor = fontDescriptor;
            this.encoding       = encoding;
            this.fontProgram    = fontProgram;
            this.toUnicodeCMap  = new ToUnicodeCMap(toUnicodeCMap);

            var matrix = TransformationMatrix.FromValues(0.001m, 0, 0, 0.001m, 0, 0);

            fontProgram?.Match(x => matrix = x.GetFontTransformationMatrix(), x => { matrix = x.GetFontTransformationMatrix(); });

            fontMatrix = matrix;

            Name = name;
        }
Exemple #7
0
        public TrueTypeSimpleFont(NameToken name,
                                  FontDescriptor descriptor,
                                  [CanBeNull] CMap toUnicodeCMap,
                                  [CanBeNull] Encoding encoding,
                                  [CanBeNull] TrueTypeFont font,
                                  int firstCharacter,
                                  double[] widths)
        {
            this.descriptor     = descriptor;
            this.encoding       = encoding;
            this.font           = font;
            this.firstCharacter = firstCharacter;
            this.widths         = widths;

            Name       = name;
            IsVertical = false;
            ToUnicode  = new ToUnicodeCMap(toUnicodeCMap);
            Details    = descriptor?.ToDetails(Name?.Data)
                         ?? FontDetails.GetDefault(Name?.Data);
        }