[Interest] Qt5 font size issue with fontconfig
Thiago Macieira
thiago.macieira at intel.com
Wed Nov 11 16:46:08 CET 2020
On Tuesday, 10 November 2020 21:23:12 PST Ramakanth Kesireddy wrote:
> Hello Thiago,
>
> In our application, based on DPI 141(screen size: 5.7" 480X640), the
> application font is set as 7pt based on the below calculation where px is
> 14 to look the font normal.
Does your system know that its screen size is 5.7"? That is, is the monitor
offering the correct information to XRandR? Run the "xrandr" tool and it will
tell you. Please also paste here the "Screens" section of qtdiag.
> double pxToPt(double px, double dpi) {
> return px*72/dpi
> }
NEVER calculate font sizes in pixels. Your design is wrong. Delete this
function and use point sizes throughout.
> so that it scales for the 8" or 10" display? Though we need to convert
> existing pixel size to point sizes in the application code and use layouts
> in some parts of code instead of setting fixed width or any hardcoded
> values.
And fix those hardcoded layouts too.
> Incase we need to show larger font, do we need to increment 4pt from the
> reference 12pt incase it is correct?
You shouldn't need to. But if you have to adjust, the rest of the application
should scale accordingly.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel DPG Cloud Engineering
More information about the Interest
mailing list