PDA

View Full Version : Font size changes when moving from 1 Kubuntu installation to another



okachobi
25th January 2011, 22:52
I have a dialog designed with QT Designers QTCreator plug-in that uses "Helvetica Neue" under Mac OSX. On Kubuntu 10.04 the substitution font was too big, so I added code for the Linux build to set it to an appropriate size, and it appeared to be working fine.

Once it looked like I wanted under Linux, I built a .deb package for it and installed it on another Kubuntu 10.04 machine that had been setup nearly identical to the first. The fonts did not resize like they did with the same binary on the other machine.

I added code to dump the substitute font and it was identical on both systems. I dumped the attribute for scalable from the QFontDatabase for both the substitute font and the original and they both returned false. So I tried dumping the point sizes, and it was a 0 length list.

I've look at qtconfig on both machines, and the font settings are identical. I've done a package by package comparison and I'm having trouble finding any significant differences that would explain why the font isn't resizing.

I thought it might be the wrong binary, so I copied it over manually and the exact same executable generates results differently - but reports the same font substitution.

Can anyone help point me in the right direction for tracking this issue down? I've compared the linked libraries using ldd and they appear to be identical. The versions of the QT libraries are identical.

The code that changes the font sizes looks like this...


QFont font = ui->CreateNewProject->font();
qDebug("Font: %s is mapped to %s", qPrintable(font.family()), qPrintable(QFont::substitute(font.family())));
QFontDatabase db;
qDebug("Scalable? : %s", db.isScalable( font.family())?"yes":"no" );
qDebug("Fixed? : %s", db.isFixedPitch( font.family() )?"yes":"no");
qDebug() << "Point Sizes: " << db.pointSizes( font.family() );
qDebug() << "Available fonts: " << db.families();
font.setPointSize(42);
ui->CreateNewProject->setFont(font);


I suspect that a package has somehow changed a font or a setting- I checked the KDE desktop font settings and they are identical on both machines.

Thanks for any help or tips anyone can provide.

bothorsen
26th January 2011, 07:29
Have you checked the font DPI setting of X? Most Linux distributions will set the DPI based on the monitor - a big low-res monitor will have one setting and a small hi-res screen another. This is the only explanation I can think of.

okachobi
26th January 2011, 17:19
They are different monitors. 1 is a 24 inch and the other is a 27 inch...


(II) Jan 25 14:23:00 NVIDIA(0): Virtual screen size determined to be 1920 x 1080
(--) Jan 25 14:23:00 NVIDIA(0): DPI set to (92, 91); computed from "UseEdidDpi" X config

(--) Jan 10 15:11:01 NVIDIA(0): DPI set to (81, 80); computed from "UseEdidDpi" X config
(II) Jan 10 15:11:01 NVIDIA(0): Virtual screen size determined to be 1920 x 1080

...but it seems to be setting the DPI correctly.

I suspect there is some difference in fontconfig that I'm missing....but the font appears to be the same, it just doesn't accept the new point size on one of the computers. I must be missing something obvious...

okachobi
27th January 2011, 22:44
I guess its horribly wrong to use pixel sizes with fonts, but in this case I have a bitmap backdrop and want the fonts to line up the same no matter which platform I'm on...so pixel sizes are probably called for here...

I'll see if using setPixelSize() will have the same results on both systems.