IDEA-156246 About font on Windows is hardcoded to Tahoma, doesn't support some glyphs (Chinese)

This commit is contained in:
Vassiliy.Kudryashov
2016-05-18 19:48:27 +03:00
parent 7545342309
commit 697af3fabb
@@ -436,12 +436,27 @@ public class AboutPopup {
private void renderWord(final String s, final int indentX) throws OverflowException {
for (int j = 0; j != s.length(); ++j) {
final char c = s.charAt(j);
final int cW = fontmetrics.charWidth(c);
if (x + cW >= w) {
lineFeed(indentX, s);
Font f = null;
FontMetrics fm = null;
try {
if (!g2.getFont().canDisplay(c)) {
f = g2.getFont();
fm = fontmetrics;
g2.setFont(new Font("Monospaced", f.getStyle(), f.getSize()));
fontmetrics = g2.getFontMetrics();
}
final int cW = fontmetrics.charWidth(c);
if (x + cW >= w) {
lineFeed(indentX, s);
}
g2.drawChars(new char[]{c}, 0, 1, xBase + x, yBase + y);
x += cW;
} finally {
if (f != null) {
g2.setFont(f);
fontmetrics = fm;
}
}
g2.drawChars(new char[]{c}, 0, 1, xBase + x, yBase + y);
x += cW;
}
}