06-25-2018 15:14
06-25-2018 15:14
I am referring to the width when drawn, e.g. how wide will "ABC" be if rendered in 40 point System font?
The solutions that I found online don't apply to FitBit OS's simplified SVG.
Thanks,
Florin
Answered! Go to the Best Answer.
Best Answer06-29-2018 13:03
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
06-29-2018 13:03
You can't, but you can get the width of the text element, using yourElement.getBBox().width
06-29-2018 13:03
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
06-29-2018 13:03
You can't, but you can get the width of the text element, using yourElement.getBBox().width
03-11-2022 16:05
03-11-2022 16:05
I would like to mention when using fitfont it is possible to get the actual width of the label just by accessing the width property:
const someLabel = new FitFont({ id: "someLabel", font: SmallFont, halign: "start"});
someLabel.text = "short";
console.log("Width: " + someLabel.width);
someLabel.text = "more text";
console.log("Width: " + someLabel.width);
Pretty neat and convenient to be honest:
[01:01:48]Width: 95 app/index.js:216,1
[01:01:48]Width: 165 app/index.js:218,1