This discussion is archived
6 Replies Latest reply: Oct 28, 2009 11:27 PM by 843851 RSS

FontFactory - dvb.fontindex - createFont and FontNotAvailableException

843851 Newbie
Currently Being Moderated
Hi all,

so i have a problem, i'm trying to use FontFactory but i'm getting a FontNotAvailableException. So, i'm following mhp specification and i wrote a dvb.fontindex like this:

<?xml version="1.0"?>
     
     <!DOCTYPE fontdirectory PUBLIC "-//DVB//DTD Font Directory 1.0//EN" "http://www.dvb.org/mhp/dtd/fontdirectory-1-0.dtd">
     <fontdirectory>
          <font>
               <name>Tiresias</name>
               <fontformat>PFR</fontformat>
               <filename>tiresias.pfr</filename>
               <style>BOLD</style>
          </font>
          <font>
               <name>Amelia.pfr<name>
               <fontformat>PFR</fontformat>
               <filename>Amelia.pfr</filename>
          </font>
     </fontdirectory>

After i writed this coded:

          FontFactory oUseFontF = null;
          Font oUseFont = null;
          URL url = this.getClass().getClassLoader().getResource("Amelia.pfr");
          try {
               oUseFontF = new FontFactory(url);
          } catch (IOException e1) {
               g.drawString("a 1"+e1+" - ", 3, 16);
          } catch (FontFormatException e1) {
               g.drawString("a 2"+e1+" - ", 3, 16);
          }
          try {
               oUseFont = oUseFontF.createFont("Amelia.pfr", java.awt.Font.PLAIN, 14);
          } catch (FontNotAvailableException e1) {
               g.drawString("er 3"+e1+" - ", 3, 16);
          } catch (FontFormatException e1) {
               g.drawString("er 4"+e1+" - ", 3, 16);
          } catch (IOException e1) {
               g.drawString("er 5"+e1+" - ", 3, 16);
               e1.printStackTrace();
          }
                    g.setFont(oUseFont);
                    g.setColor(Color.red);

g.drawString("TEST", 0, 0);

After i putted my Amelia.pfr and dvb.fontindex in the root and put all on the box, but i'm getting this error.

Someone can help me? (My box is a i-can ADB)

Thanks,
Nettuno