• Post Reply Bookmark Topic Watch Topic
  • New Topic

font help (printing through a browser)

 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to change stuff like
oCanvas.setFont(new Font("SansSerif", Font.PLAIN, 25));
to
oCanvas.setFont(new Font("Arial", Font.TRUETYPE_FONT, 25));
but it doesn't seem to be working.
I'm calling drawString() and other Graphics 2D methods to draw a label image and printing it to a thermal printer.
This plain logical font that I'm getting instead is almost illegible at point size 8 (which is what I need for part of it). Honestly, it doesn't have to be Arial--I'll take anything that looks half-decent...I just don't know how to say at runtime "Print this using a font that looks half-decent." The thing is, when I generate the image, it goes through a browser to a printer, so I'm wondering how much that will restrict what fonts I have access to.
I've seen labels printed with a thermal printer (via an application that's not browser-based, and probably not Java-based either) that have better fonts, so I know it can be done...
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Point size 8 fonts are pretty illegible in most fonts! To test and see what fonts are installed on your machine, and to see which of them look decent, run the test program below on the machine and look at different choices. Not sure what kind of machine you are running this on, or exactly how you are printing, but this might help you.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!