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

Closed
wants to merge 11 commits into from
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2021, 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,6 +71,16 @@ 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) {
@@ -86,7 +96,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) {
if (OSXSurfaceData.IsSimpleColor(sg2d.paint) && nativeStrikePtr != 0 && !hasSlotData(gV)) {
final OSXSurfaceData surfaceData = (OSXSurfaceData)sg2d.getSurfaceData();
surfaceData.drawGlyphs(this, sg2d, nativeStrikePtr, gV, x, y);
} else {