提交 1aa57e09 编写于 作者: R rupashka

7077293: javax/swing/JComponent/4337267/bug4337267.java failed on windows 2003

Reviewed-by: rupashka
Contributed-by: alexandr.scherbatiy@oracle.com
上级 01749ac5
......@@ -524,55 +524,66 @@ public class SwingUtilities2 {
}
// If we get here we're not printing
AATextInfo info = drawTextAntialiased(c);
if (info != null && (g instanceof Graphics2D)) {
if (g instanceof Graphics2D) {
AATextInfo info = drawTextAntialiased(c);
Graphics2D g2 = (Graphics2D)g;
Object oldContrast = null;
Object oldAAValue = g2.getRenderingHint(KEY_TEXT_ANTIALIASING);
if (info.aaHint != oldAAValue) {
g2.setRenderingHint(KEY_TEXT_ANTIALIASING, info.aaHint);
} else {
oldAAValue = null;
}
if (info.lcdContrastHint != null) {
oldContrast = g2.getRenderingHint(KEY_TEXT_LCD_CONTRAST);
if (info.lcdContrastHint.equals(oldContrast)) {
oldContrast = null;
} else {
g2.setRenderingHint(KEY_TEXT_LCD_CONTRAST,
info.lcdContrastHint);
}
}
boolean needsTextLayout = ((c != null) &&
(c.getClientProperty(TextAttribute.NUMERIC_SHAPING) != null));
if (needsTextLayout) {
synchronized(charsBufferLock) {
int length = syncCharsBuffer(text);
needsTextLayout = isComplexLayout(charsBuffer, 0, length);
}
}
if (needsTextLayout) {
TextLayout layout = createTextLayout(c, text, g2.getFont(),
if (info != null) {
Object oldContrast = null;
Object oldAAValue = g2.getRenderingHint(KEY_TEXT_ANTIALIASING);
if (info.aaHint != oldAAValue) {
g2.setRenderingHint(KEY_TEXT_ANTIALIASING, info.aaHint);
} else {
oldAAValue = null;
}
if (info.lcdContrastHint != null) {
oldContrast = g2.getRenderingHint(KEY_TEXT_LCD_CONTRAST);
if (info.lcdContrastHint.equals(oldContrast)) {
oldContrast = null;
} else {
g2.setRenderingHint(KEY_TEXT_LCD_CONTRAST,
info.lcdContrastHint);
}
}
if (needsTextLayout) {
TextLayout layout = createTextLayout(c, text, g2.getFont(),
g2.getFontRenderContext());
layout.draw(g2, x, y);
} else {
g.drawString(text, x, y);
}
layout.draw(g2, x, y);
} else {
g.drawString(text, x, y);
}
if (oldAAValue != null) {
g2.setRenderingHint(KEY_TEXT_ANTIALIASING, oldAAValue);
if (oldAAValue != null) {
g2.setRenderingHint(KEY_TEXT_ANTIALIASING, oldAAValue);
}
if (oldContrast != null) {
g2.setRenderingHint(KEY_TEXT_LCD_CONTRAST, oldContrast);
}
return;
}
if (oldContrast != null) {
g2.setRenderingHint(KEY_TEXT_LCD_CONTRAST, oldContrast);
if (needsTextLayout){
TextLayout layout = createTextLayout(c, text, g2.getFont(),
g2.getFontRenderContext());
layout.draw(g2, x, y);
return;
}
}
else {
g.drawString(text, x, y);
}
}
g.drawString(text, x, y);
}
/**
* Draws the string at the specified location underlining the specified
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册