/**
  * Constructs a <CODE>Font</CODE>-object.
  *
  * @param fontname the name of the font
  * @param encoding the encoding of the font
  * @param embedded true if the font is to be embedded in the PDF
  * @param size the size of this font
  * @param style the style of this font
  * @param color the <CODE>Color</CODE> of this font.
  * @return the Font constructed based on the parameters
  */
 private static Font getFont(
     final String fontname,
     final String encoding,
     final boolean embedded,
     final float size,
     final int style,
     final Color color) {
   return fontImp.getFont(fontname, encoding, embedded, size, style, color);
 }
Ejemplo 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);
 }
 /**
  * Constructs a <CODE>Font</CODE>-object.
  *
  * @param attributes the attributes of a <CODE>Font</CODE> object.
  * @return the Font constructed based on the attributes
  */
 public static Font getFont(final Properties attributes) {
   fontImp.defaultEmbedding = defaultEmbedding;
   fontImp.defaultEncoding = defaultEncoding;
   return fontImp.getFont(attributes);
 }