Oneb
Oneb

Reputation: 395

Setting the width of the characters of a font to be uniform in java

Good Day! I am currently working on a program that prints a string in the printer. I am having problems regarding the display of the string to be printed. Ideally I want the font width of every character to be uniform. The problem occurs when when other language characters are set to be displayed. I've noticed that japanese characters are larger in width than the normal characters. Can I set these japanese characters to follow the font width of the normal characters?

Example: NNNNN NPD事本

Notice that the string with japanese encoding is larger in width. How can I make this string to follow the font width of my designated font? Is there a way? or is my case hopeless? Thanks in advance.

Upvotes: 2

Views: 786

Answers (1)

Kane
Kane

Reputation: 4157

There are such things as monospace fonts, where each character takes the same width. I do not know if Japanese has such a font, or if there are English fonts and Japanese fonts that are both monospace and have the same width in pixels.

https://stackoverflow.com/questions/586503/complete-monospaced-unicode-font

The above question was closed as "off-topic" but it has some good links. The general consensus seemed to be you are either hosed, or in for a nightmare of working with different fonts in the same document.

Upvotes: 1

Related Questions