We use Graphics.StringWidth in many places to determine the required Width of Controls (and re-arrange the Layout according to that).
This works fine on macOS and Windows (up until Xojo 2016r3).
With Xojo 2016r4 and newer (probably because of the new Graphics Framework Direct2D/DirectWrite), this causes the following issues:
- The Font used in Controls is NOT the same as in Graphics (Canvas)
Which leads to the issue that:
2) Graphics.StringWidth can’t be used for determining the mininum required width of the Control
With Font “System 11”:
ScaleFactor 2.5: Graphics.StringWidth is too big (compared to assigning that Font/Size to a Control)
ScaleFactor 1.0: Graphics.StringWidth is much too small (compared to assigning that Font/Size to a Control)
While I’ve reported what I see here: <https://xojo.com/issue/51032>
I’m curious to know if there are any workarounds?
Or does anyone know what’s going on? What are the differences of Fonts in Controls and Graphics? Is there some way to calculate the differences between them?
Or do i need to respect some other settings of the Control (e.g. CharacterSpacing) when trying to get the exact same Font in a Graphics?