Results 1 to 4 of 4

Thread: Font size changes when moving from 1 Kubuntu installation to another

  1. #1
    Join Date
    Jan 2011
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Font size changes when moving from 1 Kubuntu installation to another

    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...

    Qt Code:
    1. QFont font = ui->CreateNewProject->font();
    2. qDebug("Font: %s is mapped to %s", qPrintable(font.family()), qPrintable(QFont::substitute(font.family())));
    3. qDebug("Scalable? : %s", db.isScalable( font.family())?"yes":"no" );
    4. qDebug("Fixed? : %s", db.isFixedPitch( font.family() )?"yes":"no");
    5. qDebug() << "Point Sizes: " << db.pointSizes( font.family() );
    6. qDebug() << "Available fonts: " << db.families();
    7. font.setPointSize(42);
    8. ui->CreateNewProject->setFont(font);
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Mar 2008
    Location
    Marslev, Denmark
    Posts
    31
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Font size changes when moving from 1 Kubuntu installation to another

    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.
    Bo Thorsen, Viking Software
    Qt applications on Linux and Windows

  3. #3
    Join Date
    Jan 2011
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Font size changes when moving from 1 Kubuntu installation to another

    They are different monitors. 1 is a 24 inch and the other is a 27 inch...

    Qt Code:
    1. (II) Jan 25 14:23:00 NVIDIA(0): Virtual screen size determined to be 1920 x 1080
    2. (--) Jan 25 14:23:00 NVIDIA(0): DPI set to (92, 91); computed from "UseEdidDpi" X config
    3.  
    4. (--) Jan 10 15:11:01 NVIDIA(0): DPI set to (81, 80); computed from "UseEdidDpi" X config
    5. (II) Jan 10 15:11:01 NVIDIA(0): Virtual screen size determined to be 1920 x 1080
    To copy to clipboard, switch view to plain text mode 

    ...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...

  4. #4
    Join Date
    Jan 2011
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Font size changes when moving from 1 Kubuntu installation to another

    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.

Similar Threads

  1. Font Height and width based on font size
    By Ghufran in forum Qt Programming
    Replies: 1
    Last Post: 31st July 2010, 08:02
  2. Replies: 6
    Last Post: 27th July 2010, 21:07
  3. adjust font size to QLabel-size
    By hunsrus in forum Qt Programming
    Replies: 0
    Last Post: 9th July 2008, 14:33
  4. Moving my installation to another machine
    By MrGarbage in forum Installation and Deployment
    Replies: 3
    Last Post: 2nd February 2008, 21:32
  5. change font size and button size of QMessageBox
    By nass in forum Qt Programming
    Replies: 6
    Last Post: 13th September 2006, 19:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.