protected Font resolveFont(SharedContext ctx,String font,float size,IdentValue weight,IdentValue style,IdentValue variant){
  if (font.startsWith("\"")) {
    font=font.substring(1);
  }
  if (font.endsWith("\"")) {
    font=font.substring(0,font.length() - 1);
  }
  if (font.equalsIgnoreCase("serif")) {
    font="Serif";
  }
  if (font.equalsIgnoreCase("sans-serif")) {
    font="SansSerif";
  }
  if (font.equalsIgnoreCase("monospace")) {
    font="Monospaced";
  }
  if (font.equals("Serif") && style == IdentValue.OBLIQUE) {
    font="SansSerif";
  }
  if (font.equals("SansSerif") && style == IdentValue.ITALIC) {
    font="Serif";
  }
  String fontInstanceName=getFontInstanceHashName(ctx,font,size,weight,style,variant);
  if (instanceHash.containsKey(fontInstanceName)) {
    return instanceHash.get(fontInstanceName);
  }
  if (availableFontsHash.containsKey(font)) {
    Font possiblyNullFont=availableFontsHash.get(font);
    Font rootFont=null;
    if (possiblyNullFont != null) {
      rootFont=possiblyNullFont;
    }
 else {
      rootFont=new Font(font,Font.PLAIN,1);
      availableFontsHash.put(font,rootFont);
    }
    Font fnt=createFont(ctx,rootFont,size,weight,style,variant);
    instanceHash.put(fontInstanceName,fnt);
    return fnt;
  }
  return null;
}

protected Font resolveFont ( SharedContext ctx , String font , float size , IdentValue weight , IdentValue style , IdentValue variant ) { if ( font . startsWith ( "\"" ) ) { font = font . substring ( 1 ) ; } if ( font . endsWith ( "\"" ) ) { font = font . substring ( 0 , font . length ( ) - 1 ) ; } if ( font . equalsIgnoreCase ( "serif" ) ) { font = "Serif" ; } if ( font . equalsIgnoreCase ( "sans-serif" ) ) { font = "SansSerif" ; } if ( font . equalsIgnoreCase ( "monospace" ) ) { font = "Monospaced" ; } if ( font . equals ( "Serif" ) && style == IdentValue . OBLIQUE ) { font = "SansSerif" ; } if ( font . equals ( "SansSerif" ) && style == IdentValue . ITALIC ) { font = "Serif" ; } String fontInstanceName = getFontInstanceHashName ( ctx , font , size , weight , style , variant ) ; if ( instanceHash . containsKey ( fontInstanceName ) ) { return instanceHash . get ( fontInstanceName ) ; } if ( availableFontsHash . containsKey ( font ) ) { Font possiblyNullFont = availableFontsHash . get ( font ) ; Font rootFont = null ; if ( possiblyNullFont != null ) { rootFont = possiblyNullFont ; } else { rootFont = new Font ( font , Font . PLAIN , 1 ) ; availableFontsHash . put ( font , rootFont ) ; } Font fnt = createFont ( ctx , rootFont , size , weight , style , variant ) ; instanceHash . put ( fontInstanceName , fnt ) ; return fnt ; } return null ; }
resolves a single font name . todo : make case insensitive .
