예제 #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);
            }
        }
예제 #2
0
 internal FontProgram GetFontProgram(FontInfo fontInfo)
 {
     return(fontPrograms.Get(fontInfo));
 }
예제 #3
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.
 /// 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));
 }
예제 #4
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.
 /// 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)));
 }
예제 #5
0
 /// <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)));
 }
예제 #6
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.
 /// 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)));
 }
예제 #7
0
 /// <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)));
 }
예제 #8
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.
 /// 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)));
 }
예제 #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));
 }
예제 #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)));
 }
예제 #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)));
 }
예제 #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));
 }