Bob said:
> Palm OS 3.0 and later have FntDefineFont, but there's no information about
> the format of fonts or about supported tools to generate Palm fonts. One web
> page in the Knowledge Base mentioned that there are 3rd party tools
> appearing which allow one to create Palm fonts, but there was no more
> specific information.
>
> So how does one create a Palm font?

The easiest way is to use PilRC (as either command-line tool, or as plugin
to CodeWarrior).

In a .rcp file, you'd specify a new font with the desired resource ID and
font ID (the font ID is there so that PilRC can figure widths etc. while
compiling your forms):
FONT ID 2000 FONTID 128 "Font.txt"

Then, here's the file describing the font
// A 5x11 fixed width font
// fontType is actually unused, inherited from Mac OS NFNT type
fontType 36864
ascent 9
descent 2
leading 2
GLYPH '('
-----
-----
---#-
--#--
-#---
-#---
-#---
-#---
--#--
---#-
-----

GLYPH ')'
-----
-----
#----
-#---
--#--
--#--
--#--
--#--
-#---
#----
-----

and so on.

You'll end up with an 'NFNT' resource (ID 2000) in your .prc file.

For completeness, here's the code to use the font:


In AppStart:
H = DmGetResource(�NFNT�, 2000);
gFontPtr = MemHandleLock(h)
FntDefineFont(128, gFontPtr);


In AppStop:
MemPtrUnlock(gFontPtr);
DmReleaseResource(MemPtrRecoverHandle(gFontPtr));


Note that you can't specify custom Font IDs for form objects within
Constructor (although PilRC is happy to let you do so).  Also, you can't
dynamically change the font IDs of the following types of form objects (at
least, not in a documented way):
controls
lists
labels

Fields and Tables do have a programmatic, documented interface to change the
font.


Good luck,

Neil, who happens to be working today on a new Font module for the Palm OS
Essentials class
--
Neil Rhodes
Calliope Enterprises, Inc.
1328 Clock Avenue
Redlands, CA  92374
(909) 793-5995     [EMAIL PROTECTED]      fax: (909) 793-2545

----------

--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to