Size Mismatch Between Swing Fonts and Printable Fonts in Java

Posted by Caleb Rackliffe on Stack Overflow See other posts from Stack Overflow or by Caleb Rackliffe
Published on 2010-04-20T21:31:24Z Indexed on 2010/04/20 21:33 UTC
Read the original article Hit count: 713

Filed under:
|
|

Hi All,

I've got a panel displaying a JTextPane backed by a StyledDocument. When I print a string of text in, say Arial 16, the text it prints is of a different size than the Arial 16 Word prints. Is there some sort of flaw in the translation of Swing fonts to Windows system fonts or something of the sort that makes it difficult (or impossible) to print accurately?

I can achieve an approximation by scaling down the size of my font before printing, but this never quite gets me the results I would like, as it's not possible in all cases to reproduce things like equivalent numbers of words on a line, etc.

Has anybody run into this before?

© Stack Overflow or respective owner

Related posts about java

Related posts about printing