Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with printing in Latin2 charset  RSS feed

 
Velika Srbija
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem with printing characters that doesn't belong to Latin1 charset.
When I render a word that contains some of the following chars: Č, č, Ć, ć, Đ, đ, Ž, ž,
whole paragraf is rendered in bold style.
An example:
------------
...
printerJob.setPrintable(this);
printerJob.print();
...
public int print (Graphics g, PageFormat pageFormat, int page) throws PrinterException {
Graphics2D g2d = (Graphics2D) g;
//setting page margins, etc.
...
Font titleFont = new Font ("SansSerif", Font.BOLD, 12);
g2d.setFont (titleFont);
...
g2d.drawString ("Kvadratura pomo\u0107nih prostorija", 30, 30);
...
}
The result on my HP printer will look like: Kvadratura pomoćnih prostorija
instead of: Kvadratura pomoćnih prostorija
What causes bold style printing instead of plain style when used characters that belong to Latin2 charset?
 
Velika Srbija
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, there is an error in the previous code snippet. I have copyed wrong line of code.
What I thought is:
Font titleFont = new Font ("SansSerif", Font.PLAIN, 12);
This is correct!!!
------------------
Consider this:
Printing:
g2d.drawString ("Kvadratura pomo\u0107nih prostorija", 30, 30);
g2d.drawString ("Kvadratura pomocnih prostorija", 30, 60);
will result in:
Kvadratura pomoćnih prostorija
Kvadratura pomocnih prostorija
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!