[Development] Why on Linux using FreeType engine fonts are rendered in 72 dpi instead of Screen DPI?

Tomasz Olszak olszak.tomasz at gmail.com
Wed Oct 17 22:11:38 CEST 2018


Ok,
It's a lot more clear. Thank you for explanation!

I used default font with pixel size 100 and according to FontMetrics:
1. family: "Sans Serif"
2. pointSize: 75
3. pixelSize: 100
4. ascent 93
5. descent: 24
6. height: 117
7. leading -1

So how ascent, descent, leading is related to 100. How can I calculate
font.pixelSiize knowing that capital letter height is 100. By trial
and errors the font with pixel size = 137 and ascent = 129 have
capital letter(without accent) of 100 pixel height.
Is it a way to determin font.pixelSize if we want the non accent
capilat letter to be e.g 100px? Or should I just iterate over pixel
sizes and calculate using fontMetrics and tightBoundingRect for
capitalized letter without accent?

śr., 17 paź 2018 o 21:17 Jason H <jhihn at gmx.com> napisał(a):
>
> +1. Make sure that you are accounting for the full font height, see QFontMetrics::ascent() and descent()
>
>
> > Sent: Wednesday, October 17, 2018 at 1:23 PM
> > From: "Allan Sandfeld Jensen" <kde at carewolf.com>
> > To: development at qt-project.org
> > Subject: Re: [Development] Why on Linux using FreeType engine fonts are rendered in 72 dpi instead of Screen DPI?
> >
> > On Mittwoch, 17. Oktober 2018 19:10:45 CEST Tomasz Olszak wrote:
> > > Could you please try example I sent on Linux and explain why font size
> > > doesn't match rectangle size? Maybe the ft font engine has bug?
> > >
> > Try putting a capital Å or any other capital with accents in your example, and
> > you will see that it fits snugly.
> >
> > Though it should be noted fonts are a bit inconsistent in what they consider
> > their heights, some use the capital-height as their height, some use the
> > maximum including accents. I believe we normally always render text with the
> > leading on top, so there is room for all the Latin-1 characters and the
> > results are always the same.
> >
> > 'Allan
> >
> >
> > _______________________________________________
> > Development mailing list
> > Development at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/development
> >
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development



More information about the Development mailing list