Example #1
0
 private void init() {
   encoding = "";
   fontSpecific = false;
   fontType = FONT_TYPE_DOCUMENT;
   PdfName baseFont = font.getAsName(PdfName.BASEFONT);
   fontName = baseFont != null ? PdfName.decodeName(baseFont.toString()) : "Unspecified Font Name";
   PdfName subType = font.getAsName(PdfName.SUBTYPE);
   if (PdfName.TYPE1.equals(subType) || PdfName.TRUETYPE.equals(subType)) doType1TT();
   else {
     PdfName encodingName = font.getAsName(PdfName.ENCODING);
     if (encodingName != null) {
       String enc = PdfName.decodeName(encodingName.toString());
       String ffontname = CJKFont.GetCompatibleFont(enc);
       if (ffontname != null) {
         try {
           cjkMirror = BaseFont.createFont(ffontname, enc, false);
         } catch (Exception e) {
           throw new ExceptionConverter(e);
         }
         cjkEncoding = enc;
         uniMap = ((CJKFont) cjkMirror).getUniMap();
         return;
       }
       if (PdfName.TYPE0.equals(subType) && enc.equals("Identity-H")) {
         processType0(font);
         isType0 = true;
       }
     }
   }
 }
 /**
  * If the child of a structured element is a dictionary, we inspect the child; we may also draw a
  * tag.
  *
  * @param k the child dictionary to inspect
  */
 public void inspectChildDictionary(PdfDictionary k) throws IOException {
   if (k == null) return;
   PdfName s = k.getAsName(PdfName.S);
   if (s != null) {
     String tagN = PdfName.decodeName(s.toString());
     String tag = fixTagName(tagN);
     out.print("<");
     out.print(tag);
     out.print(">");
     PdfDictionary dict = k.getAsDict(PdfName.PG);
     if (dict != null) parseTag(tagN, k.getDirectObject(PdfName.K), dict);
     inspectChild(k.get(PdfName.K));
     out.print("</");
     out.print(tag);
     out.println(">");
   } else inspectChild(k.get(PdfName.K));
 }