[snip]
>To use the font, you do the following when your application starts...
>
> FontPtr fontCourier;
> fontCourier = MemHandleLock(DmGetResource('NFNT', Courier8));
> FntDefineFont(128, fontCourier);
>
>Of course, you need to check the return code for FntDefineFont. The
>number 128 is the same as the font ID in the resource line. To clean
>things up, do the following when your application stops...
>
> MemHandleUnlock(DmGetResource('NFNT', Courier8));
You'll also want to finish with a call to FntDefineFont(128, NULL),
to clear out the font pointer in the app-defined font table.
Also, a minor note about the code is that in general you want to try
to call MemHandleUnlock and DmReleaseResource on the handle returned
by the original call to DmGetResource. Not that it matters now, but
one could conceive of a time in the future when resource data is
compressed, and thus what you get back from DmGetResource is a handle
to a copy of the data.
-- Ken
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/