Exemplo n.º 1
0
 public override void CheckFont(PdfFont pdfFont)
 {
     if (!pdfFont.IsEmbedded())
     {
         throw new PdfAConformanceException(PdfAConformanceException.ALL_THE_FONTS_MUST_BE_EMBEDDED_THIS_ONE_IS_NOT_0
                                            ).SetMessageParams(pdfFont.GetFontProgram().GetFontNames().GetFontName());
     }
     if (pdfFont is PdfTrueTypeFont)
     {
         PdfTrueTypeFont trueTypeFont = (PdfTrueTypeFont)pdfFont;
         bool            symbolic     = trueTypeFont.GetFontEncoding().IsFontSpecific();
         if (symbolic)
         {
             CheckSymbolicTrueTypeFont(trueTypeFont);
         }
         else
         {
             CheckNonSymbolicTrueTypeFont(trueTypeFont);
         }
     }
     if (pdfFont is PdfType3Font)
     {
         PdfDictionary charProcs = pdfFont.GetPdfObject().GetAsDictionary(PdfName.CharProcs);
         foreach (PdfName charName in charProcs.KeySet())
         {
             CheckContentStream(charProcs.GetAsStream(charName));
         }
     }
 }
Exemplo n.º 2
0
 protected internal override void CheckSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)
 {
     if (trueTypeFont.GetFontEncoding().HasDifferences())
     {
         throw new PdfAConformanceException(PdfAConformanceException.AllSymbolicTrueTypeFontsShallNotSpecifyEncoding
                                            );
     }
 }
Exemplo n.º 3
0
 protected internal override void CheckSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)
 {
     if (trueTypeFont.GetFontEncoding().HasDifferences())
     {
         throw new PdfAConformanceException(PdfAConformanceException.ALL_SYMBOLIC_TRUE_TYPE_FONTS_SHALL_NOT_SPECIFY_ENCODING
                                            );
     }
 }
Exemplo n.º 4
0
        protected internal override void CheckNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)
        {
            String encoding = trueTypeFont.GetFontEncoding().GetBaseEncoding();

            // non-symbolic true type font will always has an encoding entry in font dictionary in itext7
            if (!PdfEncodings.WINANSI.Equals(encoding) && !encoding.Equals(PdfEncodings.MACROMAN) || trueTypeFont.GetFontEncoding
                    ().HasDifferences())
            {
                throw new PdfAConformanceException(PdfAConformanceException.AllNonSymbolicTrueTypeFontShallSpecifyMacRomanOrWinAnsiEncodingAsTheEncodingEntry
                                                   , trueTypeFont);
            }
        }
Exemplo n.º 5
0
        protected internal override void CheckNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)
        {
            String encoding = trueTypeFont.GetFontEncoding().GetBaseEncoding();

            // non-symbolic true type font will always has an encoding entry in font dictionary in itext7
            if (!PdfEncodings.WINANSI.Equals(encoding) && !encoding.Equals(PdfEncodings.MACROMAN) || trueTypeFont.GetFontEncoding
                    ().HasDifferences())
            {
                throw new PdfAConformanceException(PdfAConformanceException.ALL_NON_SYMBOLIC_TRUE_TYPE_FONT_SHALL_SPECIFY_MAC_ROMAN_OR_WIN_ANSI_ENCODING_AS_THE_ENCODING_ENTRY
                                                   , trueTypeFont);
            }
        }
Exemplo n.º 6
0
 public override void CheckFont(PdfFont pdfFont)
 {
     if (!pdfFont.IsEmbedded())
     {
         throw new PdfAConformanceException(PdfAConformanceException.AllFontsMustBeEmbeddedThisOneIsnt1).SetMessageParams
                   (pdfFont.GetFontProgram().GetFontNames().GetFontName());
     }
     if (pdfFont is PdfTrueTypeFont)
     {
         PdfTrueTypeFont trueTypeFont = (PdfTrueTypeFont)pdfFont;
         bool            symbolic     = trueTypeFont.GetFontEncoding().IsFontSpecific();
         if (symbolic)
         {
             CheckSymbolicTrueTypeFont(trueTypeFont);
         }
         else
         {
             CheckNonSymbolicTrueTypeFont(trueTypeFont);
         }
     }
 }
Exemplo n.º 7
0
 public override void CheckFont(PdfFont pdfFont)
 {
     if (!pdfFont.IsEmbedded())
     {
         throw new PdfAConformanceException(PdfAConformanceException.ALL_THE_FONTS_MUST_BE_EMBEDDED_THIS_ONE_IS_NOT_0
                                            ).SetMessageParams(pdfFont.GetFontProgram().GetFontNames().GetFontName());
     }
     if (pdfFont is PdfTrueTypeFont)
     {
         PdfTrueTypeFont trueTypeFont = (PdfTrueTypeFont)pdfFont;
         bool            symbolic     = trueTypeFont.GetFontEncoding().IsFontSpecific();
         if (symbolic)
         {
             CheckSymbolicTrueTypeFont(trueTypeFont);
         }
         else
         {
             CheckNonSymbolicTrueTypeFont(trueTypeFont);
         }
     }
 }