[Kmymoney-devel] String pixel widths differ
Allan
agander93 at gmail.com
Mon Sep 22 22:12:46 UTC 2014
On 22/09/14 22:25, Jack wrote:
> On 2014.09.22 15:17, Allan wrote:
>> On 22/09/14 19:04, Jack wrote:
>>> On 2014.09.22 13:08, Allan wrote:
>>> [snip....]
>>>> I don't think it really matters what font the system is using, as
>>>> long as that font is available. I'm using DejaVu Sans at the
>>>> moment, but I understand that if that is not available, the system
>>>> will substitute a similar one.
>>>
>>> I'm not sure you understand my question. If the system is displaying
>>> a font other than the one you specify but doing the size calculation
>>> based on the font you specified, then the calculation may not match
>>> the display. I'm just trying to be sure the size calculations are
>>> being done with whatever font is actually being displayed.
>>
>> As I specify the same font for both, wouldn't that avoid the situation
>> you foresee?
> Not necessarily. You specify font X for display, but the system uses
> font Y. You specify font X for doing font matrix calculations, and my
> question is whether you know for sure that it is doing those
> calculations on font X or on font Y. Since those calculations are not
> necessarily tied to the active display, I can imagine the system not
> doing the font substitution.
My non-expert view is that, if I specify font X, but the system
substitutes font Y, then the system would only have cause to do that if
font X was not available. So, I don't see how, some nano-seconds later,
font X has suddenly become available and now gets used. I hope I don't
need to keep checking?
>
>> So far, all looks well on both systems now. The column widths are
>> identical, and the only difference is in the overall width of the
>> tableWidget. That, I believe, comes from the margins, which do
>> differ, but I have already taken that into account. The aspect ratios
>> of the two screens are different, too.
> Are the fonts identical?
I take it you mean between my two systems? Again, my non-expert view is
that if the two fonts have the same name, then the are identical.
Otherwise, they would not be the same font.
> If not, then why should the column widths be
> identical?
If the columns contain the same data and use the same font, then that
gives me the information needed to calculate/obtain the pixel width, and
therefore I use that to set the column width.
> I assume the point is for the column to display the text in
> it without clipping and without wasting space. To me, different fonts
> are likely to need different column widths.
Yes, that was exactly the problem I had, which led me to specify the
actual font to use for both calculations and display, within the plugin,
to avoid the idiosyncrasies of different distros. It seems to be working.
Allan
> Jack
More information about the KMyMoney-devel
mailing list