SDK 2.4.1 - Custom fonts

Hello.
I do watchface with non-standard font.
On version 2.3.* I did this:


layout.xml
<layout id="WatchFace">
<drawable class="Background" />
<label id="TimeLabel" x="center" y="center" font="customFont" justification="Gfx.TEXT_JUSTIFY_CENTER" color="Gfx.COLOR_BLUE" />
</layout>


fonts.xml
<fonts>
<font id="customFont" filename="custom.fnt" filter="0123456789:" />
</fonts>


WatchFace_test2View.mc
// Load your resources here
function onLayout(dc) {
var customFont = Ui.loadResource(Rez.Fonts.customFont);
}


But on version 2.4.1 it does not work anymore, such an error:

BUILD: C:\Program Files\Java\jre1.8.0_151\bin\java -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar D:\eclipse\connectiq-sdk-win-2.4.1\bin\monkeybrains.jar -o D:\workspace\WatchFace_test2\bin\WatchFace_test2.prg -w -y D:\workspace\developer_key -f D:\workspace\WatchFace_test2\monkey.jungle
BUILD: ERROR: Invalid resource 'customFont' 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



How to do it right?
  • layout.xml
    <label id="TimeLabel" x="center" y="center" font="customFont" justification="Gfx.TEXT_JUSTIFY_CENTER" color="Gfx.COLOR_BLUE" />



    When specifying the font for a label in layouts you still need to reference the id inside the Rez module. "customFont" should instead be "Rez.Fonts.customFont".