The display fonts in the display components have a few fonts that only show numbers.
Is it possible to add a comma or a point to these "number fonts" so they could show a float-like number?
Thanks..
Floats as "number font" on display
-
- Posts: 286
- http://meble-kuchenne.info.pl
- Joined: Tue Dec 08, 2020 5:11 pm
- Has thanked: 81 times
- Been thanked: 60 times
-
- Matrix Staff
- Posts: 1901
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 494 times
- Been thanked: 668 times
Re: Floats as "number font" on display
Hello,
The Calibri Black Number and Fixed Number fonts include ASCII 43 to ASCII 58 and so should allow you , and . characters, looks like it's just the Verdana Number font that's more limited at ASCII 48 to ASCII 58.
I'll have a look and see how easy it would be to add the extra characters
The Calibri Black Number and Fixed Number fonts include ASCII 43 to ASCII 58 and so should allow you , and . characters, looks like it's just the Verdana Number font that's more limited at ASCII 48 to ASCII 58.
I'll have a look and see how easy it would be to add the extra characters
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Matrix Staff
- Posts: 1901
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 494 times
- Been thanked: 668 times
Re: Floats as "number font" on display
I've had a go and pushed a new version of the font component to the library update system, hopefully Verdana Number should now have all the characters shown above to match the other Number fonts.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Re: Floats as "number font" on display
Thanks BenR!
How can I print a number like 20.4 to the display?
Do I need to cut the 20 and the 4 and add a comma between them?
Then I need to calculate the position for the comma?
Or is there a better trick?
Now I use the printnumber macro for the SSD1306 OLED. But I I use a number like 20.4 it isn't displayed.
How can I print a number like 20.4 to the display?
Do I need to cut the 20 and the 4 and add a comma between them?
Then I need to calculate the position for the comma?
Or is there a better trick?
Now I use the printnumber macro for the SSD1306 OLED. But I I use a number like 20.4 it isn't displayed.
-
- Matrix Staff
- Posts: 1901
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 494 times
- Been thanked: 668 times
Re: Floats as "number font" on display
Hello
You should be able to use the float to string function in the calculation icon. The parameters are the floating point number , the number of decimal places.
E.g.
Str = floattostring$(float, 1)
Then print out the str as you would normally print out a string.
Let us know how you get on.
You should be able to use the float to string function in the calculation icon. The parameters are the floating point number , the number of decimal places.
E.g.
Str = floattostring$(float, 1)
Then print out the str as you would normally print out a string.
Let us know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Re: Floats as "number font" on display
Great BenR
This works!
But for me this is very confusing..
If you don't know this trick I wouldn't be able to figure this out.
A font, special for numbers, that uses a string to show a few characters...
Why not build this feature in the print number feature of the component?
But, thanks again for pointing me to this workaround.
This works!
But for me this is very confusing..
If you don't know this trick I wouldn't be able to figure this out.
A font, special for numbers, that uses a string to show a few characters...
Why not build this feature in the print number feature of the component?
But, thanks again for pointing me to this workaround.
-
- Matrix Staff
- Posts: 1901
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 494 times
- Been thanked: 668 times
Re: Floats as "number font" on display
Hello,
Print number should also work fine but only works with integer numbers. I could maybe look at adding a print float macro to the graphical displays like we have for the alphanumeric displays.
Print number should also work fine but only works with integer numbers. I could maybe look at adding a print float macro to the graphical displays like we have for the alphanumeric displays.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel