Пример #1
0
        /// <summary>
        /// Adds one of the Standard 14 fonts which are included by default in PDF programs so that pages in this document can use it. These Standard 14 fonts are old and possibly obsolete.
        /// </summary>
        /// <param name="type">The type of the Standard 14 font to use.</param>
        /// <returns>An identifier which can be passed to <see cref="PdfPageBuilder.AddText"/>.</returns>
        public AddedFont AddStandard14Font(Standard14Font type)
        {
            var id    = Guid.NewGuid();
            var name  = NameToken.Create($"F{fonts.Count}");
            var added = new AddedFont(id, name);

            fonts[id] = new FontStored(added, new Standard14WritingFont(Standard14.GetAdobeFontMetrics(type)));

            return(added);
        }
Пример #2
0
        /// <summary>
        /// Adds one of the Standard 14 fonts which are included by default in PDF programs so that pages in this document can use it. These Standard 14 fonts are old and possibly obsolete.
        /// </summary>
        /// <param name="type">The type of the Standard 14 font to use.</param>
        /// <returns>An identifier which can be passed to <see cref="PdfPageBuilder.AddText"/>.</returns>
        public AddedFont AddStandard14Font(Standard14Font type)
        {
            if (ArchiveStandard != PdfAStandard.None)
            {
                throw new NotSupportedException($"PDF/A {ArchiveStandard} requires the font to be embedded in the file, only {nameof(AddTrueTypeFont)} is supported.");
            }

            var id    = Guid.NewGuid();
            var name  = NameToken.Create($"F{fontId++}");
            var added = new AddedFont(id, context.ReserveObjectNumber());

            fonts[id] = new FontStored(added, new Standard14WritingFont(Standard14.GetAdobeFontMetrics(type)));
            return(added);
        }
Пример #3
0
 public static FontMetrics GetAdobeFontMetrics(Standard14Font fontType)
 {
     return(Standard14AfmTypeMap[fontType]);
 }
Пример #4
0
 /// <summary>
 /// Get the Adobe Font Metrics as <see cref="AdobeFontMetrics"/> for a Standard14 font.
 /// </summary>
 public static AdobeFontMetrics GetAdobeFontMetrics(Standard14Font fontType)
 {
     return(Standard14Cache[BuilderTypesToNames[fontType]]);
 }