Results 1 to 4 of 4

Thread: QTextDocument font size wildly different when printing on Windows vs OS X

  1. #1
    Join Date
    Jan 2009
    Posts
    31
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QTextDocument font size wildly different when printing on Windows vs OS X

    I've had a search but not seen anything mentioning this.

    I'm trying to print a QTextDocument that I've created using HTML tags (I've not implemented them as a CSS stylesheet yet), so setting <font size=2>some text</font> and so on, however the print resolution is *wildly* different from OS X to Windows. I really do mean wildly different as well! The Windows font is a few font sizes smaller at least, which is a bit of a pain.

    I've tried various combinations of font size=x pt or x px and it just doesn't want to seem to work. I'd be grateful to at least have another avenue to pursue but I'm a bit of a dead end now!

    Thanks guys!

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QTextDocument font size wildly different when printing on Windows vs OS X

    Use QPrinter::setResolution() and an explicit default font.

  3. The following user says thank you to Lykurg for this useful post:

    NicholasSmith (10th March 2010)

  4. #3
    Join Date
    Jan 2009
    Posts
    31
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QTextDocument font size wildly different when printing on Windows vs OS X

    Thanks, for that. I've already tried setting QPrinter::ScreenResolution, and that didn't help too much (setting it to PrintResolution made it even tinier), I'll give those suggestions a try now

  5. #4
    Join Date
    Jan 2009
    Posts
    31
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QTextDocument font size wildly different when printing on Windows vs OS X

    You sir, are a scholar. Setting the default font worked perfectly. Thank you!

Similar Threads

  1. Edit QTextDocument for printing
    By ericV in forum Qt Programming
    Replies: 0
    Last Post: 29th July 2009, 12:45
  2. QTextDocument printing - specify font size?
    By Scorp1us in forum Qt Programming
    Replies: 3
    Last Post: 1st March 2007, 15:25
  3. QTextDocument - color, font
    By kemp in forum Qt Programming
    Replies: 6
    Last Post: 24th January 2007, 13:51
  4. change font size and button size of QMessageBox
    By nass in forum Qt Programming
    Replies: 6
    Last Post: 13th September 2006, 19:16
  5. Replies: 0
    Last Post: 28th June 2006, 20:49

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.