user2889419
user2889419

Reputation:

JTextPane renders the utf-8 text wrong in Mac

Recently I just tested a simple java application which has got a JTextPane shows some simple utf-8 html content.
Everything is working perfect under windows, and Linux, simple not in Mac.
I'm sure this is not belong to fonts because all components render the same ut8-8 data correctly, except JTextPane.(also other applications don't have such this problem)
text render in windows/linux(correct):
enter image description here
text render in Mac(incorrect):
enter image description here
So the question is, is it kinda bug in MAC? do both windows and mac JVM use same source code and method for rendering text in JTextPane?

Thanks in advance.

Upvotes: 0

Views: 288

Answers (1)

StanislavL
StanislavL

Reputation: 57381

It could be issue with font. Physical font used to represent Logical font.

Read here and here. In simple words there are logical fonts (Monospaced is used to represent text with no font defined in the DefaultStyledDocument) which is represented by platform dependent physical font.

Try to figure out which physical font is ised in your case. Also try to set another font via setCharacterAttributes() and see whether the representation is changed.

Upvotes: 1

Related Questions