Recent

Author Topic: Moving from Windows to Linux (RPi) - texts do not fit  (Read 931 times)

BosseB

  • Sr. Member
  • ****
  • Posts: 484
Moving from Windows to Linux (RPi) - texts do not fit
« on: April 30, 2020, 07:05:18 pm »
I have moved a test project from Windows to Raspbian Linux on RPi4.
It compiles fine on RPi but the window shown uses a very different font size than the default on Windows so the text does not fit inside the controls....

What is the proper way to ensure that a GUI project will work in both environments so that the GUI looks the same?

FPC 3.0.4 Lazarus 2.0.8 on both platforms.
No specific configuration regarding fonts or such done, all is out of the box Lazarus.
--
Bo Berglund
Sweden

af0815

  • Hero Member
  • *****
  • Posts: 1409
Re: Moving from Windows to Linux (RPi) - texts do not fit
« Reply #1 on: April 30, 2020, 10:22:26 pm »
I know it, but you can only make a calculation of the real fontsize on the system. The size depend on the system and widgetset. gtk and qt can also differ.
regards
Andreas


BosseB

  • Sr. Member
  • ****
  • Posts: 484
Re: Moving from Windows to Linux (RPi) - texts do not fit
« Reply #3 on: May 01, 2020, 12:26:13 am »
If I set the font size of the form holding the other components to something other than default, like 8, then the font shrinks to fit within my controls.
The test program was written on Windows and the moved to Raspberry Pi and opened in the same Lazarus version there.
On Windows the text fitted but not on Linux.

One change is not a big deal but it is strange for a GUI tool that it does not keep the visual the same when changing platform...
--
Bo Berglund
Sweden

wp

  • Hero Member
  • *****
  • Posts: 13412
Re: Moving from Windows to Linux (RPi) - texts do not fit
« Reply #4 on: May 01, 2020, 12:42:03 am »
Do not design your controls by dragging them to their place, but use the Anchor Editor and anchor them to each other. It took me some time to get used to it, and sometimes it is rather difficult to change the layout. But combined with AutoSizing it is an excellent tool to create layouts which work with all fonts and font sizes. In the LazStats program (https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/applications/lazstats/) which I am adapting currently I am exercising this technique throughout all forms and it looks correct on Windows, Linux and Mac without any further changes.

 

TinyPortal © 2005-2018