How come my watch can display Japanese but my widget won't?

Hello!

I just bought my first Garmin watch recently (First Avenger) and I am very happy with it so far.

I like the Japanese language and I couldn't find a "kanji of the day" widget so I figured I'd do it myself (Thanos style). First I wanted to display some Japanese in a widget and see what happened with a basic layout / text

<layout id="MainLayout">
    <label text="は" x="center" y="center" font="Gfx.FONT_LARGE" color="Gfx.COLOR_WHITE" justification="Graphics.TEXT_JUSTIFY_CENTER"/>
</layout>

// Load your resources here
function onLayout(dc as Dc) as Void {
    setLayout(Rez.Layouts.MainLayout(dc));
}

Unfortunately this displays an invalid "box" character:

What really bugs me is that my watch can definitely display Japanese for example in notifications, messages/emails, media player etc. I cannot imagine that all these widgets include a custom font right? Does anyone know how come they can display Japanese? (I am exploring the custom font idea but it takes a lot of memory even with the bare minimum characters so I am hoping I can avoid it)

On a side note, is there any way to change the size of the text without changing fonts? setSize on a text drawable doesn't seem to have any effect.

  • Have you added Japanese as a language for your widget?  Do you have a resource override for strings you use?

    See https://developer.garmin.com/connect-iq/core-topics/resources/#strings

  • No I had not added the Japanese as a language... However I just tried it and it doesn't change the outcome unfortunately

    <iq:languages>
        <iq:language>eng</iq:language>
        <iq:language>jpn</iq:language>
    </iq:languages>

    I do not use resource overrides, my understanding was that it was to override resources for specific languages but that otherwise it would use the default resources. I quickly tried to rename my resources folder to resources-jpn but the simulator didn't start (I think it needs a resources folder).
  • Take a look at the strings example in the SDK.  It will show you how this works.

  • I am not quite sure I see how to use this information.

    My understanding of the localization qualifiers (which I assume is what you mean by "resource override"?) is that it's a way to tell the watch to use a different set of resources depending of the language of the watch. In my case I will set the text by code eventually and I want it to display the text in Japanese for all languages (my watch is in English for example).

  • That probably won't work, as when the watch is set for english, you won't have the japanese characters in the native fonts,  What you'll need to do is develop a custom font with the characters you need and have the strings you want displayed in resources and then you just keep everything english and you don't need the resources with the jpn qualifier.,

    Only when the watch is set for japanese will the native fonts have those characters.  In fact, on many devices, there are world-wide versions and apac (Asian Pacific) and only the APAC version would have japanese even in native fonts or be a language you can pick,

    In your first screen shot, that box with the X in in indicates you are trying to display a character that's not in the font you are using.  

  • Thanks yes that was my understanding indeed. However that brings me back to my initial question: how come the notifications / media player etc. can display the text in Japanese without any issue on my watch?

    I am prepared to use a custom font but as I mentioned it takes a lot of memory even with the minimum number of characters and a small(ish) font size (64) so I was hoping I could avoid it.

  • for the things you mention, it could be only some fonts, or a font that isn't available in CIQ if the watch is set for English.  If you want itr to be Japanese on all devices, you want to consider a custom font.

    I think it's the Venu 2 where there are cases where jpn can be used in some things like texts, but it's not all devices or for all things.

  • every part number has it's own font, so e.g. venu

    https://developer.garmin.com/connect-iq/reference-guides/devices-reference/#venu%E2%84%A2

    art Number 006-B3389–00

    Languages

    jpn

    Fonts

    FONT_XTINY Noto Sans CJK JP Bold 33 NOTO_SANS_CJK_JP_BOLD_33

    s

  • So you mean to say it's possible for Garmin's widget to use fonts that are not available in CIQ?

    But yeah I think in the end of the day... I have to use a custom font. I'll probably make it a bit smaller because I need memory to load the json (which I already figured that I will have to cut in pieces and only load a piece at a time).

    Do you know if it is possible to show a text bigger than the font size? I would like in the first view to show the kanji with a big size but I cannot afford a big font (64pt was already close to the limit)

  • Interestingly on my watch I cannot set the language to Japanese, yet it can display it ^^