Exemplo n.º 1
0
 public Font getFont(ChainedProperties props) {
   String face = props.getProperty("face");
   if (face != null) {
     StringTokenizer tok = new StringTokenizer(face, ",");
     while (tok.hasMoreTokens()) {
       face = tok.nextToken().trim();
       if (face.startsWith("\"")) face = face.substring(1);
       if (face.endsWith("\"")) face = face.substring(0, face.length() - 1);
       if (fontImp.isRegistered(face)) break;
     }
   }
   int style = 0;
   if (props.hasProperty("i")) style |= Font.ITALIC;
   if (props.hasProperty("b")) style |= Font.BOLD;
   if (props.hasProperty("u")) style |= Font.UNDERLINE;
   String value = props.getProperty("size");
   float size = 12;
   if (value != null) size = Float.valueOf(value).floatValue();
   Color color = MarkupParser.decodeColor(props.getProperty("color"));
   String encoding = props.getProperty("encoding");
   if (encoding == null) encoding = BaseFont.WINANSI;
   return fontImp.getFont(face, encoding, true, size, style, color);
 }
Exemplo n.º 2
0
 public Chunk createChunk(String text, ChainedProperties props) {
   Chunk ck = new Chunk(text, getFont(props));
   if (props.hasProperty("sub")) ck.setTextRise(-6);
   else if (props.hasProperty("sup")) ck.setTextRise(6);
   return ck;
 }