Where is this documented? How is people supposed to guess this?
jim_m_58I really appreciate the time you put on building the example, but my complain is not about if it is difficult or not to use custom fonts or to create them.
My complain is about the documentation…
I have tried several of these approaches by mimicking a few of the example templates, but none of them were successful.
If you use layouts, you should be able to specify the font using the id, but I can't find an example. The programmers guide says this:
"Graphics font constant or the ID of a user-defined font"
<label id="TimeLabel" x="113" y="63" font="@Fonts.font" justification="Gfx.TEXT_JUSTIFY_CENTER | Gfx.TEXT_JUSTIFY_VCENTER" />
I have tried several of these approaches by mimicking a few of the example templates, but none of them were successful.
Actually, since the docs got reorganized, I'm not sure.
Here's a video Petr Koula (the guy that wrote Actiface) did years ago
https://www.youtube.com/watch?v=PRQyA4BeqqE
and in the FAQ doc in the SDK, there's a writeup of some font tricks that was written by Hermo T (NoFrills)
Several example programs included with the SDK demonstrate, and the How Do I Use Custom Fonts FAQ covers it fully as well. As jim_m_58 mentioned, the Programmer's Guide was recently rewritten so things have moved around a bit. There is a section on creating your own fonts here, and examples of using WatchUi.loadResource() or font references are scattered throughout.
Sorry, but the FAQ should not be a place to search for SDK reference/specs. Even if it is, there is no mention about the thing I was asking about, which is the "[email protected]_konqa32_hd" bit. Not in the FAQ nor in the video.
I'm not meant to be rude, but Garmin documentation is terrible, and I don't know how many developers have managed to create so many great watchfaces.
Everytime you need something a bit out of the standard you have to dig on the forums and expect that the answers there still hold (some of them are as old as 5 years)
I put together this sample in a few minutes. It's really not that complex to do.
I used BmFont and a font I had called "chiller". I set the height to be 45 pixels, and set the export to be "png", and saved it under resources>fonts.
Then with simple code, I use it to display the time.
in fonts.xml there is this:
<font id="c1" antialias="true" filter="0123456789:" filename="chill.fnt"/>
and then to use it, see line where I load the font
myFont=WatchUi.loadResource(Rez.Fonts.c1);
and to display the time using that font,
dc.drawText(width/2,height/2,myFont,timeString,Gfx.TEXT_JUSTIFY_CENTER|Gfx.TEXT_JUSTIFY_VCENTER);
if you comment out line 14 in customView.mc it will use a standard font