Simple Data Field: Uppercase text displayed as lowercase

When outputting a text string with alphabetical characters in a SimpleDataField, a smaller-than-normal font is used and any uppercase characters are converted to lowercase.

e.g. "142 BPM" is displayed as "142 bpm", and the text is much smaller than it needs to be.

I realize that numerical fonts on most devices don't support alphabetical characters, but I have two questions:
1) Why aren't uppercase characters allowed, since it's using a text font anyway?
2) Why isn't a larger text font selected?

Device: FR935
SDK: 2.4.7
  • When the characters that make up the string returned from compute() are numeric ('0'-'9', ':', '.') then we can use the bigger numeric fonts to display them. As soon as you put a non-digit in there, we are forced to use the non-numeric fonts, which are smaller.

    As for seeing uppercase characters being replaced with lowercase, I cannot reproduce this in the simulator or on the device. To test I built a SimpleDataField with the compute() method just returning a string literal..

    function compute(info) {
    return "142 BPM";
    }


    I also made a regular data field that drew the text using the largest font that would support those characters.

    function onUpdate(dc) {
    dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_BLACK);
    dc.clear();

    var cx = dc.getWidth() / 2;
    var cy = dc.getHeight() / 2;

    dc.drawText(cx, cy, Graphics.FONT_LARGE, "142 BPM", Graphics.TEXT_JUSTIFY_CENTER);
    }


    The fonts displayed were the same size, and the text displayed in both cases used uppercase "BMP" as I'd expect. Note that I'm testing with the simulator and the 3.0.4 SDK as well as with the most recent public firmware for the fr935 (11.00).

    When you're seeing this, are you using the simulator or physical device? What layout configurations are you using?
  • Hey Travis.ConnectIQ sorry, the lowercase thing is completely on my end -- I just wasn't thinking. Completely ridiculous... Sorry to waste your time on that one.

    I see the font size thing on both the simulator and the physical device. I think you addressed in a post from a while ago, but even if I use a character supported by numerical fonts such as "/", a text font is still selected. I always use a 4 Field A layout on my 935, but I see the exact same thing with a 1 field layout.

    I don't know, just looking at the sim, the text font looks to be about half the height of the numerical font, in my simple datafield. e.g. Returning 123 vs "123a" in a simple data field. I also see much bigger text fonts in the system menus.

    Looking at UX Appendix for 935, the biggest text font is 41 and the biggest numerical font is 58. I saved screenshots of the two test cases and the actual height of each (in pixels) was 26 and 58.

    I use SDK 2.4.7 for that app (for a few reasons), but I also tried the test case in 3.0.4 and had the same results.

    So I'm not sure what's going on here.

    function compute(info) {
    // See Activity.Info in the documentation for available information.
    //return "123";
    return "123a";
    }
  • I'm pretty sure that this is working exactly as intended.

    The code that draws a simple data field is pretty simple. I'm going from memory here, so this may not be *exactly* what happens, but it will be very close... Anyway, the draw code takes the result of a recent call to compute() and checks the type. If the result is a String, it determines which font to use to render the text. It will try to select the largest font possible given the characters in the string and the draw area reserved for displaying the value. If all of the characters are safe for use with the numeric fonts ('0'-'9', ':', '.'), then the largest numeric font will be tried first. If a character is found that disqualifies the numeric fonts, the largest non-numeric font will be tried first. The system will repeatedly try smaller fonts until the text fits. If it doesn't fit using any font, I believe the smallest font will be used.
  • Sorry for the multiple-post response, I'm fighting the silly forum JSON error issue and I can't paste any code that assigns to a variable right now.

    Anyway, I've attached some code that draws the string "123a" using the largest non-numeric font, and the equivalent using a simple data field and letting it pick the font. See the attached screenshots for comparison.

    You'll notice that the fonts are the same size.community.garmin.com/.../1426926.png
  • Looking at UX Appendix for 935, the biggest text font is 41 and the biggest numerical font is 58. I saved screenshots of the two test cases and the actual height of each (in pixels) was 26 and 58.


    You are counting only the pixels that are black in the captured image, but if you write some debug code that lists the height, you'll see that the font (FONT_LARGE) that displays as 26px tall is actually 41px tall.
  • Travis.ConnectIQ yes, that's pretty silly of me. Obviously fonts don't work that way.

    Thanks for quickly responding and patiently explaining.

    I believe that's the intended behaviour, but there's something I still don't understand.
    I did the following test:

    On a real 935:
    - Took a screenshot a of "HR" in a simple data field, with the label "AppBuilder".
    - Took a screenshot "HR" in the settings menu -- in the name of an activity.

    On a simulated 935:
    - Took a screenshot of "HR" drawn by a simple data field, with the label AppBuilder.

    On the real 935, to the naked eye the data field "HR" is slightly smaller than the settings "HR" -- which is the same size as "HR" in the sim data field. About 31x20 versus versus 34x22. The size of both "AppBuilder" labels, real and sim, were 96x22. Just counting black pixels of course.

    - How is the settings menu displaying a larger "HR" than the data field? Is it using a numerical font that has support for letters? Or is the data field really not using the largest text font, on the real device. To the naked eye at least, there is room for a bigger font.
    - Why is the data field label in the sim identical in size to the data field label in the real device, yet the size of the values are different? (I'm guessing that it's because the size of the label is fixed....)community.garmin.com/.../1426942.png
  • How is the settings menu displaying a larger "HR" than the data field? Is it using a numerical font that has support for letters? Or is the data field really not using the largest text font, on the real device. To the naked eye at least, there is room for a bigger font.

    The system menu isn't implemented using ConnectIQ, so it has access to additional fonts. Sure, there is probably room for larger glyphs on screen, but ConnectIQ only has support for a finite number of fonts.

    Why is the data field label in the sim identical in size to the data field label in the real device, yet the size of the values are different? (I'm guessing that it's because the size of the label is fixed....)

    Yes, the font for the data field labels are fixed. It is *possible* that the font used for the values in the simulator isn't an exact match for the font used by the device. I know we have an issue for font sizes in the simulator not matching several fonts on the edge devices and at least one font on the fenix5-like devices (fr935 may be affected).

    It seems we've ventured far from the original question at this point....
  • Yeah, that's what I would've guessed on both points. Sorry for jumping to conclusions (again) and assuming there were bugs....

    Thanks again!