Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8240756: [macos] SwingSet2:TableDemo:Printed Japanese characters were garbled #3619

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -71,16 +71,6 @@ void drawTextAsShape(final SunGraphics2D sg2d, final String s, final double x, f
sg2d.setRenderingHint(SunHints.KEY_ANTIALIASING, oldAliasingHint);
}

private boolean hasSlotData(GlyphVector gv) {
int length = gv.getNumGlyphs();
for (int i = 0; i < length; i++) {
if ((gv.getGlyphCode(i) & CompositeGlyphMapper.SLOTMASK) != 0) {
return true;
}
}
return false;
}

public void drawString(final SunGraphics2D sg2d, final String s, final double x, final double y) {
final long nativeStrikePtr = getNativeStrikePtr(sg2d);
if (OSXSurfaceData.IsSimpleColor(sg2d.paint) && nativeStrikePtr != 0) {
@@ -96,7 +86,7 @@ public void drawGlyphVector(final SunGraphics2D sg2d, final GlyphVector gV, fina
sg2d.setFont(gV.getFont());

final long nativeStrikePtr = getNativeStrikePtr(sg2d);
if (OSXSurfaceData.IsSimpleColor(sg2d.paint) && nativeStrikePtr != 0 && !hasSlotData(gV)) {
if (OSXSurfaceData.IsSimpleColor(sg2d.paint) && nativeStrikePtr != 0) {
final OSXSurfaceData surfaceData = (OSXSurfaceData)sg2d.getSurfaceData();
surfaceData.drawGlyphs(this, sg2d, nativeStrikePtr, gV, x, y);
} else {
@@ -511,7 +511,7 @@ public static void drawString(JComponent c, Graphics g, String text,
if ( text == null || text.length() <= 0 ) { //no need to paint empty strings
return;
}
if (isPrinting(g)) {
if (isPrinting(g) && !FontUtilities.isMacOSX) {
Graphics2D g2d = getGraphics2D(g);
if (g2d != null) {
/* The printed text must scale linearly with the UI.