提交 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,10 +524,21 @@ public class SwingUtilities2 { ...@@ -524,10 +524,21 @@ public class SwingUtilities2 {
} }
// If we get here we're not printing // If we get here we're not printing
if (g instanceof Graphics2D) {
AATextInfo info = drawTextAntialiased(c); AATextInfo info = drawTextAntialiased(c);
if (info != null && (g instanceof Graphics2D)) {
Graphics2D g2 = (Graphics2D)g; Graphics2D g2 = (Graphics2D)g;
boolean needsTextLayout = ((c != null) &&
(c.getClientProperty(TextAttribute.NUMERIC_SHAPING) != null));
if (needsTextLayout) {
synchronized(charsBufferLock) {
int length = syncCharsBuffer(text);
needsTextLayout = isComplexLayout(charsBuffer, 0, length);
}
}
if (info != null) {
Object oldContrast = null; Object oldContrast = null;
Object oldAAValue = g2.getRenderingHint(KEY_TEXT_ANTIALIASING); Object oldAAValue = g2.getRenderingHint(KEY_TEXT_ANTIALIASING);
if (info.aaHint != oldAAValue) { if (info.aaHint != oldAAValue) {
...@@ -545,14 +556,6 @@ public class SwingUtilities2 { ...@@ -545,14 +556,6 @@ public class SwingUtilities2 {
} }
} }
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) { if (needsTextLayout) {
TextLayout layout = createTextLayout(c, text, g2.getFont(), TextLayout layout = createTextLayout(c, text, g2.getFont(),
g2.getFontRenderContext()); g2.getFontRenderContext());
...@@ -567,12 +570,20 @@ public class SwingUtilities2 { ...@@ -567,12 +570,20 @@ public class SwingUtilities2 {
if (oldContrast != null) { if (oldContrast != null) {
g2.setRenderingHint(KEY_TEXT_LCD_CONTRAST, oldContrast); g2.setRenderingHint(KEY_TEXT_LCD_CONTRAST, oldContrast);
} }
return;
} }
else {
g.drawString(text, x, y); if (needsTextLayout){
TextLayout layout = createTextLayout(c, text, g2.getFont(),
g2.getFontRenderContext());
layout.draw(g2, x, y);
return;
} }
} }
g.drawString(text, x, y);
}
/** /**
* Draws the string at the specified location underlining the specified * 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.
先完成此消息的编辑!
想要评论请 注册