[Possible bug] Vertical Dimensions do not appear centered by default

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Syres
Veteran
Posts: 2898
Joined: Thu Aug 09, 2018 11:14 am

Re: [Possible bug] Vertical Dimensions do not appear centered by default

Post by Syres »

edi wrote: Thu Jan 20, 2022 9:09 am Could we install a general function "getFontSize" somewhere ? In DrawUtil ? The situation of calculating the vertical midposition occures often.
That's definitely one for @wandererfan, I'm just the Windows user who is trying to learn C++ (and not very well I may add).
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Possible bug] Vertical Dimensions do not appear centered by default

Post by wandererfan »

Initial vertical position using center of text implemented by git commit cf5a14bc.
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Possible bug] Vertical Dimensions do not appear centered by default

Post by wandererfan »

edi wrote: Thu Jan 20, 2022 9:09 am Could we install a general function "getFontSize" somewhere ? In DrawUtil ? The situation of calculating the vertical midposition occures often.
The font size in mm is available from TechDraw Preferences:

Code: Select all

# include <Mod/TechDraw/App/Preferences.h>

    double fontSize = Preferences::dimFontSizeMM();
    dim->Y.setValue(-mid.y + 0.5 * fontSize);
Were you looking for a Python function?
edi
Posts: 481
Joined: Fri Jan 17, 2020 1:32 pm

Re: [Possible bug] Vertical Dimensions do not appear centered by default

Post by edi »

Thank you. That is exact what I was looking for.
Post Reply