Method to get the list of available fonts on a device

Since the UX Guide seems to be out of date and it doesn't include font specifications for the Edge 1030 and Edge 130 I was wondering if there is any way to get the list of available fonts and sizes using Monkey C directly.

At least in the SIM using the Edge 130 some font sizes look exactly the same (ie: TINY and XTINY) and with other sizes the SIM just crash with an error that the font is not found as you can see in the screenshot attached.

Any ideas on how to get the list programatically? community.garmin.com/.../1460759.png
  • You can put together a simple app, and displays each font as well as it's height, etc.

    You got the text fonts - FONT_* and the number fonts - FONT_NUMBER_*. They're listed in the API guide under Graphics.

    and things like dc.getFontHeight() for the height

    On some devices, XTINY and TINY might be the same height, but TINY is bold while XTINY isn't
  • Thanks but I was thinking about some way to just get the list of available fonts on the device. Anyway as with other things that are not well documented across the SDK the Devices.xml file is probably the best source for this kind of device specific information (ie: device qualifiers).
  • While you can get some info from devices.xml, you may find that putting together a simple app gives you more. For example, if the name of a font in devices.xml indicates it's x pixels high, what you wont see is possible white space above/below the characters. Number fonts on something like a fenix 3 are a good example where this comes into play.

    Here's the basic function I use in a test app to get a better visual of a font, where I draw a line above and below a font, so see the possible white space, as that comes into play if you are doing direct dc calls and using the height for spacing.

    function doFont(dc,x,y,font,str) {
    dc.drawLine(0,y,width,y);
    dc.drawText(x,y,font,str,Gfx.TEXT_JUSTIFY_CENTER);
    var x2=x+dc.getTextWidthInPixels(str,font)/2+5;
    var fh=dc.getFontHeight(font);
    dc.drawText(x2,y+fh/2,Gfx.FONT_XTINY,""+fh,Gfx.TEXT_JUSTIFY_LEFT|Gfx.TEXT_JUSTIFY_VCENTER);
    y=y+fh;
    dc.drawLine(0,y,width,y);
    return y;
    }
  • I use this app to collect font data. It will dump a csv of the height/ascent/descent values for the fonts that the simulator uses to the console (if you're using the simulator) or the application log file (if you're running on a device and have created the file). This data can be used to check how close the simulator fonts are to those used by the device.
  • Which app is "this app" ?  Thanks

  • I think it got lost when the forums changed a few years back.  The code I post back then is really the basis for what I do in an app that shows this.  The two largest number fonts on a va4 and the text fonts: