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”.