Beispiel #1
0
        /// <summary>Add not supported for auto creating FontPrograms.</summary>
        /// <remarks>
        /// Add not supported for auto creating FontPrograms.
        /// <para />
        /// Note,
        /// <see cref="FontInfo.GetAlias()"/>
        /// do not taken into account in
        /// <see cref="FontInfo.Equals(System.Object)"/>.
        /// The same font with different alias will not be replaced.
        /// Alias will replace original font family in font selector algorithm.
        /// </remarks>
        /// <param name="fontProgram">
        ///
        /// <see cref="iText.IO.Font.FontProgram"/>
        /// </param>
        /// <param name="encoding">
        /// FontEncoding for creating
        /// <see cref="iText.Kernel.Font.PdfFont"/>
        /// </param>
        /// <param name="alias">font alias.</param>
        /// <param name="unicodeRange">sets the specific range of characters to be used from the font</param>
        /// <returns>true, if font was successfully added, otherwise false.</returns>
        public bool AddFont(FontProgram fontProgram, String encoding, String alias, Range unicodeRange)
        {
            if (fontProgram == null)
            {
                return(false);
            }
            if (fontProgram is Type3Font)
            {
                ILog logger = LogManager.GetLogger(typeof(iText.Layout.Font.FontSet));
                logger.Error(iText.IO.LogMessageConstant.TYPE3_FONT_CANNOT_BE_ADDED);
                return(false);
            }
            FontInfo fi = FontInfo.Create(fontProgram, encoding, alias, unicodeRange);

            if (AddFont(fi))
            {
                fontPrograms.Put(fi, fontProgram);
                return(true);
            }
            else
            {
                return(false);
            }
        }
 internal FontProgram GetFontProgram(FontInfo fontInfo)
 {
     return(fontPrograms.Get(fontInfo));
 }
 /// <summary>
 /// Adds
 /// <see cref="FontInfo"/>
 /// with alias. Could be used to fill temporary font set.
 /// <p>
 /// Note,
 /// <see cref="FontInfo.GetAlias()"/>
 /// do not taken into account in
 /// <see cref="FontInfo.Equals(System.Object)"/>
 /// .
 /// The same font with different alias will not be replaced.
 /// Alias will replace original font family in font selector algorithm.
 /// </summary>
 /// <param name="fontInfo">font info.</param>
 /// <param name="alias">font alias.</param>
 /// <returns>true, if font was successfully added, otherwise false.</returns>
 public bool AddFont(FontInfo fontInfo, String alias)
 {
     return(AddFont(fontInfo, alias, null));
 }
 /// <summary>
 /// Adds
 /// <see cref="FontInfo"/>
 /// with alias. Could be used to fill temporary font set.
 /// <p>
 /// Note,
 /// <see cref="FontInfo.GetAlias()"/>
 /// do not taken into account in
 /// <see cref="FontInfo.Equals(System.Object)"/>
 /// .
 /// The same font with different alias will not be replaced.
 /// Alias will replace original font family in font selector algorithm.
 /// </summary>
 /// <param name="fontInfo">font info.</param>
 /// <param name="alias">font alias.</param>
 /// <param name="unicodeRange">sets the specific range of characters to be used from the font</param>
 /// <returns>true, if font was successfully added, otherwise false.</returns>
 public bool AddFont(FontInfo fontInfo, String alias, Range unicodeRange)
 {
     return(AddFont(FontInfo.Create(fontInfo, alias, unicodeRange)));
 }
 /// <summary>
 /// Creates
 /// <see cref="FontInfo"/>
 /// , fetches
 /// <see cref="iText.IO.Font.FontProgramDescriptor"/>
 /// and adds just created
 /// <see cref="FontInfo"/>
 /// to
 /// <see cref="FontSet"/>
 /// .
 /// </summary>
 /// <param name="fontData">font data.</param>
 /// <param name="encoding">preferred font encoding.</param>
 /// <returns>true, if font was successfully added, otherwise false.</returns>
 /// <seealso cref="iText.IO.Font.PdfEncodings"/>
 public bool AddFont(byte[] fontData, String encoding)
 {
     return(AddFont(FontInfo.Create(fontData, encoding, null, null)));
 }
 /// <summary>
 /// Creates
 /// <see cref="FontInfo"/>
 /// , fetches
 /// <see cref="iText.IO.Font.FontProgramDescriptor"/>
 /// and adds just created
 /// <see cref="FontInfo"/>
 /// to
 /// <see cref="FontSet"/>
 /// .
 /// <p>
 /// Note,
 /// <see cref="FontInfo.GetAlias()"/>
 /// do not taken into account in
 /// <see cref="FontInfo.Equals(System.Object)"/>
 /// .
 /// The same font with different alias will not be replaced.
 /// Alias will replace original font family in font selector algorithm.
 /// </summary>
 /// <param name="fontData">font data.</param>
 /// <param name="encoding">preferred font encoding.</param>
 /// <param name="alias">font alias.</param>
 /// <param name="unicodeRange">sets the specific range of characters to be used from the font</param>
 /// <returns>true, if font was successfully added, otherwise false.</returns>
 /// <seealso cref="iText.IO.Font.PdfEncodings"/>
 public bool AddFont(byte[] fontData, String encoding, String alias, Range unicodeRange)
 {
     return(AddFont(FontInfo.Create(fontData, encoding, alias, unicodeRange)));
 }
 /// <summary>
 /// Creates
 /// <see cref="FontInfo"/>
 /// , fetches
 /// <see cref="iText.IO.Font.FontProgramDescriptor"/>
 /// and adds just created
 /// <see cref="FontInfo"/>
 /// to
 /// <see cref="FontSet"/>
 /// .
 /// </summary>
 /// <param name="fontPath">path to font data.</param>
 /// <param name="encoding">preferred font encoding.</param>
 /// <returns>true, if font was successfully added, otherwise false.</returns>
 /// <seealso cref="iText.IO.Font.PdfEncodings"/>
 public bool AddFont(String fontPath, String encoding)
 {
     return(AddFont(FontInfo.Create(fontPath, encoding, null, null)));
 }
 /// <summary>
 /// Creates
 /// <see cref="FontInfo"/>
 /// , fetches
 /// <see cref="iText.IO.Font.FontProgramDescriptor"/>
 /// and adds just created
 /// <see cref="FontInfo"/>
 /// to
 /// <see cref="FontSet"/>
 /// .
 /// <p>
 /// Note,
 /// <see cref="FontInfo.GetAlias()"/>
 /// do not taken into account in
 /// <see cref="FontInfo.Equals(System.Object)"/>
 /// .
 /// The same font with different alias will not be replaced.
 /// Alias will replace original font family in font selector algorithm.
 /// </summary>
 /// <param name="fontPath">path to font data.</param>
 /// <param name="encoding">preferred font encoding.</param>
 /// <param name="alias">font alias, will replace original font family.</param>
 /// <param name="unicodeRange">sets the specific range of characters to be used from the font</param>
 /// <returns>true, if font was successfully added, otherwise false.</returns>
 /// <seealso cref="iText.IO.Font.PdfEncodings"/>
 public bool AddFont(String fontPath, String encoding, String alias, Range unicodeRange)
 {
     return(AddFont(FontInfo.Create(fontPath, encoding, alias, unicodeRange)));
 }
Beispiel #9
0
 /// <summary>
 /// Get from cache or create a new instance of
 /// <see cref="iText.Kernel.Font.PdfFont"/>
 /// .
 /// </summary>
 /// <param name="fontInfo">
 /// font info, to create
 /// <see cref="iText.IO.Font.FontProgram"/>
 /// and
 /// <see cref="iText.Kernel.Font.PdfFont"/>
 /// .
 /// </param>
 /// <returns>
 /// cached or new instance of
 /// <see cref="iText.Kernel.Font.PdfFont"/>
 /// .
 /// </returns>
 public virtual PdfFont GetPdfFont(FontInfo fontInfo)
 {
     return(GetPdfFont(fontInfo, null));
 }
Beispiel #10
0
 /// <summary>
 /// Adds
 /// <see cref="FontInfo"/>
 /// with alias. Could be used to fill temporary font set.
 /// <p>
 /// Note,
 /// <see cref="FontInfo.GetAlias()"/>
 /// do not taken into account in
 /// <see cref="FontInfo.Equals(System.Object)"/>
 /// .
 /// The same font with different alias will not be replaced.
 /// </summary>
 /// <param name="fontInfo">font info.</param>
 /// <param name="alias">font alias.</param>
 /// <returns>true, if font was successfully added, otherwise false.</returns>
 public bool AddFont(FontInfo fontInfo, String alias)
 {
     return(AddFont(FontInfo.Create(fontInfo, alias)));
 }
Beispiel #11
0
 /// <summary>
 /// Creates
 /// <see cref="FontInfo"/>
 /// , fetches
 /// <see cref="iText.IO.Font.FontProgramDescriptor"/>
 /// and adds just created
 /// <see cref="FontInfo"/>
 /// to
 /// <see cref="FontSet"/>
 /// .
 /// <p>
 /// Note,
 /// <see cref="FontInfo.GetAlias()"/>
 /// do not taken into account in
 /// <see cref="FontInfo.Equals(System.Object)"/>
 /// .
 /// The same font with different alias will not be replaced.
 /// </summary>
 /// <param name="fontData">font data.</param>
 /// <param name="encoding">preferred font encoding.</param>
 /// <param name="alias">font alias.</param>
 /// <returns>true, if font was successfully added, otherwise false.</returns>
 /// <seealso cref="iText.IO.Font.PdfEncodings"/>
 public bool AddFont(byte[] fontData, String encoding, String alias)
 {
     return(AddFont(FontInfo.Create(fontData, encoding, alias)));
 }
Beispiel #12
0
 /// <summary>
 /// Creates
 /// <see cref="FontInfo"/>
 /// , fetches
 /// <see cref="iText.IO.Font.FontProgramDescriptor"/>
 /// and adds just created
 /// <see cref="FontInfo"/>
 /// to
 /// <see cref="FontSet"/>
 /// .
 /// <p>
 /// Note,
 /// <see cref="FontInfo.GetAlias()"/>
 /// do not taken into account in
 /// <see cref="FontInfo.Equals(System.Object)"/>
 /// .
 /// The same font with different alias will not be replaced.
 /// </summary>
 /// <param name="fontPath">path to font data.</param>
 /// <param name="encoding">preferred font encoding.</param>
 /// <param name="alias">font alias.</param>
 /// <returns>true, if font was successfully added, otherwise false.</returns>
 /// <seealso cref="iText.IO.Font.PdfEncodings"/>
 public bool AddFont(String fontPath, String encoding, String alias)
 {
     return(AddFont(FontInfo.Create(fontPath, encoding, alias)));
 }
 /// <summary>Utility method to create PdfFont.</summary>
 /// <param name="fontInfo">instance of FontInfo.</param>
 /// <returns>cached or just created PdfFont on success, otherwise null.</returns>
 /// <seealso cref="FontProvider.GetPdfFont(FontInfo, FontSet)"/>
 protected internal virtual PdfFont GetPdfFont(FontInfo fontInfo)
 {
     return(provider.GetPdfFont(fontInfo, tempFonts));
 }