Esempio n. 1
0
 public static void createParagraph(Paragraph p, ChainedProperties props) {
   String value = props.getProperty("align");
   if (value != null) {
     if (value.equalsIgnoreCase("center")) p.setAlignment(Element.ALIGN_CENTER);
     else if (value.equalsIgnoreCase("right")) p.setAlignment(Element.ALIGN_RIGHT);
     else if (value.equalsIgnoreCase("justify")) p.setAlignment(Element.ALIGN_JUSTIFIED);
   }
   setParagraphLeading(p, props.getProperty("leading"));
   value = props.getProperty("before");
   if (value != null) {
     try {
       p.setSpacingBefore(Float.valueOf(value).floatValue());
     } catch (Exception e) {
     }
   }
   value = props.getProperty("after");
   if (value != null) {
     try {
       p.setSpacingAfter(Float.valueOf(value).floatValue());
     } catch (Exception e) {
     }
   }
   value = props.getProperty("extraparaspace");
   if (value != null) {
     try {
       p.setExtraParagraphSpace(Float.valueOf(value).floatValue());
     } catch (Exception e) {
     }
   }
 }
Esempio n. 2
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);
 }
Esempio n. 3
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;
 }