IsFont() public method

public IsFont ( ) : bool
return bool
示例#1
1
 /**
 * Processes a dictionary.
 * In case of font dictionaries, the dictionary is processed.
 */
 public void UnembedTTF(PdfDictionary dict)
 {
     // we ignore all dictionaries that aren't font dictionaries
     if (!dict.IsFont())
         return;
     // we only remove TTF fonts
     if (dict.GetAsDict(PdfName.FONTFILE2) != null)
     {
         return;
     }
     // check if a subset was used (in which case we remove the prefix)
     PdfName baseFont = dict.GetAsName(PdfName.BASEFONT);
     if (baseFont.GetBytes()[7] == '+')
     {
         baseFont = new PdfName(baseFont.ToString().Substring(8));
         dict.Put(PdfName.BASEFONT, baseFont);
     }
     // we check if there's a font descriptor
     PdfDictionary fontDescriptor = dict.GetAsDict(PdfName.FONTDESCRIPTOR);
     if (fontDescriptor == null)
         return;
     // is there is, we replace the fontname and remove the font file
     fontDescriptor.Put(PdfName.FONTNAME, baseFont);
     fontDescriptor.Remove(PdfName.FONTFILE2);
 }