Fonts not working with tag expressions?

I’m making a simple tag expression to change my battery level text color with battery percentage. The tag expression works fine with syncing font to device, and a couple of other stock fonts in GWS. But some of the standard fonts in GWS don’t work, nor do custom imported fonts. What happens is that with those fonts the opacity isn’t set to zero when the tag expression is false.

Here are my tag expressions that I use to cycle 4 different colors, each applied to a different text/battery percentage:
[ba] >= 80? 100: 0
([ba] >= 41) * ([ba] <= 79)? 100: 0
([ba] >= 20) * ([ba] <= 40)? 100: 0
[ba] >= 20? 0: 100

So for example if I use sync to device, or a font such as Watch Applemint then the code works perfectly. If I load a custom .ttf or if I use a font such as WatchSNum-3L then the opacity isn’t set to 0 when condition is false, it just stays lit regardless of battery percentage.

There was this thread about it in the past. I have such problem with some of my added fonts too. I thought it settled with PC restart, but its still there. To me these fonts do not obey opacity setting, even when I try to set it directly with slider, not only by expressions. The one that is not working for you, works well for me. Did not try it on watch yet.


I tried to check the opacity in the .gwd file it self, but could not find it in the contained .xml files. I wonder where it hides.

Be sure your custom fonts are TTF and not OTF Galaxy Watch Studio won’t work with OTF fonts.

Peter the font setting is watchface.xml

Ron
Samsung Developer Program

Yes Ron, watchface.xml is where I done the screen shot, but I see no opacity among other properties. Yet it has to be stored somewhere.

All the TTF fonts I’m using have had this opacity issue.

HI Peter,
All the expressions show here clock and text boxes. perhaps you hadn’t saved it yet?

<?xml version="1.0" encoding="UTF-8"?>

-<watchface width="360" version="2.0.0" screen_type="1" schema_version="1.5" name="watchface.xml" height="360" device_name="Gear S3, Gear Sport, Galaxy Watch, Galaxy Watch Active">


-<root width="360" height="360" y="0" x="0" type="normal">

<digitalclock width="220" height="70" y="138" x="67" text="HH : mm : ss" style="0" size="40" r="255" locale="en_US" id="Digitalclock 1" g="255" font_name="WatchSNum-3L" default_locale="en_US" custom_font="true" bitmap_font="false" b="255" alignment="16777216" a="expr_([ba] >= 41) * ([ba] <= 79)? 100: 0"/>

<text width="202" height="70" y="272" x="79" text="Batter Low" style="1" size="50" r="255" locale="en_US" id="Text 1" g="255" font_name="WatchSNum-3L" default_locale="en_US" custom_font="true" bitmap_font="false" b="255" alignment="16777216" a="expr_[ba] >= 20? 0: 100" source="none"/>

<text width="296" height="70" y="207" x="32" text="Less Than 40" style="1" size="50" r="255" locale="en_US" id="Text 2" g="255" font_name="WatchSNum-3L" default_locale="en_US" custom_font="true" bitmap_font="false" b="255" alignment="16777216" a="expr_([ba] >= 20) * ([ba] <= 40)? 100: 0" source="none"/>

<text width="296" height="70" y="74" x="35" text="Less Than 80" style="1" size="50" r="255" locale="en_US" id="Text 3" g="255" font_name="WatchSNum-3L" default_locale="en_US" custom_font="true" bitmap_font="false" b="255" alignment="16777216" a="expr_([ba] >= 41) * ([ba] <= 79)? 100: 0" source="none"/>

<text width="202" height="70" y="26" x="75" text="Batter Full" style="1" size="50" r="255" locale="en_US" id="Text 4" g="255" font_name="WatchSNum-3L" default_locale="en_US" custom_font="true" bitmap_font="false" b="255" alignment="16777216" a="expr_[ba] >= 80? 100: 0" source="none"/>

</root>

</watchface>

Ron
Samsung Developer Program

1 Like

Hi Spi,

I can’t duplicate this what version of GWS are you using and is this a new project or an updated project?

Ron
Samsung Developer Program

Thanks Ron, now I understand, there are the r, g, b values and the the “a”.

Sorry for the very late response, but I was just playing around with this again today. This is on GWS 2.0.0 beta and it’s the same if it’s a new project or if I’m updating an existing one. I’ve made sure I’m using TTF fonts. I’ve found that all of the stock fonts work, but the custom fonts I’ve imported do not work.

Also if I’m using a stock font that does work, if I adjust the opacity slider it seems this breaks something and then that stock font won’t work anymore and I have to delete and reload my custom complication.

Are you doing this on a watch or in GWS. BA can’t be zero but that is not the issue. :slight_smile:

There is at least one complication that I know of that appears in the AOD watch when you add it to the Active Watch. Check and see if that is happening to your custom complication. If that is the case remove it and see if that matters.

It is really hard to tell if the complexity of your complication is a problem, or if there is an issue with GWS. It should work with the GWS Fonts.

Can you give more information?

Ron
Samsung Developer Program

Well that’s interesting. I am experiencing this in GWS, but I did not think to upload to the watch and check there. I just uploaded it and the complication seems to work on the watch even with a custom font, although it’s hard to test because I have to wait for the battery to change. But at least at 77% it’s showing as blue, which is correct in how I coded the complication. In GWS it just stays green no matter what the battery is reported at.

On GWS, as I mentioned before, the complication works just fine with the stock GWS fonts. It’s when I use custom fonts in TTF format that they don’t work, at least in the GWS program. If you want to test this then download a TTF file and apply it to my complication and see if the opacity doesn’t change.

Just curios as to what happens if you use the Battery % in the time line to show and hide the images instead of tag expressions. Does the custom fonts work then or is it the same behavior.

Ron
Samsung Developer Program

1 Like

Yes I just discovered this ability today, making me realize my complication doesn’t even need to exist. Using the battery timeline it works perfectly with the custom fonts. Thanks for the help.

If it works with the Battery % timeline then this is most likely a memory issue of the GWS program.

Ron
Samsung Developer Program