[Extension Tools] [Feature Request] Add symbols for repeating decimals to "Customize Format Label"

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
ToniTen
Posts: 240
Joined: Fri Sep 04, 2020 10:11 am

[Extension Tools] [Feature Request] Add symbols for repeating decimals to "Customize Format Label"

Post by ToniTen »

This Extension Tool is fantastic, but it can be improved. Right now, when a given number has repeating decimals, there's no way to mark that on FreeCAD. Unfortunately, the way to represent this depends on the locale, and even inside a given locale, there might be different ways to do so [See this article on the Wikipedia]. Still, having a way to easily add the required symbols could be really helpful. So far, I'm resorting to using Inkscape to modify the exported document and add the horizontal line over the digits, since I could not figure what the right Unicode combining character is the right one.

As for how I expect this to work, I expect this to be added manually, via changing the dimension to "arbitrary=true" and then putting the symbol over the right decimals, I don't expect FreeCAD to go looking for repeating decimals and adding the symbol automatically.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: [Extension Tools] [Feature Request] Add symbols for repeating decimals to "Customize Format Label"

Post by chrisb »

ToniTen wrote: Tue Aug 16, 2022 11:00 am Right now, when a given number has repeating decimals, there's no way to mark that on FreeCAD.
And there is no way for FreeCAD to decide if such a representation exists, because it relies completely on the computers internal representation of numbers and that is always finite.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
ToniTen
Posts: 240
Joined: Fri Sep 04, 2020 10:11 am

Re: [Extension Tools] [Feature Request] Add symbols for repeating decimals to "Customize Format Label"

Post by ToniTen »

chrisb wrote: Tue Aug 16, 2022 11:27 am And there is no way for FreeCAD to decide if such a representation exists, because it relies completely on the computers internal representation of numbers and that is always finite.
Which is why this is added to arbitrary dimensions, not to the values that FreeCAD adds by default
User avatar
wandererfan
Veteran
Posts: 6265
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Extension Tools] [Feature Request] Add symbols for repeating decimals to "Customize Format Label"

Post by wandererfan »

ToniTen wrote: Tue Aug 16, 2022 11:00 am As for how I expect this to work, I expect this to be added manually, via changing the dimension to "arbitrary=true" and then putting the symbol over the right decimals, I don't expect FreeCAD to go looking for repeating decimals and adding the symbol automatically.
Using U305 - Combining Overline looks terrible in both the property editor and the page. If the font doesn't have glyphs for overlined digits, we'd have to draw the overline as a graphic and align it with the text to make it look right. That's a lot of coding.
repeating3.png
repeating3.png (4.03 KiB) Viewed 698 times
repeating3_propEditor.png
repeating3_propEditor.png (16.3 KiB) Viewed 698 times
ToniTen
Posts: 240
Joined: Fri Sep 04, 2020 10:11 am

Re: [Extension Tools] [Feature Request] Add symbols for repeating decimals to "Customize Format Label"

Post by ToniTen »

wandererfan wrote: Tue Aug 16, 2022 5:28 pm Using U305 - Combining Overline looks terrible in both the property editor and the page. If the font doesn't have glyphs for overlined digits, we'd have to draw the overline as a graphic and align it with the text to make it look right. That's a lot of coding.
So no unicode magic to save the day. I expected this to be just a matter of having the right unicode combining characters added, but that looks terrible. I assume it's a font issue?
User avatar
wandererfan
Veteran
Posts: 6265
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Extension Tools] [Feature Request] Add symbols for repeating decimals to "Customize Format Label"

Post by wandererfan »

ToniTen wrote: Wed Aug 17, 2022 7:39 am So no unicode magic to save the day. I expected this to be just a matter of having the right unicode combining characters added, but that looks terrible. I assume it's a font issue?
The graphic display above is using osifont, the PropertyEditor is using a different font, but I don't know which one. Things are a little better with a fixed width font (Monospace here), but still not great.

I guess we could customize a font to included overlined digits, but then you'd be limited to the custom font.
Attachments
repeating3_monoSpace.png
repeating3_monoSpace.png (12.88 KiB) Viewed 588 times
ToniTen
Posts: 240
Joined: Fri Sep 04, 2020 10:11 am

Re: [Extension Tools] [Feature Request] Add symbols for repeating decimals to "Customize Format Label"

Post by ToniTen »

wandererfan wrote: Wed Aug 17, 2022 2:08 pm The graphic display above is using osifont, the PropertyEditor is using a different font, but I don't know which one. Things are a little better with a fixed width font (Monospace here), but still not great.

I guess we could customize a font to included overlined digits, but then you'd be limited to the custom font.
I have no idea if it's feasible, but could it be possible to customize OSIFONT, and sent the changes upstream? I mean, OSIFONT is a free and open source font right?

EDIT: Just checked the repository for upstream OSIFONT and it seems like development is ongoing, so I guess it would be feasible to try to send patches to make these combining characters work (I unfortunately have zero idea on how to edit a font)
Post Reply