Simulator: Custom font error for some devices

Dear all
When I lunch the simulator for some devices, the Eclipse console show the message:
BUILD: ERROR: Invalid resource 'timeFnt' in attribute 'font' for resource id 'TimeLabel'. Use formats: Gfx.FONT_<font id>, Graphics.FONT_<font id>, Toybox.Graphics.FONT_<font id>, a valid resource reference.
BUILD: Complete
Aborting launch due to failed build.


It happend only for some devices (for example fenix 3 and fenix 5 series, vivoactive 3). For other devices (for example vivoactive and forerunner series) on the contrary all works fine. Could you help me to fix the bug?

from layout file:
<layout id="WatchFace">
...
<label id="TimeLabel" x="145" y="20" font="@Fonts.timeFnt" justification="Gfx.TEXT_JUSTIFY_CENTER" color="Gfx.COLOR_YELLOW" />
...
</layout>

from resources file
<resources>
<fonts>
<font id="timeFnt" filename="Niagara82.fnt" />
</fonts>
</resources>

Connect IQ SDK 3.0.7
Eclipse Oxygen.2 Release (4.7.2)

Thank in advance

Marco
  • Are you using jungles or resource overrides, where what you have for <fonts> isn't included it ithe build? That would explain why it's some targets and not others.
  • Except that a missing resource (with valid syntax) seem to produce a different error message.

    BUILD: ERROR: An undefined resource reference was detected during resource processing: @Fonts.timeFnt.

    Something else seems to be going on here.

    What happens if you just build a sample project with almost nothing but the resources you posted above?
  • Dear all
    Solved :) ! there was a resources overriding.
    Thanks to all for your quick support

    Marco
  • Does anyone know how to use CustomFont in newer versions? All instructions and online help are quite outdated, and it seems that the old syntax no longer works.

    The content of the non-working state:

    layout.xml:

    <layout id="WatchFace">
    <label id="HourLabel" x="147" y="center" font="???" justification="Graphics.TEXT_JUSTIFY_CENTER" color="Graphics.COLOR_RED"/>
    </layout>

    fonts.xml:

    <resources>
    <font id="CustomFont" filename="/fonts/customFont.fnt" />
    </resources>

    I have also tried using .ttf, .otf, .fon, and .fnt formats, but it always returns the following error:

    Unable to process ‘font’ resources: “Program” is not a valid key/value pair.

    How are custom fonts used in API 5.0.1?

    Thank you.

  • In the layout use font="@Fonts.name" 

    and in the fonts file use 

    <font id="name" filename="name.fnt" />

    with the files font.xml, name.fnt and name.png in the same resource/font folder