• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with printing in Latin2 charset

 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic