FontFactory - dvb.fontindex - createFont and FontNotAvailableException

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

[1870 byte] By [nettunomla] at [2007-10-2 1:56:42]
# 1
Hi Nettuno,Have you tried using the default (no Argument) constructor for the FontFactory? This has always worked for me.Hope this helps,Roger
_Roger_a at 2007-7-15 19:37:47 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 2
tell me if i have understood:oUseFontF = new FontFactory();i have to use this instead oUseFontF = new FontFactory(url); ?So i tried but i got a FontFormatExceptionI i haven't understood can ypu eplain me with some code?Thank you
nettunomla at 2007-7-15 19:37:47 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 3

Hi,

Yes that is what I ment.

The FontFormatException sounds interesting. This is thrown if the PFR file is corrupt in some way. The good news is that the STB has at least parsed the font index file, which is more then was happening when you got the FontNotAvailableException.

How did you create the PFR file?

Roger

_Roger_a at 2007-7-15 19:37:47 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 4
Hi,The api says :FontFormatException - if there is an error in the font index file bound with the applicationI think the STB does not parse the font index file successfully.Maybe the font index file is wrong, or the dtd is wrong.
wireless-toolkit-1.0.3a at 2007-7-15 19:37:47 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 5
ok so, someone can send me a pfr and a font index?nettunoml AT netcat DOT itThank you,Nettuno
nettunomla at 2007-7-15 19:37:47 > top of Java-index,Java Mobility Forums,Consumer and Commerce...