<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Same font, different heights]]></title><description><![CDATA[<p dir="auto">I develop an application that runs both under windows and (embedded) linux. In most things, Qt makes this really easy.</p>
<p dir="auto">However, I noticed one difference: Font heights. The very same font with the very same settings may be 20 pixels high in Windows, but 22 pixels in Linux. This can change the line break behavior, so I get different results on the different systems.</p>
<p dir="auto">Any idea what I could do about this? (we're talking 4.8.7, BTW)</p>
]]></description><link>https://forum.qt.io/topic/73136/same-font-different-heights</link><generator>RSS for Node</generator><lastBuildDate>Sat, 13 Jun 2026 21:15:35 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/73136.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Nov 2016 14:20:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Same font, different heights on Tue, 08 Nov 2016 15:51:28 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
Well you sound very informed so I doubt something you missed.<br />
In later Qt version this issue also seen with retina class screens where all is just too small.<br />
They added new stuff in Qt5.6 to try to help that.<br />
<a href="https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/" target="_blank" rel="noopener noreferrer nofollow ugc">https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/</a></p>
<p dir="auto">I once made a drawing program for windows and also had this issue. There i used mm internally to make sure gfx remained same pixel size using GetDeviceCaps() with HORZSIZE and VERTSIZE, HORZRES and VERTRES. Im not sure how one would do the same in Qt / portable way.</p>
<p dir="auto">Also as you mention. Even when working fairly ok, then the Use Large font in win7 + will often not be as expected.   So maybe any workaround will come in handy on different systems.</p>
]]></description><link>https://forum.qt.io/post/358555</link><guid isPermaLink="true">https://forum.qt.io/post/358555</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Tue, 08 Nov 2016 15:51:28 GMT</pubDate></item><item><title><![CDATA[Reply to Same font, different heights on Tue, 08 Nov 2016 15:39:21 GMT]]></title><description><![CDATA[<p dir="auto">I have extensively*) studied the behaviors I get on different devices when using setPointSize and setPixelSize. If you mix graphics and text in the same display (e.g. the user draws a rectangle, an ellipse and a text), then the user expects the relations between the graphical objects and the text to stay the same, regardless of device. For example, the user places a text, and frames it nicely with a rectangle.</p>
<p dir="auto">If the user sets the size of the rectangle in pixels, then the font must be set in pixels, too. Otherwise you will have a "nicely framed text" on one display, and a "design disaster" on another system - based on exactly the same parameters.</p>
<p dir="auto">The alternative would be to design both objects and font in "points". An approach I experienced with a different GUI framework - and troublesome to work with.</p>
<p dir="auto">If you get right down to it, font is always device dependent. The question is: Which parameters are you observing?<br />
In one case (pointSize), the physical size (millimeters) of the font is supposed to be the same across multiple devices. Meddle with the DPI (e.g. I use large fonts in Windows), and the deal is off. However, even when use use the system-suggested DPI, you will have different results on different systems when you measure the size in <em>pixels</em>.<br />
In the other case (pixelSize), the size in pixels is guaranteed to be the same, but the physical size might vary.</p>
<p dir="auto">There is no "perfect" solution. However, I hoped that at least, when I say 20 pixels, I get 20 pixels, no matter how big it actually looks to the user. Seems I was wrong...</p>
<p dir="auto">As for your suggestions: Of course, I can find a workaround for this specific situation. I am rather trying to understand whether there is an underlying concept or issue I do not properly understand, or a known bug in that direction (not that I could find one).</p>
<p dir="auto">*) When I write "extensively", I mean "over the course of several days.</p>
]]></description><link>https://forum.qt.io/post/358554</link><guid isPermaLink="true">https://forum.qt.io/post/358554</guid><dc:creator><![CDATA[Asperamanca]]></dc:creator><pubDate>Tue, 08 Nov 2016 15:39:21 GMT</pubDate></item><item><title><![CDATA[Reply to Same font, different heights on Tue, 08 Nov 2016 15:28:42 GMT]]></title><description><![CDATA[<p dir="auto">Well<br />
I am talking about<br />
<a href="http://doc.qt.io/qt-5/qfont.html#setPointSize" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/qfont.html#setPointSize</a><br />
That i used to set my font size and its looks the same on windows / linux.<br />
If I use<br />
<a href="http://doc.qt.io/qt-5/qfont.html#setPixelSize" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/qfont.html#setPixelSize</a><br />
It changed.<br />
Docs<br />
Says<br />
"Using this function makes the font device dependent. Use setPointSize() or setPointSizeF() to set the size of the font in a device independent manner."</p>
<p dir="auto">So using setPixel is font device dependent and will change.</p>
<p dir="auto">Update: I used Qt5.5<br />
Maybe it was different with 4.8.7.<br />
Also I did not check the values as it looked as expected.<br />
It sounds like your case is more "tight" and hence its noticeable.</p>
<p dir="auto">Its not an option to check heights with QFontMetrics and simply lower the size until it's within<br />
acceptable Heights?</p>
]]></description><link>https://forum.qt.io/post/358544</link><guid isPermaLink="true">https://forum.qt.io/post/358544</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Tue, 08 Nov 2016 15:28:42 GMT</pubDate></item><item><title><![CDATA[Reply to Same font, different heights on Tue, 08 Nov 2016 15:02:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tusovshik">@<bdi>Tusovshik</bdi></a> said in <a href="/post/358539">Same font, different heights</a>:</p>
<blockquote>
<p dir="auto">In general, the "point size" of a font is the size of the x-height + ascender area's size + descender area's size, and the point size says nothing and gives no restrictions about the width of each character. So, the only reason Arial is bigger than Times is because of its width. Any other size difference depends only on the visual style of the font design (in this case, the fact Arial has a bigger x-height).</p>
</blockquote>
<p dir="auto">I don't quite get the point you are trying to make. I have the same font on both systems, and I am only concerned with it's height. Plus, as said, I use pixelSize, not pointSize.</p>
]]></description><link>https://forum.qt.io/post/358542</link><guid isPermaLink="true">https://forum.qt.io/post/358542</guid><dc:creator><![CDATA[Asperamanca]]></dc:creator><pubDate>Tue, 08 Nov 2016 15:02:31 GMT</pubDate></item><item><title><![CDATA[Reply to Same font, different heights on Tue, 08 Nov 2016 14:59:59 GMT]]></title><description><![CDATA[<p dir="auto">With point size, it is guaranteed to vary, because I have different display DPIs. Mind that I <em>set</em> a certain pixel size to a font, then <em>test</em> the very height of the font using QFontMetrics which gives it's output in - pixels.</p>
<p dir="auto">However, one thing occurred to me: Rounding might differ, because on Windows, qreal is defined as double, whereas on an embedded hardware without FPU, qreal is float.</p>
]]></description><link>https://forum.qt.io/post/358541</link><guid isPermaLink="true">https://forum.qt.io/post/358541</guid><dc:creator><![CDATA[Asperamanca]]></dc:creator><pubDate>Tue, 08 Nov 2016 14:59:59 GMT</pubDate></item><item><title><![CDATA[Reply to Same font, different heights on Tue, 08 Nov 2016 14:58:27 GMT]]></title><description><![CDATA[<p dir="auto">In general, the "point size" of a font is the size of the x-height + ascender area's size + descender area's size, and the point size says nothing and gives no restrictions about the width of each character. So, the only reason Arial is bigger than Times is because of its width. Any other size difference depends only on the visual style of the font design (in this case, the fact Arial has a bigger x-height).</p>
]]></description><link>https://forum.qt.io/post/358539</link><guid isPermaLink="true">https://forum.qt.io/post/358539</guid><dc:creator><![CDATA[Tusovshik]]></dc:creator><pubDate>Tue, 08 Nov 2016 14:58:27 GMT</pubDate></item><item><title><![CDATA[Reply to Same font, different heights on Tue, 08 Nov 2016 14:52:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/asperamanca">@<bdi>Asperamanca</bdi></a><br />
Can you test with Points size ? in theory that should be the same across<br />
platforms.<br />
Pixels size will vary.</p>
]]></description><link>https://forum.qt.io/post/358537</link><guid isPermaLink="true">https://forum.qt.io/post/358537</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Tue, 08 Nov 2016 14:52:40 GMT</pubDate></item><item><title><![CDATA[Reply to Same font, different heights on Tue, 08 Nov 2016 14:52:19 GMT]]></title><description><![CDATA[<p dir="auto">As pixel size.</p>
<p dir="auto">Edit: Maybe I should elaborate: The differences on the OSes are the output of QFontMetrics::height() with the same font.</p>
]]></description><link>https://forum.qt.io/post/358536</link><guid isPermaLink="true">https://forum.qt.io/post/358536</guid><dc:creator><![CDATA[Asperamanca]]></dc:creator><pubDate>Tue, 08 Nov 2016 14:52:19 GMT</pubDate></item><item><title><![CDATA[Reply to Same font, different heights on Tue, 08 Nov 2016 14:34:42 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
Are you specifying the size as Points or Pixels?</p>
]]></description><link>https://forum.qt.io/post/358527</link><guid isPermaLink="true">https://forum.qt.io/post/358527</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Tue, 08 Nov 2016 14:34:42 GMT</pubDate></item></channel></rss>