Community Project: Minimum chars to display multi-language dates using custom fonts

Background:
Inside a CIQ app, date information like month and day-of-the-week names are automatically translated to the selected device language (set by the user when first setting up a device).
When using the built-in fonts available in CIQ, these names are correctly displayed.
Garmin already has all the required characters for languages built into these fonts.

Problem:
When using a custom font, it is the developer's responsibility to ensure that the correct set of characters for a particular language is included in the font.
The problem is that it is difficult to know which characters are required for all the different languages supported by Garmin.
As far as my knowledge stretches, there is no specific documentation that supplies information about the minimum set of date related characters per language.

In the past I tried to import all characters from a computer font file, but always ran into out of memory issues. Obviously the majority of these characters are not needed for dates.

The workaround is to
  • either force the display of date related names to a subset of languages that you choose to support for your app,
  • or to resort back to using the built-in fonts in CIQ.
Unfortunately I ran into a scenario where the size of the built-in fonts provided on the fenix5 and 935 watches are just not working for me.
TINY and XTINY for example are just not tiny enough to my liking.
So I would like to build my own real tiny font for these devices, but still be able to display dates in any of the Garmin supported languages.

I'm sure most of us have run into this issue at some point, but either have too little information or time to sit and build a complete set of characters required to achieve the same result as built-in fonts.

Things to be considered:
  • Displaying of both long and short names. Would be great if we could indicate which characters are sufficient for short names only, and which characters should be included to display full names (e.g. Mon vs Monday and Dec vs December). This way developers choosing to display short names can build a smaller font, but when deciding later to display full names, they know which characters to include.
  • The same for casing, it would be great knowing the uppercase vs lowercase set of characters, for example if you choose to display short names starting with uppercase followed by lower case, as opposed to showing everything in all lower case or all upper case.
Examples:

English short names:
Mon
Tue
Wed
Thur
Fri
Sat
Sun

a,d,e,F,h,i,M,n,o,r,S,t,T,u,W (the only characters required to display short English day-of-the-week names)

English full name as an extension to short names:

[Mon] day
[Tue] sday
[Wed] nesday
[Thur] sday
[Fri] day
[Sat] urday
[Sun] day

s,y (the only characters required to to display full English day-of-the-week names)

Request:
I cannot do this on my own, and would like to know if there would be interest to help contribute towards this as a community / open source project?
This way developers with knowledge about different languages can easily contribute and the workload be spread more evenly.
I am hoping to set up a public github project with some structures and guidelines about how to contribute.
For those not knowing github, I would be willing to receive emails or forum post with details of your particular language contributions and then work that into the open source project.
It all depends on the interest and willingness of others to contribute whether I will start a project of this magnitude.

Please respond with some ideas and suggestions and wether you are interested or you think it might not be worth it?
  • Hello HermoT,

    I recently found that there are language files on the watch that contain all expressions used.
    On my vaHR in folder Garmin --> TEXT there are eleven language files with extension .LN2
    The files each contain a string identifier and the corresponding value per line separated by one tab.
    Copy files to your local drive. You can open them with a texteditor or import them into a spreadsheet using tab separation.
    You can then search in each file using same identifier to get the expressions for each language.
    For example: TXT_MAR_STR_M is id for short of March, TXT_Wed_STR_M is id for short of Wednesday...

    There are no APAC, eastern Europe, Russian, and so on language files on my vaHR though. Maybe other user can provide them.
  • Thanks Markus! This is an awesome suggestion! Going to try that!
  • I have also hit this issue for the same reason. I needed a smaller font than tiny and xtiny on the f5 after writing a widget on the f3 and finding the fonts larger on the f5. I used a custom font to get the text small enough and then got reports of missing characters. Until the reports, I was not aware that the watch displayed dates in a local language despite my only providing English.

    Looking at f5 text files, these are .ln3 rather than .ln2 and do not have the useful identifiers such as TXT_Wed_STR_M. However, there is a numeric identifier which seems consistent across the language files. e.g. 01375 seems to be Tuesday. I guess it would be a lot of work even with this to determine all the possible characters and ensure that my custom font has these available for all languages. I have not fully decided what to do but had been thinking I'd switch to displaying the dates in English using my own code. Given the rest of the text is in English, this seemed the best short term solution at least.

    It would be nice if Garmin could provide developers with a wider range of font sizes (as a custom font, not on the devices) for each device that we could use in our apps. This would overcome the issue of licensing some of us are concerned about too. Even better if they documented what characters were used in system text such as dates we should include as a minimum or provide a mechanism for these to be automatically included from a custom font.
  • Yes I also noticed the ln3...probably referring to 3rd generation translation file.
    Was easy to find the corresponding codes for the desired names.
    I am already busy building the charset as we speak and will share it once it is done.
  • I achieved success with this project, and it was fun:
    I downloaded the *.ln3 translation files from my 935 to my laptop.
    Then I wrote an app to process each file by extracting the relevant lines containing day and month names (both short and long).
    From this I then compiled the minimal set of characters and wrote them to a file.
    Now every time I'd like to create a custom font in BMFont, I only need to click Edit > Select chars from file....and presto!
    If a font does not contain any of the chars in the char-set file, BMFont reports that. This way you know if your font will support all Garmin supported languages.

    Known issue: There is currently no support for APAC languages at this point.
    I will need some help from the community regarding this.

    This is the list of languages for which I successfully managed to extract the required char set:

    arabic
    brazilia
    croatia
    czech
    danish
    dutch
    english
    finnish
    french
    german
    greek
    hebrew
    hungaria
    italian
    norwegia
    polish
    russian
    slovakia
    slovenia
    spanish
    swedish

    The resulting font image is surprisingly small:


  • I guess the next step would be to automatically generate language resources in my CIQ project and set the list of filtered characters for each language.
  • Holy cow! Somebody else is interested in i18n.
    https://forums.garmin.com/forum/developers/connect-iq/144175-
    HermoT, if you need help with Cyrillic and Russian, I can help you, among with the translations all your apps.
  • Would you mind making your file you use to select from in BMFont available?
  • gasteropod I will in due course...just need to clean up some stuff! ;)

    a1234.garmin Oh wow, didn't see that post! Will check it out a bit and thanks for your offer to help. Might ask you to help verify that the Cyrillic and Russian for dates are correct once I post it here.
  • Here is the text file as requested.
    This is the char set for:
    • Short day-of-the-week names (Mon, Tue)
    • Long day-of-the-week names (Monday, Tuesday)
    • Short month names (Jan, Feb)
    • Long month names (January, February)
    • Languages:
      • arabic
      • brazilia
      • croatia
      • czech
      • danish
      • dutch
      • english
      • finnish
      • french
      • german
      • greek
      • hebrew
      • hungaria
      • italian
      • norwegia
      • polish
      • russian
      • slovakia
      • slovenia
      • spanish
      • swedish

    In BMFont select
    Edit > Select chars from file
    and point it to this file.

    If the selected font does not contain any of the chars in the file, BMFont will report that. Then you know you need to find a different font that has support for all chars.
    My favorite font is Tahoma and it supports all chars.

    EDIT
    ====
    I forgot to include the chars 0-9
    So remember to select them in BMFont, or add them to the char-set file for completeness.