Compare commits

...

10 Commits

Author SHA1 Message Date
Artem Bochkarev
88c9346601 add simple cmakelists generator 2019-11-12 14:19:59 +03:00
Dmitry Batrak
e1a500ba8b JBR-572 In macOS 10.13 and JIS layout yen key outputs yen (¥) whatever the setting of "¥ key generates" of Keyboard Settings
backport JDK-8214578 from OpenJDK
2019-11-08 12:44:01 +03:00
Elena Sayapina
f5fad072a7 updated JTreg exclude list 2019-11-06 18:08:48 +07:00
Dmitry Batrak
9b80ea7908 JBR-1945 Backport JDK-8223558 from OpenJDK
apply fix from OpenJDK
2019-11-05 10:52:48 +03:00
Dmitry Batrak
58bad34faf JBR-1945 Backport JDK-8223558 from OpenJDK
revert fix for JBR-586
2019-11-05 10:43:08 +03:00
Denis Fokin
7fe266a4a3 JBR-1932 Dialogs leak via CPlatformWindow 2019-10-31 12:35:50 +03:00
Elena Sayapina
911b6b128d updated JTreg exclude list 2019-10-30 18:21:36 +07:00
Alexey Ushakov
0ff4014388 JBR-1915 .AppleSystemUIFont font rendering issues on macOS Catalina
Restored CoreText rendering (JBR-1756, JBR-1863, JBR-1868)
Use actual font size for calculating advances
2019-10-29 00:50:36 +03:00
Denis Fokin
8ebd3f3e33 JBR-1931 Provide separate means to get in fullscreen and get out of fullscreen
Refactoring
2019-10-25 18:22:11 +03:00
Denis Fokin
a19f3595ba JBR-1931 Provide separate means to get in fullscreen and get out of fullscreen 2019-10-25 16:51:26 +03:00
15 changed files with 453 additions and 114 deletions

79
bin/clion.sh Normal file
View File

@@ -0,0 +1,79 @@
#!/bin/bash
#
# Simple collect all possible include dirs
#
function traverseInclude() {
for file in "$1"/*
do
if [ -d "${file}" ] ; then
echo "${file}" >> $2
traverseInclude "${file}" "$2"
fi
done
}
WORKING_DIR=`pwd`
cd ..
ROOT_DIR="."
SRC_ROOT_DIR="$ROOT_DIR/src"
INCLUDE_DIRS_LIST_TMP_FILE="include.list.tmp"
traverseInclude "$SRC_ROOT_DIR/hotspot/os/posix/include" $INCLUDE_DIRS_LIST_TMP_FILE
traverseInclude "$SRC_ROOT_DIR/java.base/share/native" $INCLUDE_DIRS_LIST_TMP_FILE
traverseInclude "$SRC_ROOT_DIR/java.desktop/share/native" $INCLUDE_DIRS_LIST_TMP_FILE
traverseInclude "$SRC_ROOT_DIR/java.desktop/macosx/native" $INCLUDE_DIRS_LIST_TMP_FILE
traverseInclude "$SRC_ROOT_DIR/../build/macosx-x86_64-server-release/support/headers/java.desktop/" $INCLUDE_DIRS_LIST_TMP_FILE
# TODO: obtain CONF from make
#
# Collect all src files by extension
#
function traverseSources() {
for file in "$1"/*
do
if [ ! -d "${file}" ] ; then
filename=$(basename "$file")
ext="${filename##*.}"
# echo "the ext for $file is: "$ext
if [ "$ext" = "m" ] || [ "$ext" = "c" ] || [ "$ext" = "cpp" ] || [ "$ext" = "cc" ] || [ "$ext" = "mm" ]
then
echo "${file}" >> $2
fi
else
traverseSources "${file}" "$2"
fi
done
}
SOURCES_LIST_TMP_FILE="sources.list.tmp"
traverseSources "$SRC_ROOT_DIR/java.desktop/share/native" $SOURCES_LIST_TMP_FILE
traverseSources "$SRC_ROOT_DIR/java.desktop/macosx/native" $SOURCES_LIST_TMP_FILE
#
# Replace stubs in template
#
#copy
cp "$ROOT_DIR/make/clion/template/CMakeLists.txt" "$ROOT_DIR"
CMAKE_LISTS_FILE="$ROOT_DIR/CMakeLists.txt"
#replace includes
awk 'FNR==NR{s=s"\n"$0;next;} /_CMAKE_INCLUDE_DIRS_LIST_/{$0=substr(s,2);} 1' $INCLUDE_DIRS_LIST_TMP_FILE $CMAKE_LISTS_FILE > $CMAKE_LISTS_FILE.tmp
mv $CMAKE_LISTS_FILE.tmp $CMAKE_LISTS_FILE
#replace sources
awk 'FNR==NR{s=s"\n"$0;next;} /_CMAKE_SOURCE_FILES_LIST_/{$0=substr(s,2);} 1' $SOURCES_LIST_TMP_FILE $CMAKE_LISTS_FILE > $CMAKE_LISTS_FILE.tmp
mv $CMAKE_LISTS_FILE.tmp $CMAKE_LISTS_FILE
rm $INCLUDE_DIRS_LIST_TMP_FILE
rm $SOURCES_LIST_TMP_FILE

View File

@@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.8)
project(jdk)
include_directories(
_CMAKE_INCLUDE_DIRS_LIST_
)
add_custom_target(
configure
COMMAND bash configure
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
add_custom_target(
build_images
COMMAND make COMPILER_WARNINGS_FATAL=false images
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS ${SOURCE_FILES}
)
set(
SOURCE_FILES
_CMAKE_SOURCE_FILES_LIST_
)
add_executable(jdk ${SOURCE_FILES})
# TODO:
# This CMakeLists.txt has only one goal - code navigation via CLion.
# Is it necessary/usefull to set compiler flags and target_link_libraries ?

View File

@@ -1,6 +1,6 @@
#
#
# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2019, 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
@@ -38,6 +38,7 @@ allfonts.chinese-hkscs=MingLiU_HKSCS
allfonts.chinese-ms950-extb=MingLiU-ExtB
allfonts.devanagari=Mangal
allfonts.kannada=Tunga
allfonts.myanmar=Myanmar Text
allfonts.dingbats=Wingdings
allfonts.symbol=Symbol
allfonts.symbols=Segoe UI Symbol
@@ -239,7 +240,8 @@ sequence.allfonts.x-windows-874=alphabetic,thai,dingbats,symbol
sequence.fallback=symbols,\
chinese-ms950,chinese-hkscs,chinese-ms936,chinese-gb18030,\
japanese,korean,chinese-ms950-extb,chinese-ms936-extb,georgian,kannada
japanese,korean,chinese-ms950-extb,chinese-ms936-extb,\
georgian,kannada,myanmar
# Exclusion Ranges
@@ -296,6 +298,7 @@ filename.GulimChe=gulim.TTC
filename.DokChampa=dokchamp.ttf
filename.Mangal=MANGAL.TTF
filename.Tunga=TUNGA.TTF
filename.Myanmar_Text=mmrtext.ttf
filename.Symbol=SYMBOL.TTF
filename.Wingdings=WINGDING.TTF

View File

@@ -28,6 +28,7 @@ package com.apple.eawt;
import java.awt.*;
import java.awt.peer.*;
import java.beans.Beans;
import java.util.function.Consumer;
import javax.swing.JMenuBar;
@@ -395,11 +396,23 @@ public class Application {
*/
@SuppressWarnings("deprecation")
public void requestToggleFullScreen(final Window window) {
invokeOnPlatformWindow(window, pw -> pw.toggleFullScreen());
}
public void requestEnterFullScreen(final Window window) {
invokeOnPlatformWindow(window, pw -> pw.enterFullScreen());
}
public void requestLeaveFullScreen(final Window window) {
invokeOnPlatformWindow(window, pw -> pw.leaveFullScreen());
}
private void invokeOnPlatformWindow (final Window window, Consumer<CPlatformWindow> consumer) {
final Object peer = AWTAccessor.getComponentAccessor().getPeer(window);
if (!(peer instanceof LWWindowPeer)) return;
Object platformWindow = ((LWWindowPeer) peer).getPlatformWindow();
if (!(platformWindow instanceof CPlatformWindow)) return;
((CPlatformWindow)platformWindow).toggleFullScreen();
consumer.accept((CPlatformWindow)platformWindow);
}

View File

@@ -534,11 +534,21 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
private native void _toggleFullScreenMode(final long model);
private native void _enterFullScreen(final long model);
private native void _leaveFullScreen(final long model);
public void toggleFullScreen() {
execute(this::_toggleFullScreenMode);
}
public void enterFullScreen() {
execute(this::_enterFullScreen);
}
public void leaveFullScreen() {
execute(this::_leaveFullScreen);
}
@Override // PlatformWindow
public void setMenuBar(MenuBar mb) {
CMenuBar mbPeer = (CMenuBar)LWToolkit.targetToPeer(mb);

View File

@@ -37,6 +37,9 @@
// TODO: NSMenu *contextualMenu;
// Keyboard layout
NSTextInputSourceIdentifier kbdLayout;
// dnd support (see AppKit/NSDragging.h, NSDraggingSource/Destination):
CDragSource *_dragSource;
CDropTarget *_dropTarget;

View File

@@ -30,7 +30,6 @@
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
#import <Carbon/Carbon.h>
#import "jni_util.h"
#import "ThreadUtilities.h"
#import "AWTView.h"
#import "AWTWindow.h"
@@ -444,28 +443,6 @@ extern bool isSystemShortcut_NextWindowInApplication(NSUInteger modifiersMask, N
[AWTToolkit scrollStateWithEvent: event]);
CHECK_NULL(jEvent);
AWTWindow *awtWindow = (AWTWindow*)[event window];
if (![AWTWindow isAWTWindow: awtWindow]) {
NSLog(@"awt Window is not an AWTWindow instance");
return;
}
AWTWindow* aDelegate = (AWTWindow*)[awtWindow delegate];
jobject platformWindow = [aDelegate.javaPlatformWindow jObjectWithEnv:env];
if (platformWindow == nil) {
NSLog(@"Platform window is nil");
return;
}
static JNF_CLASS_CACHE(jc_PlatformWindow, "sun/lwawt/macosx/CPlatformWindow");
if (!JNFIsInstanceOf(env, platformWindow, &jc_PlatformWindow)) {
NSLog(@"Platform window is not an instance of CPlatformWindow");
}
static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
jobject jlocal = (*env)->NewLocalRef(env, m_cPlatformView);
@@ -1141,8 +1118,16 @@ JNF_CLASS_CACHE(jc_CInputMethod, "sun/lwawt/macosx/CInputMethod");
NSUInteger utf16Length = [useString lengthOfBytesUsingEncoding:NSUTF16StringEncoding];
NSUInteger utf8Length = [useString lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
BOOL aStringIsComplex = NO;
unichar codePoint = [useString characterAtIndex:0];
#ifdef IM_DEBUG
NSLog(@"insertText kbdlayout %@ ",(NSString *)kbdLayout);
#endif // IM_DEBUG
if ((utf16Length > 2) ||
((utf8Length > 1) && [self isCodePointInUnicodeBlockNeedingIMEvent:[useString characterAtIndex:0]])) {
((utf8Length > 1) && [self isCodePointInUnicodeBlockNeedingIMEvent:codePoint]) ||
((codePoint == 0x5c) && ([(NSString *)kbdLayout containsString:@"Kotoeri"]))) {
aStringIsComplex = YES;
}
@@ -1182,6 +1167,15 @@ JNF_CLASS_CACHE(jc_CInputMethod, "sun/lwawt/macosx/CInputMethod");
}
}
- (void)keyboardInputSourceChanged:(NSNotification *)notification
{
#ifdef IM_DEBUG
NSLog(@"keyboardInputSourceChangeNotification received");
#endif
NSTextInputContext *curContxt = [NSTextInputContext currentInputContext];
kbdLayout = curContxt.selectedKeyboardInputSource;
}
- (void) doCommandBySelector:(SEL)aSelector
{
#ifdef IM_DEBUG
@@ -1507,6 +1501,13 @@ JNF_CLASS_CACHE(jc_CInputMethod, "sun/lwawt/macosx/CInputMethod");
fInputMethodLOCKABLE = JNFNewGlobalRef(env, inputMethod);
else
fInputMethodLOCKABLE = NULL;
NSTextInputContext *curContxt = [NSTextInputContext currentInputContext];
kbdLayout = curContxt.selectedKeyboardInputSource;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardInputSourceChanged:)
name:NSTextInputContextKeyboardSelectionDidChangeNotification
object:nil];
}
- (void)abandonInput

View File

@@ -1490,7 +1490,55 @@ JNF_COCOA_ENTER(env);
if (![nsWindow respondsToSelector:toggleFullScreenSelector]) return;
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[nsWindow performSelector:toggleFullScreenSelector withObject:nil];
if ((([nsWindow styleMask] & NSFullScreenWindowMask) != NSFullScreenWindowMask)) {
[nsWindow performSelector:toggleFullScreenSelector withObject:nil];
}
}];
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: _toggleFullScreenMode
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow__1enterFullScreen
(JNIEnv *env, jobject peer, jlong windowPtr)
{
JNF_COCOA_ENTER(env);
NSWindow *nsWindow = OBJC(windowPtr);
SEL toggleFullScreenSelector = @selector(toggleFullScreen:);
if (![nsWindow respondsToSelector:toggleFullScreenSelector]) return;
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
if ((([nsWindow styleMask] & NSFullScreenWindowMask) != NSFullScreenWindowMask)) {
[nsWindow performSelector:toggleFullScreenSelector withObject:nil];
}
}];
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: _toggleFullScreenMode
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow__1leaveFullScreen
(JNIEnv *env, jobject peer, jlong windowPtr)
{
JNF_COCOA_ENTER(env);
NSWindow *nsWindow = OBJC(windowPtr);
SEL toggleFullScreenSelector = @selector(toggleFullScreen:);
if (![nsWindow respondsToSelector:toggleFullScreenSelector]) return;
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
if ((([nsWindow styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask)) {
[nsWindow performSelector:toggleFullScreenSelector withObject:nil];
}
}];
JNF_COCOA_EXIT(env);

View File

@@ -59,8 +59,17 @@ extern jint* gButtonDownMasks;
#define kCFCoreFoundationVersionNumber10_13_Max 1499
#endif
#ifndef kCFCoreFoundationVersionNumber10_14_Max
#define kCFCoreFoundationVersionNumber10_14_Max 1599
#endif
#ifndef IS_OSX_GT10_13
#define IS_OSX_GT10_13 (floor(kCFCoreFoundationVersionNumber) > \
kCFCoreFoundationVersionNumber10_13_Max)
#endif
#ifndef IS_OSX_GT10_14
#define IS_OSX_GT10_14 (floor(kCFCoreFoundationVersionNumber) > \
kCFCoreFoundationVersionNumber10_14_Max)
#endif

View File

@@ -31,6 +31,7 @@
#import "CGGlyphOutlines.h"
#import "CoreTextSupport.h"
#include "fontscalerdefs.h"
#import "LWCToolkit.h"
/* Use THIS_FILE when it is available. */
#ifndef THIS_FILE
@@ -161,8 +162,8 @@ JNF_COCOA_ENTER(env);
CGGlyph glyph;
const CTFontRef fallback = CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode(awtFont, glyphCode, &glyph);
const CGFontRef cgFallback = CTFontCopyGraphicsFont(fallback, NULL);
if (CGGI_IsColorFont(cgFallback)) {
CGAffineTransform matrix = awtStrike->fAltTx;
if (IS_OSX_GT10_14 || CGGI_IsColorFont(cgFallback)) {
CGAffineTransform matrix = CGAffineTransformConcat(awtStrike->fAltTx, awtStrike->fFontTx);
CGFloat fontSize = sqrt(fabs(matrix.a * matrix.d - matrix.b * matrix.c));
CTFontRef font = CTFontCreateWithGraphicsFont(cgFallback, fontSize, NULL, NULL);
CTFontGetAdvancesForGlyphs(font, kCTFontDefaultOrientation, &glyph, &advance, 1);

View File

@@ -31,6 +31,7 @@
#import "fontscalerdefs.h" // contains the definition of GlyphInfo struct
#import "sun_awt_SunHints.h"
#import "LWCToolkit.h"
//#define USE_IMAGE_ALIGNED_MEMORY 1
//#define CGGI_DEBUG 1
@@ -628,7 +629,8 @@ CGGI_CreateNewGlyphInfoFrom(CGSize advance, CGRect bbox,
static inline void
CGGI_CreateImageForGlyph
(CGFontRef cgFont, CGGI_GlyphCanvas *canvas, const CGGlyph glyph,
GlyphInfo *info, const CGGI_GlyphInfoDescriptor *glyphDescriptor, const AWTStrike *strike)
GlyphInfo *info, const CGGI_GlyphInfoDescriptor *glyphDescriptor, const AWTStrike *strike,
const bool isCatalinaOrAbove)
{
if (isnan(info->topLeftX) || isnan(info->topLeftY)) {
// Explicitly set glyphInfo width/height to be 0 to ensure
@@ -648,7 +650,7 @@ CGGI_CreateImageForGlyph
CGFloat x = -info->topLeftX;
CGFloat y = canvas->image->height + info->topLeftY;
if (glyphDescriptor == &argb) {
if (isCatalinaOrAbove || glyphDescriptor == &argb) {
CGAffineTransform matrix = CGContextGetTextMatrix(canvas->context);
CGFloat fontSize = sqrt(fabs(matrix.a * matrix.d - matrix.b * matrix.c));
CTFontRef font = CTFontCreateWithGraphicsFont(cgFont, fontSize, NULL, NULL);
@@ -692,7 +694,8 @@ CGGI_CreateImageForGlyph
static inline GlyphInfo *
CGGI_CreateImageForUnicode
(CGGI_GlyphCanvas *canvas, const AWTStrike *strike,
const CGGI_RenderingMode *mode, const UnicodeScalarValue uniChar)
const CGGI_RenderingMode *mode, const UnicodeScalarValue uniChar,
const bool isCatalinaOrAbove)
{
// save the state of the world
CGContextSaveGState(canvas->context);
@@ -737,7 +740,7 @@ CGGI_CreateImageForUnicode
CFRelease(cgFallback);
// clean the canvas - align, strike, and copy the glyph from the canvas into the info
CGGI_CreateImageForGlyph(cgFallback, canvas, glyph, info, glyphDescriptor, strike);
CGGI_CreateImageForGlyph(cgFallback, canvas, glyph, info, glyphDescriptor, strike, isCatalinaOrAbove);
// restore the state of the world
CGContextRestoreGState(canvas->context);
@@ -782,14 +785,15 @@ CGGI_FillImagesForGlyphsWithSizedCanvas(CGGI_GlyphCanvas *canvas,
CGGI_GlyphInfoDescriptor* mainFontDescriptor = CGGI_GetGlyphInfoDescriptor(mode, strike->fAWTFont->fNativeCGFont);
const bool isCatalinaOrAbove = IS_OSX_GT10_14;
CFIndex i;
for (i = 0; i < len; i++) {
GlyphInfo *info = (GlyphInfo *)jlong_to_ptr(glyphInfos[i]);
if (info != NULL) {
CGGI_CreateImageForGlyph(strike->fAWTFont->fNativeCGFont,
canvas, glyphs[i], info, mainFontDescriptor, strike);
canvas, glyphs[i], info, mainFontDescriptor, strike, isCatalinaOrAbove);
} else {
info = CGGI_CreateImageForUnicode(canvas, strike, mode, uniChars[i]);
info = CGGI_CreateImageForUnicode(canvas, strike, mode, uniChars[i], isCatalinaOrAbove);
glyphInfos[i] = ptr_to_jlong(info);
}
#ifdef CGGI_DEBUG

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2019, 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
@@ -269,9 +269,10 @@ public final class FontUtilities {
else if (code < 0x0f00) {
return false;
}
else if (code <= 0x109f) {
// U+0F00 - U+0FFF Tibetan
// U+1000 - U+109F Myanmar
else if (code <= 0x0fff) { // U+0F00 - U+0FFF Tibetan
return true;
}
else if (code < 0x10A0) { // U+1000 - U+109F Myanmar
return true;
}
else if (code < 0x1100) {

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 2019, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8223558
* @summary Verifies Dialog logical font falls back to "Myanmar Text"
* @requires (os.family == "windows")
*/
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.util.Arrays;
public class MyanmarFallbackTest {
public static void main(String[] args) {
if (!System.getProperty("os.name").toLowerCase().contains("windows")) {
System.err.println("This test is for Windows only");
return;
}
String[] fontFamilyNames = GraphicsEnvironment
.getLocalGraphicsEnvironment()
.getAvailableFontFamilyNames();
if (Arrays.stream(fontFamilyNames)
.noneMatch("Myanmar Text"::equals)) {
System.err.println("Myanmar Text font is not installed");
return;
}
Font dialog = new Font(Font.DIALOG, Font.PLAIN, 12);
if (-1 != dialog.canDisplayUpTo("\u1000\u103C")) {
throw new RuntimeException("Cannot display Myanmar characters");
}
}
}

View File

@@ -0,0 +1,151 @@
/*
* Copyright (c) 2019, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8223558
* @key headful
* @summary Verifies that Myanmar script is rendered correctly:
* two characters combined into one glyph
* @run main MyanmarTextTest
*/
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.util.Arrays;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.plaf.TextUI;
import javax.swing.text.BadLocationException;
import javax.swing.text.Position;
public class MyanmarTextTest {
private static final String TEXT = "\u1000\u103C";
private static final String FONT_WINDOWS = "Myanmar Text";
private static final String FONT_LINUX = "Padauk";
private static final String FONT_MACOS = "Myanmar MN";
private static final String FONT_NAME = selectFontName();
private final JFrame frame;
private final JTextField myanmarTF;
private static volatile MyanmarTextTest mtt;
public static void main(String[] args) throws Exception {
if (FONT_NAME == null) {
System.err.println("Unsupported OS: exiting");
return;
}
if (!fontExists()) {
System.err.println("Required font is not installed: " + FONT_NAME);
return;
}
try {
SwingUtilities.invokeAndWait(MyanmarTextTest::createUI);
SwingUtilities.invokeAndWait(mtt::checkPositions);
} finally {
SwingUtilities.invokeAndWait(mtt::dispose);
}
}
private static void createUI() {
mtt = new MyanmarTextTest();
mtt.show();
}
private MyanmarTextTest() {
frame = new JFrame("Myanmar Text");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
myanmarTF = new JTextField(TEXT);
myanmarTF.setFont(new Font(FONT_NAME, Font.PLAIN, 40));
JPanel main = new JPanel();
main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));
main.add(myanmarTF);
main.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));
frame.getContentPane().add(main);
}
private void show() {
frame.pack();
frame.setLocationByPlatform(true);
frame.setVisible(true);
}
private void dispose() {
frame.dispose();
}
private void checkPositions() {
final TextUI ui = myanmarTF.getUI();
final Position.Bias[] biasRet = new Position.Bias[1];
try {
if (2 != ui.getNextVisualPositionFrom(myanmarTF, 0,
Position.Bias.Forward, SwingConstants.EAST, biasRet)) {
throw new RuntimeException("For 0, next position should be 2");
}
if (2 != ui.getNextVisualPositionFrom(myanmarTF, 1,
Position.Bias.Forward, SwingConstants.EAST, biasRet)) {
throw new RuntimeException("For 1, next position should be 2");
}
if (0 != ui.getNextVisualPositionFrom(myanmarTF, 2,
Position.Bias.Forward, SwingConstants.WEST, biasRet)) {
throw new RuntimeException("For 2, prev position should be 0");
}
} catch (BadLocationException e) {
throw new RuntimeException(e);
}
}
private static String selectFontName() {
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("windows")) {
return FONT_WINDOWS;
} else if (osName.contains("linux")) {
return FONT_LINUX;
} else if (osName.contains("mac")) {
return FONT_MACOS;
} else {
return null;
}
}
private static boolean fontExists() {
String[] fontFamilyNames = GraphicsEnvironment
.getLocalGraphicsEnvironment()
.getAvailableFontFamilyNames();
return Arrays.asList(fontFamilyNames).contains(FONT_NAME);
}
}

View File

@@ -195,7 +195,7 @@ java/awt/Focus/WindowIsFocusableAccessByThreadsTest/WindowIsFocusableAccessByThr
java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.html 8202926 generic-all
java/awt/Focus/WrongKeyTypedConsumedTest/WrongKeyTypedConsumedTest.java 8169096,8213522 macosx-all,linux-all,windows-all
java/awt/FontMetrics/FontCrash.java 8198336 windows-all
java/awt/FontMetrics/MaxAdvanceIsMax.java 8221304 macosx-all
java/awt/FontMetrics/MaxAdvanceIsMax.java 8221304 solaris-all,macosx-all
java/awt/Frame/DisposeParentGC/DisposeParentGC.java 8079786,8055833 macosx-all,linux-all
java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java 8198237 macosx-all
java/awt/Frame/FramesGC/FramesGC.java 8079069 macosx-all
@@ -814,84 +814,13 @@ com/sun/nio/sctp/SctpChannel/SocketOptionTests.java
# jdk_security
security/infra/java/security/cert/CertPathValidator/certification/ActalisCA.java 8194170 generic-all
security/infra/java/security/cert/CertPathValidator/certification/BuypassCA.java 8194170 generic-all
security/infra/java/security/cert/CertPathValidator/certification/ComodoCA.java 8194170 generic-all
security/infra/java/security/cert/CertPathValidator/certification/DTrustCA.java 8194170 generic-all
security/infra/java/security/cert/CertPathValidator/certification/LetsEncryptCA.java 8194170 generic-all
security/infra/java/security/cert/CertPathValidator/certification/QuoVadisCA.java 8194170 generic-all
sun/security/pkcs11/ec/TestKeyFactory.java 8026976 generic-all
sun/security/pkcs11/Secmod/AddTrustedCert.java 8180837 generic-all
sun/security/pkcs11/tls/TestKeyMaterial.java 8180837 generic-all
sun/security/tools/keytool/ListKeychainStore.sh 8156889 macosx-all
sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java 8026393 generic-all
sun/security/pkcs11/KeyStore/SecretKeysBasic.sh 8209398 generic-all
javax/net/ssl/DTLS/PacketLossRetransmission.java 8169086 macosx-x64
javax/net/ssl/DTLS/RespondToRetransmit.java 8169086 macosx-x64
javax/net/ssl/DTLS/CipherSuite.java 8202059 macosx-x64
sun/security/provider/KeyStore/DKSTest.sh 8180266 windows-all
sun/security/pkcs11/Cipher/ReinitCipher.java 8204203 windows-all
sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java 8204203 windows-all
sun/security/pkcs11/Cipher/TestRSACipher.java 8204203 windows-all
sun/security/pkcs11/Cipher/TestRSACipherWrap.java 8204203 windows-all
sun/security/pkcs11/Cipher/TestRawRSACipher.java 8204203 windows-all
sun/security/pkcs11/Cipher/TestSymmCiphers.java 8204203 windows-all
sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java 8204203 windows-all
sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java 8204203 windows-all
sun/security/pkcs11/KeyAgreement/TestDH.java 8204203 windows-all
sun/security/pkcs11/KeyAgreement/TestInterop.java 8204203 windows-all
sun/security/pkcs11/KeyAgreement/TestShort.java 8204203 windows-all
sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java 8204203 windows-all
sun/security/pkcs11/KeyGenerator/DESParity.java 8204203 windows-all
sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java 8204203 windows-all
sun/security/pkcs11/KeyPairGenerator/TestDH2048.java 8204203 windows-all
sun/security/pkcs11/KeyStore/SecretKeysBasic.sh 8204203,8209398 generic-all
sun/security/pkcs11/Mac/MacKAT.java 8204203 windows-all
sun/security/pkcs11/Mac/MacSameTest.java 8204203 windows-all
sun/security/pkcs11/Mac/ReinitMac.java 8204203 windows-all
sun/security/pkcs11/MessageDigest/ByteBuffers.java 8204203 windows-all
sun/security/pkcs11/MessageDigest/DigestKAT.java 8204203 windows-all
sun/security/pkcs11/MessageDigest/ReinitDigest.java 8204203 windows-all
sun/security/pkcs11/MessageDigest/TestCloning.java 8204203 windows-all
sun/security/pkcs11/Provider/ConfigQuotedString.sh 8204203 windows-all
sun/security/pkcs11/Provider/Login.sh 8204203 windows-all
sun/security/pkcs11/SampleTest.java 8204203 windows-all
sun/security/pkcs11/Secmod/AddPrivateKey.java 8204203 windows-all
sun/security/pkcs11/Secmod/Crypto.java 8204203 windows-all
sun/security/pkcs11/Secmod/GetPrivateKey.java 8204203 windows-all
sun/security/pkcs11/Secmod/JksSetPrivateKey.java 8204203 windows-all
sun/security/pkcs11/Secmod/LoadKeystore.java 8204203 windows-all
sun/security/pkcs11/Secmod/TestNssDbSqlite.java 8204203 windows-all
sun/security/pkcs11/SecureRandom/Basic.java 8204203 windows-all
sun/security/pkcs11/SecureRandom/TestDeserialization.java 8204203 windows-all
sun/security/pkcs11/Serialize/SerializeProvider.java 8204203 windows-all
sun/security/pkcs11/Signature/ByteBuffers.java 8204203 windows-all
sun/security/pkcs11/Signature/ReinitSignature.java 8204203 windows-all
sun/security/pkcs11/Signature/TestDSA.java 8204203 windows-all
sun/security/pkcs11/Signature/TestDSAKeyLength.java 8204203 windows-all
sun/security/pkcs11/Signature/TestRSAKeyLength.java 8204203 windows-all
sun/security/pkcs11/ec/ReadCertificates.java 8204203 windows-all
sun/security/pkcs11/ec/ReadPKCS12.java 8204203 windows-all
sun/security/pkcs11/ec/TestCurves.java 8204203 windows-all
sun/security/pkcs11/ec/TestECDH.java 8204203 windows-all
sun/security/pkcs11/ec/TestECDH2.java 8204203 windows-all
sun/security/pkcs11/ec/TestECDSA.java 8204203 windows-all
sun/security/pkcs11/ec/TestECDSA2.java 8204203 windows-all
sun/security/pkcs11/ec/TestECGenSpec.java 8204203 windows-all
sun/security/pkcs11/rsa/KeyWrap.java 8204203 windows-all
sun/security/pkcs11/rsa/TestCACerts.java 8204203 windows-all
sun/security/pkcs11/rsa/TestKeyFactory.java 8204203 windows-all
sun/security/pkcs11/rsa/TestKeyPairGenerator.java 8204203 windows-all
sun/security/pkcs11/rsa/TestSignatures.java 8204203 windows-all
sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8204203 windows-all
sun/security/pkcs11/tls/TestLeadingZeroesP11.java 8204203 windows-all
sun/security/pkcs11/tls/TestMasterSecret.java 8204203 windows-all
sun/security/pkcs11/tls/TestPRF.java 8204203 windows-all
sun/security/pkcs11/tls/TestPremaster.java 8204203 windows-all
security/infra/java/security/cert/CertPathValidator/certification/ActalisCA.java 8224768 generic-all
############################################################################