Page 1 of 1

PostPosted: Tue Jun 22, 2004 7:41 pm
by RunningUtes
I'm getting an error using OpenFontDb. I have tried to make my own font for using xFONT wich looks ok. Now I'm trying to create the prc with the font using PilRC. My source.rcp contains one line (FONT ID 1000 FONTID 128 "font.txt") and successfully creates the font.prc using PilRC (pilrc -ro source.rcp font.prc). Now that I have the prc, I want to use it with the example code:
Code: Select all
library "PToolboxLib"
int a;
alert (a);
if (a>0){
text(20,20,"Hello World!");

My alert is reporting -1 which I think means that the OpenFontDb command didn't load the font. Any ideas?

PostPosted: Wed Jun 23, 2004 2:23 am
by jstadolnik
A return code of -1 means that the database could not be found.

When you use the -ro switch with PilRC the generated database appears on the a PalmOS device with exact name you gave it on the command line. In your case, the file name will appear on a device as "font.prc". So if use OpenFontDb("font.prc") it should work for you.


The PToolboxLib guy.

PostPosted: Thu Jun 24, 2004 12:32 pm
by Mikael
Following on from the previous post, I've modified a Windows font with xFont (which works fine) which I'm now trying to append.
I've followed the instructions in the pToolbox docs:

First select a font database .pdb file containing the desired font. Use par to extract the fonts in the .pdb file into separate files (e.g. par x fontdb.pdb). Each font in the .pdb will now have its own unique .pdr file.

The trouble is instead of a .pdr file/s I just get a .bin file which is called : NFNT03e8.bin. I've tried both leaving the name unchanged and renaming it to: pNFT03e8.bin and pFNT2310.bin and pFNT0001.bin; all without success.

Why am I getting a different result? Is it because I only have one font in the .pdb? I wouldn't have thought that would have made a difference.

Thanks in advance,


PostPosted: Thu Jun 24, 2004 3:32 pm
by jstadolnik
Each .bin file is a raw resource itself. Resources go inside .prc files. A .prc contains header/tail information so that the palmOS can identify the file and utilize its contents. A plain .bin file has no such header/tail info.

Use the par "c" switch to create a .prc and the "a" switch to put the .bin files to it. PilRC's -ro switch can also be used to generate a .prc and add the resources to it.

Keep in mind that you can call OpenFontDb on your app's .prc file itself (no need to have a seperate font specific .prc file to include with your final app).


The PToolboxLib guy.

PostPosted: Thu Jun 24, 2004 5:45 pm
by Mikael
Thanks Joe,

I tried what you suggested, then ended up going round in circles. The .bin file mentioned above was one I'd extracted with par from a .prc created with pilrc. I tried again, just with par and got the same results - i.e. no .pdr files - only the single .bin. Then I read the docs again and realised that you were already appending .bin files - what I had to start with! So I re-read the docs and the bit where it says 'the one specified with @dbname' made it all clear.

I'd been using: OpenFontDb("fontdb"), instead of: OpenFontDb("FontDb") all along.

It works fine now.


PostPosted: Mon Jun 28, 2004 10:47 pm
by RunningUtes
Thanks Joe. It works great now. I used "font.prc" in the OpenFontDb command.