mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-26 03:09:41 +01:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b6652871d | ||
|
|
10069846d5 | ||
|
|
f06f9fe734 | ||
|
|
348e538d10 | ||
|
|
5b9ff9a29e | ||
|
|
62b04983f2 | ||
|
|
c40b9c8b9e | ||
|
|
46dfaeecc9 | ||
|
|
e03c9829e3 | ||
|
|
97c0e96a5a | ||
|
|
2b559a30df | ||
|
|
73b4a7e79e | ||
|
|
7d8aeaf7de | ||
|
|
94390c3f1e | ||
|
|
78d509ac0f | ||
|
|
0b6238990b | ||
|
|
c0e4afcddd | ||
|
|
be6a2c4f0c | ||
|
|
0b8ff1a7e6 | ||
|
|
63134e091b | ||
|
|
50ab4690de | ||
|
|
c790bf3ebc | ||
|
|
746affd753 | ||
|
|
e766df4bcc | ||
|
|
847705dc96 | ||
|
|
f10e7aca70 | ||
|
|
9ee1550815 | ||
|
|
1de6eed0e1 | ||
|
|
78510922c5 | ||
|
|
41de3a4cb1 | ||
|
|
304eb7f919 | ||
|
|
442bb7eecc | ||
|
|
09941119e1 | ||
|
|
e3aaff5db4 | ||
|
|
99242748ee | ||
|
|
c1f4b0ca72 | ||
|
|
553e5ca631 | ||
|
|
aee4b48d20 | ||
|
|
bef85f8cea | ||
|
|
0161050077 |
@@ -6,7 +6,6 @@
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to bu built; possible values:
|
||||
# jcef - the bundles 1) jbr with jcef+javafx, 2) jbrsdk and 3) test will be created
|
||||
# jfx - the bundle 1) jbr with javafx only will be created
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built; possible values:
|
||||
# jcef - the release bundles with jcef
|
||||
# jfx - the release bundles with javafx
|
||||
# jcef_jfx - the release bundles with jcef and javafx
|
||||
# dcevm - the release bundles with dcevm patches
|
||||
# nomod - the release bundles without any additional modules (jcef)
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
@@ -41,12 +39,9 @@ function create_jbr {
|
||||
JBR_BUNDLE=jbr_${bundle_type}
|
||||
|
||||
case "${bundle_type}" in
|
||||
"jfx" | "jcef" | "dcevm" | "nomod" | "fd")
|
||||
"jcef" | "dcevm" | "nomod" | "fd")
|
||||
JBR_BASE_NAME=jbr_${bundle_type}-${JBSDK_VERSION}
|
||||
;;
|
||||
"jfx_jcef")
|
||||
JBR_BASE_NAME=jbr-${JBSDK_VERSION}
|
||||
;;
|
||||
*)
|
||||
echo "***ERR*** bundle was not specified" && do_exit 1
|
||||
;;
|
||||
@@ -80,19 +75,10 @@ WITH_DEBUG_LEVEL="--with-debug-level=release"
|
||||
RELEASE_NAME=linux-x86_64-normal-server-release
|
||||
JBSDK=${JBRSDK_BASE_NAME}-linux-x64-b${build_number}
|
||||
case "$bundle_type" in
|
||||
"jfx")
|
||||
git apply -p0 < jb/project/tools/patches/add_jfx_module.patch || do_exit $?
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"jcef")
|
||||
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"jfx_jcef")
|
||||
git apply -p0 < jb/project/tools/patches/add_jfx_module.patch || do_exit $?
|
||||
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"dcevm")
|
||||
HEAD_REVISION=$(git rev-parse HEAD)
|
||||
git am jb/project/tools/patches/dcevm/*.patch || do_exit $?
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to bu built; possible values:
|
||||
# jcef - the bundles 1) jbr with jcef+javafx, 2) jbrsdk and 3) test will be created
|
||||
# jfx - the bundle 1) jbr with javafx only will be created
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built; possible values:
|
||||
# jcef - the release bundles with jcef
|
||||
# jfx - the release bundles with javafx
|
||||
# jcef_jfx - the release bundles with jcef and javafx
|
||||
# dcevm - the release bundles with dcevm patches
|
||||
# nomod - the release bundles without any additional modules (jcef)
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
@@ -41,27 +39,17 @@ source jb/project/tools/common.sh
|
||||
|
||||
function copyJNF {
|
||||
__contents_dir=$1
|
||||
# we can't notarize this library as usual framework (with headers and tbd-file)
|
||||
# but single library notarizes correctly
|
||||
mkdir -p ${__contents_dir}/Frameworks/JavaNativeFoundation.framework/Resources
|
||||
cp -p Frameworks/JavaNativeFoundation.framework/JavaNativeFoundation \
|
||||
${__contents_dir}/Frameworks/JavaNativeFoundation.framework || do_exit $?
|
||||
cp -p Frameworks/JavaNativeFoundation.framework/Resources/Info.plist \
|
||||
${__contents_dir}/Frameworks/JavaNativeFoundation.framework/Resources || do_exit $?
|
||||
# unsign JavaNativeFoundation binary (otherwise notarization will fail)
|
||||
codesign --remove-signature ${__contents_dir}/Frameworks/JavaNativeFoundation.framework/JavaNativeFoundation || do_exit $?
|
||||
mkdir -p ${__contents_dir}/Frameworks
|
||||
cp -Rp Frameworks/JavaNativeFoundation.framework ${__contents_dir}/Frameworks
|
||||
}
|
||||
function create_jbr {
|
||||
|
||||
JBR_BUNDLE=jbr_${bundle_type}
|
||||
|
||||
case "${bundle_type}" in
|
||||
"jfx" | "jcef" | "dcevm" | "nomod" | "fd")
|
||||
"jcef" | "dcevm" | "nomod" | "fd")
|
||||
JBR_BASE_NAME=jbr_${bundle_type}-${JBSDK_VERSION}
|
||||
;;
|
||||
"jfx_jcef")
|
||||
JBR_BASE_NAME=jbr-${JBSDK_VERSION}
|
||||
;;
|
||||
*)
|
||||
echo "***ERR*** bundle was not specified" && do_exit 1
|
||||
;;
|
||||
@@ -122,19 +110,10 @@ CONF_NAME=macosx-${CONF_ARCHITECTURE}-normal-server-release
|
||||
|
||||
JBSDK=${JBRSDK_BASE_NAME}-osx-${architecture}-b${build_number}
|
||||
case "$bundle_type" in
|
||||
"jfx")
|
||||
git apply -p0 < jb/project/tools/patches/add_jfx_module.patch || do_exit $?
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"jcef")
|
||||
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"jfx_jcef")
|
||||
git apply -p0 < jb/project/tools/patches/add_jfx_module.patch || do_exit $?
|
||||
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"dcevm")
|
||||
HEAD_REVISION=$(git rev-parse HEAD)
|
||||
git am jb/project/tools/patches/dcevm/*.patch || do_exit $?
|
||||
|
||||
@@ -26,8 +26,7 @@ log "Signing libraries and executables..."
|
||||
# -perm +111 searches for executables
|
||||
for f in \
|
||||
"Contents/Home/bin" \
|
||||
"Contents/Home/lib" \
|
||||
"Contents/Frameworks"; do
|
||||
"Contents/Home/lib"; do
|
||||
if [ -d "$APP_DIRECTORY/$f" ]; then
|
||||
find "$APP_DIRECTORY/$f" \
|
||||
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -perm +111 \) \
|
||||
@@ -37,6 +36,20 @@ for f in \
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -d "$APP_DIRECTORY/Contents/Frameworks" ]; then
|
||||
log "Signing frameworks..."
|
||||
for f in $APP_DIRECTORY/Contents/Frameworks/*; do
|
||||
find "$f" \
|
||||
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" \) \
|
||||
-exec codesign --timestamp --force \
|
||||
-v -s "$JB_CERT" \
|
||||
--entitlements entitlements.xml {} \;
|
||||
codesign --timestamp --force \
|
||||
-v -s "$JB_CERT" --options=runtime \
|
||||
--entitlements entitlements.xml "$f"
|
||||
done
|
||||
fi
|
||||
|
||||
log "Signing libraries in jars in $PWD"
|
||||
|
||||
# todo: add set -euo pipefail; into the inner sh -c
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
diff --git modules.list modules.list
|
||||
index e23d793..368d022 100644
|
||||
index 33375b527c4..76539cbc0e0 100644
|
||||
--- modules.list
|
||||
+++ modules.list
|
||||
@@ -54,4 +54,7 @@ jdk.security.jgss,
|
||||
jdk.unsupported,
|
||||
@@ -55,4 +55,7 @@ jdk.unsupported,
|
||||
jdk.xml.dom,
|
||||
jdk.zipfs,
|
||||
-jdk.hotspot.agent
|
||||
+jdk.hotspot.agent,
|
||||
jdk.hotspot.agent,
|
||||
-jdk.jcmd
|
||||
+jdk.jcmd,
|
||||
+jcef,
|
||||
+gluegen.rt,
|
||||
+jogl.all
|
||||
diff --git src/java.desktop/share/classes/module-info.java src/java.desktop/share/classes/module-info.java
|
||||
index b663b38..3e9acdc 100644
|
||||
index b663b382f52..3e9acdc0c27 100644
|
||||
--- src/java.desktop/share/classes/module-info.java
|
||||
+++ src/java.desktop/share/classes/module-info.java
|
||||
@@ -109,7 +109,11 @@ module java.desktop {
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
diff --git modules.list modules.list
|
||||
index e23d793ca61..14b9a6c8e50 100644
|
||||
--- modules.list
|
||||
+++ modules.list
|
||||
@@ -20,6 +20,13 @@ java.sql.rowset,
|
||||
java.transaction.xa,
|
||||
java.xml,
|
||||
java.xml.crypto,
|
||||
+javafx.base,
|
||||
+javafx.controls,
|
||||
+javafx.fxml,
|
||||
+javafx.graphics,
|
||||
+javafx.media,
|
||||
+javafx.swing,
|
||||
+javafx.web,
|
||||
jdk.accessibility,
|
||||
jdk.aot,
|
||||
jdk.attach,
|
||||
@@ -0,0 +1,31 @@
|
||||
From 62fc66fa74886bd8bb15cd3e2084175f7ad5d0c7 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 5 Feb 2021 23:30:49 +0100
|
||||
Subject: [PATCH 19/19] Disable AllowEnhancedClassRedefinition in flight
|
||||
recorder
|
||||
|
||||
---
|
||||
src/hotspot/share/runtime/arguments.cpp | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
|
||||
index 5053ad7ee61..c5635bb8537 100644
|
||||
--- a/src/hotspot/share/runtime/arguments.cpp
|
||||
+++ b/src/hotspot/share/runtime/arguments.cpp
|
||||
@@ -3962,6 +3962,13 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
||||
// Set object alignment values.
|
||||
set_object_alignment();
|
||||
|
||||
+ if (FlightRecorder) {
|
||||
+ if (AllowEnhancedClassRedefinition) {
|
||||
+ warning("EnhancedClassRedefinition was disabled, it is not allowed in FlightRecorder.");
|
||||
+ AllowEnhancedClassRedefinition = false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
setup_hotswap_agent();
|
||||
|
||||
#if !INCLUDE_CDS
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built; possible values:
|
||||
# jcef - the release bundles with jcef
|
||||
# jfx - the release bundles with javafx
|
||||
# jcef_jfx - the release bundles with jcef and javafx
|
||||
# dcevm - the release bundles with dcevm patches
|
||||
# nomod - the release bundles without any additional modules (jcef)
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
@@ -43,12 +41,9 @@ function create_jbr {
|
||||
JBR_BUNDLE=jbr_${bundle_type}
|
||||
|
||||
case "${bundle_type}" in
|
||||
"jfx" | "jcef" | "dcevm" | "nomod" | "fd")
|
||||
"jcef" | "dcevm" | "nomod" | "fd")
|
||||
JBR_BASE_NAME=jbr_${bundle_type}-${JBSDK_VERSION}
|
||||
;;
|
||||
"jfx_jcef")
|
||||
JBR_BASE_NAME=jbr-${JBSDK_VERSION}
|
||||
;;
|
||||
*)
|
||||
echo "***ERR*** bundle was not specified" && do_exit 1
|
||||
;;
|
||||
@@ -73,19 +68,10 @@ WITH_DEBUG_LEVEL="--with-debug-level=release"
|
||||
RELEASE_NAME=windows-x86_64-normal-server-release
|
||||
JBSDK=${JBRSDK_BASE_NAME}-windows-x64-b${build_number}
|
||||
case "$bundle_type" in
|
||||
"jfx")
|
||||
git apply -p0 < jb/project/tools/patches/add_jfx_module.patch || do_exit $?
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"jcef")
|
||||
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"jfx_jcef")
|
||||
git apply -p0 < jb/project/tools/patches/add_jfx_module.patch || do_exit $?
|
||||
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"dcevm")
|
||||
HEAD_REVISION=$(git rev-parse HEAD)
|
||||
git am jb/project/tools/patches/dcevm/*.patch || do_exit $?
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to bu built; possible values:
|
||||
# jcef - the bundles 1) jbr with jcef+javafx, 2) jbrsdk and 3) test will be created
|
||||
# jfx - the bundle 1) jbr with javafx only will be created
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built; possible values:
|
||||
# jcef - the release bundles with jcef
|
||||
# jfx - the release bundles with javafx
|
||||
# jcef_jfx - the release bundles with jcef and javafx
|
||||
# dcevm - the release bundles with dcevm patches
|
||||
# nomod - the release bundles without any additional modules (jcef)
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
@@ -38,12 +36,9 @@ function pack_jbr {
|
||||
JBR_BUNDLE=jbr_${bundle_type}
|
||||
|
||||
case "${bundle_type}" in
|
||||
"jfx" | "jcef" | "dcevm" | "nomod" | "fd")
|
||||
"jcef" | "dcevm" | "nomod" | "fd")
|
||||
JBR_BASE_NAME=jbr_${bundle_type}-${JBSDK_VERSION}
|
||||
;;
|
||||
"jfx_jcef")
|
||||
JBR_BASE_NAME=jbr-${JBSDK_VERSION}
|
||||
;;
|
||||
*)
|
||||
echo "***ERR*** bundle was not specified" && do_exit 1
|
||||
;;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to bu built; possible values:
|
||||
# jcef - the bundles 1) jbr with jcef+javafx, 2) jbrsdk and 3) test will be created
|
||||
# jfx - the bundle 1) jbr with javafx only will be created
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
|
||||
@@ -99,6 +99,8 @@ apt_help() {
|
||||
PKGHANDLER_COMMAND="sudo apt-get install libfontconfig1-dev" ;;
|
||||
freetype)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install libfreetype6-dev" ;;
|
||||
harfbuzz)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install libharfbuzz-dev" ;;
|
||||
ffi)
|
||||
PKGHANDLER_COMMAND="sudo apt-get install libffi-dev" ;;
|
||||
x11)
|
||||
@@ -124,6 +126,8 @@ yum_help() {
|
||||
PKGHANDLER_COMMAND="sudo yum install fontconfig-devel" ;;
|
||||
freetype)
|
||||
PKGHANDLER_COMMAND="sudo yum install freetype-devel" ;;
|
||||
harfbuzz)
|
||||
PKGHANDLER_COMMAND="sudo yum install harfbuzz-devel" ;;
|
||||
x11)
|
||||
PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel" ;;
|
||||
ccache)
|
||||
|
||||
@@ -37,6 +37,7 @@ AC_DEFUN_ONCE([LIB_SETUP_BUNDLED_LIBS],
|
||||
LIB_SETUP_LIBPNG
|
||||
LIB_SETUP_ZLIB
|
||||
LIB_SETUP_LCMS
|
||||
LIB_SETUP_HARFBUZZ
|
||||
])
|
||||
|
||||
################################################################################
|
||||
@@ -260,3 +261,43 @@ AC_DEFUN_ONCE([LIB_SETUP_LCMS],
|
||||
AC_SUBST(LCMS_CFLAGS)
|
||||
AC_SUBST(LCMS_LIBS)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
# Setup harfbuzz
|
||||
################################################################################
|
||||
AC_DEFUN_ONCE([LIB_SETUP_HARFBUZZ],
|
||||
[
|
||||
AC_ARG_WITH(harfbuzz, [AS_HELP_STRING([--with-harfbuzz],
|
||||
[use harfbuzz from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
|
||||
|
||||
AC_MSG_CHECKING([for which harfbuzz to use])
|
||||
|
||||
DEFAULT_HARFBUZZ=bundled
|
||||
# If user didn't specify, use DEFAULT_HARFBUZZ
|
||||
if test "x${with_harfbuzz}" = "x"; then
|
||||
with_harfbuzz=${DEFAULT_HARFBUZZ}
|
||||
fi
|
||||
|
||||
if test "x${with_harfbuzz}" = "xbundled"; then
|
||||
USE_EXTERNAL_HARFBUZZ=false
|
||||
HARFBUZZ_CFLAGS=""
|
||||
HARFBUZZ_LIBS=""
|
||||
AC_MSG_RESULT([bundled])
|
||||
elif test "x${with_harfbuzz}" = "xsystem"; then
|
||||
AC_MSG_RESULT([system])
|
||||
PKG_CHECK_MODULES([HARFBUZZ], [harfbuzz], [HARFBUZZ_FOUND=yes], [HARFBUZZ_FOUND=no])
|
||||
if test "x${HARFBUZZ_FOUND}" = "xyes"; then
|
||||
# PKG_CHECK_MODULES will set HARFBUZZ_CFLAGS and HARFBUZZ_LIBS
|
||||
USE_EXTERNAL_HARFBUZZ=true
|
||||
else
|
||||
HELP_MSG_MISSING_DEPENDENCY([harfbuzz])
|
||||
AC_MSG_ERROR([--with-harfbuzz=system specified, but no harfbuzz found! $HELP_MSG])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([Invalid value for --with-harfbuzz: ${with_harfbuzz}, use 'system' or 'bundled'])
|
||||
fi
|
||||
|
||||
AC_SUBST(USE_EXTERNAL_HARFBUZZ)
|
||||
AC_SUBST(HARFBUZZ_CFLAGS)
|
||||
AC_SUBST(HARFBUZZ_LIBS)
|
||||
])
|
||||
|
||||
@@ -832,6 +832,10 @@ USE_EXTERNAL_LCMS:=@USE_EXTERNAL_LCMS@
|
||||
LCMS_CFLAGS:=@LCMS_CFLAGS@
|
||||
LCMS_LIBS:=@LCMS_LIBS@
|
||||
|
||||
USE_EXTERNAL_HARFBUZZ:=@USE_EXTERNAL_HARFBUZZ@
|
||||
HARFBUZZ_CFLAGS:=@HARFBUZZ_CFLAGS@
|
||||
HARFBUZZ_LIBS:=@HARFBUZZ_LIBS@
|
||||
|
||||
USE_EXTERNAL_LIBPNG:=@USE_EXTERNAL_LIBPNG@
|
||||
PNG_LIBS:=@PNG_LIBS@
|
||||
PNG_CFLAGS:=@PNG_CFLAGS@
|
||||
|
||||
@@ -73,6 +73,10 @@ ifeq ($(FREETYPE_TO_USE), system)
|
||||
LEGAL_EXCLUDES += freetype.md
|
||||
endif
|
||||
|
||||
ifeq ($(USE_EXTERNAL_HARFBUZZ), true)
|
||||
LEGAL_EXCLUDES += harfbuzz.md
|
||||
endif
|
||||
|
||||
$(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \
|
||||
EXCLUDES := $(LEGAL_EXCLUDES), \
|
||||
))
|
||||
|
||||
@@ -571,34 +571,106 @@ endif
|
||||
|
||||
###########################################################################
|
||||
|
||||
#### Begin harfbuzz configuration
|
||||
ifeq ($(USE_EXTERNAL_HARFBUZZ), true)
|
||||
LIBHARFBUZZ_LIBS := $(HARFBUZZ_LIBS)
|
||||
else
|
||||
HARFBUZZ_CFLAGS := -DHAVE_OT -DHAVE_FALLBACK -DHAVE_UCDN -DHAVE_ROUND
|
||||
# This is better than adding EXPORT_ALL_SYMBOLS
|
||||
ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang solstudio), )
|
||||
HARFBUZZ_CFLAGS += -DHB_EXTERN=__attribute__\(\(visibility\(\"default\"\)\)\)
|
||||
else ifeq ($(TOOLCHAIN_TYPE), microsoft)
|
||||
HARFBUZZ_CFLAGS += -DHB_EXTERN=__declspec\(dllexport\)
|
||||
endif
|
||||
|
||||
HARFBUZZ_CFLAGS := -DHAVE_OT -DHAVE_FALLBACK -DHAVE_UCDN -DHAVE_ROUND
|
||||
LIBHARFBUZZ_LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN)
|
||||
ifeq ($(TOOLCHAIN_TYPE), gcc)
|
||||
ifeq ($(CC_VERSION_NUMBER), 4.4.7)
|
||||
LIBHARFBUZZ_LDFLAGS := $(subst -Xlinker -z -Xlinker defs,, \
|
||||
$(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB))) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(OPENJDK_TARGET_OS), windows)
|
||||
HARFBUZZ_CFLAGS += -DGETPAGESIZE -DHAVE_MPROTECT -DHAVE_PTHREAD \
|
||||
-DHAVE_SYSCONF -DHAVE_SYS_MMAN_H -DHAVE_UNISTD_H \
|
||||
-DHB_NO_PRAGMA_GCC_DIAGNOSTIC
|
||||
endif
|
||||
ifneq (, $(findstring $(OPENJDK_TARGET_OS), linux macosx))
|
||||
HARFBUZZ_CFLAGS += -DHAVE_INTEL_ATOMIC_PRIMITIVES
|
||||
endif
|
||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
HARFBUZZ_CFLAGS += -DHAVE_SOLARIS_ATOMIC_OPS
|
||||
endif
|
||||
|
||||
LIBHARFBUZZ_EXCLUDE_FILES += harfbuzz/hb-coretext.cc
|
||||
|
||||
# hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
|
||||
LIBHARFBUZZ_EXCLUDE_FILES += harfbuzz/hb-ft.cc
|
||||
|
||||
LIBHARFBUZZ_CFLAGS += $(HARFBUZZ_CFLAGS)
|
||||
|
||||
# For use by libfontmanager:
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
LIBHARFBUZZ_LIBS := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjharfbuzz/jharfbuzz.lib
|
||||
else ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
LIBHARFBUZZ_LIBS := -ljharfbuzz
|
||||
endif
|
||||
|
||||
LIBHARFBUZZ_EXTRA_HEADER_DIRS := \
|
||||
libjharfbuzz/hb-ucdn \
|
||||
#
|
||||
|
||||
LIBHARFBUZZ_OPTIMIZATION := HIGH
|
||||
|
||||
LIBHARFBUZZ_CFLAGS += $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS
|
||||
|
||||
$(eval $(call SetupJdkLibrary, BUILD_LIBHARFBUZZ, \
|
||||
NAME := jharfbuzz, \
|
||||
EXCLUDE_FILES := $(LIBHARFBUZZ_EXCLUDE_FILES), \
|
||||
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) $(LIBHARFBUZZ_CFLAGS), \
|
||||
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBHARFBUZZ_CFLAGS), \
|
||||
OPTIMIZATION := $(LIBHARFBUZZ_OPTIMIZATION), \
|
||||
CFLAGS_windows = -DCC_NOEX, \
|
||||
EXTRA_HEADER_DIRS := $(LIBHARFBUZZ_EXTRA_HEADER_DIRS), \
|
||||
WARNINGS_AS_ERRORS_xlc := false, \
|
||||
DISABLED_WARNINGS_gcc := type-limits missing-field-initializers strict-aliasing, \
|
||||
DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
|
||||
maybe-uninitialized class-memaccess, \
|
||||
DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
|
||||
tautological-constant-out-of-range-compare int-to-pointer-cast \
|
||||
undef missing-field-initializers, \
|
||||
DISABLED_WARNINGS_C_solstudio := \
|
||||
E_INTEGER_OVERFLOW_DETECTED \
|
||||
E_ARG_INCOMPATIBLE_WITH_ARG_L \
|
||||
E_ENUM_VAL_OVERFLOWS_INT_MAX, \
|
||||
DISABLED_WARNINGS_CXX_solstudio := \
|
||||
truncwarn wvarhidenmem wvarhidemem wbadlkginit identexpected \
|
||||
hidevf w_novirtualdescr arrowrtn2 unknownpragma, \
|
||||
DISABLED_WARNINGS_microsoft := 4267 4244 4090 4146 4334 4819 4101 4068 4805 4138, \
|
||||
LDFLAGS := $(LIBHARFBUZZ_LDFLAGS), \
|
||||
LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
|
||||
LDFLAGS_aix := -Wl$(COMMA)-berok, \
|
||||
LIBS := $(BUILD_LIBHARFBUZZ), \
|
||||
LIBS_unix := $(LIBM) $(LIBCXX), \
|
||||
LIBS_macosx := -framework CoreText -framework CoreFoundation -framework CoreGraphics, \
|
||||
LIBS_windows := user32.lib, \
|
||||
))
|
||||
|
||||
ifeq ($(FREETYPE_TO_USE), bundled)
|
||||
$(BUILD_LIBHARFBUZZ): $(BUILD_LIBFREETYPE)
|
||||
endif
|
||||
|
||||
TARGETS += $(BUILD_LIBHARFBUZZ)
|
||||
|
||||
ifneq ($(OPENJDK_TARGET_OS), windows)
|
||||
HARFBUZZ_CFLAGS += -DGETPAGESIZE -DHAVE_MPROTECT -DHAVE_PTHREAD \
|
||||
-DHAVE_SYSCONF -DHAVE_SYS_MMAN_H -DHAVE_UNISTD_H \
|
||||
-DHB_NO_PRAGMA_GCC_DIAGNOSTIC
|
||||
endif
|
||||
ifneq (, $(findstring $(OPENJDK_TARGET_OS), linux macosx))
|
||||
HARFBUZZ_CFLAGS += -DHAVE_INTEL_ATOMIC_PRIMITIVES
|
||||
endif
|
||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
HARFBUZZ_CFLAGS += -DHAVE_SOLARIS_ATOMIC_OPS
|
||||
endif
|
||||
|
||||
LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-coretext.cc
|
||||
|
||||
# hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
|
||||
LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-ft.cc
|
||||
|
||||
LIBFONTMANAGER_CFLAGS += $(HARFBUZZ_CFLAGS)
|
||||
|
||||
#### End harfbuzz configuration
|
||||
###########################################################################
|
||||
|
||||
LIBFONTMANAGER_EXTRA_HEADER_DIRS := \
|
||||
libfontmanager/harfbuzz \
|
||||
libfontmanager/harfbuzz/hb-ucdn \
|
||||
libjharfbuzz \
|
||||
common/awt \
|
||||
common/font \
|
||||
libawt/java2d \
|
||||
@@ -606,8 +678,8 @@ LIBFONTMANAGER_EXTRA_HEADER_DIRS := \
|
||||
libawt/java2d/loops \
|
||||
#
|
||||
|
||||
LIBFONTMANAGER_CFLAGS += $(LIBFREETYPE_CFLAGS)
|
||||
BUILD_LIBFONTMANAGER_FONTLIB += $(LIBFREETYPE_LIBS)
|
||||
LIBFONTMANAGER_CFLAGS += $(LIBFREETYPE_CFLAGS) $(HARFBUZZ_FLAGS)
|
||||
BUILD_LIBFONTMANAGER_FONTLIB += $(LIBHARFBUZZ_LIBS) $(LIBFREETYPE_LIBS)
|
||||
|
||||
LIBFONTMANAGER_OPTIMIZATION := HIGH
|
||||
|
||||
@@ -650,20 +722,16 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
|
||||
CFLAGS_windows = -DCC_NOEX, \
|
||||
EXTRA_HEADER_DIRS := $(LIBFONTMANAGER_EXTRA_HEADER_DIRS), \
|
||||
WARNINGS_AS_ERRORS_xlc := false, \
|
||||
DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
|
||||
type-limits missing-field-initializers implicit-fallthrough strict-aliasing, \
|
||||
DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
|
||||
maybe-uninitialized, \
|
||||
DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
|
||||
tautological-constant-out-of-range-compare int-to-pointer-cast, \
|
||||
DISABLED_WARNINGS_C_solstudio = \
|
||||
DISABLED_WARNINGS_gcc := sign-compare unused-function int-to-pointer-cast, \
|
||||
DISABLED_WARNINGS_clang := sign-compare, \
|
||||
DISABLED_WARNINGS_C_solstudio := \
|
||||
E_INTEGER_OVERFLOW_DETECTED \
|
||||
E_ARG_INCOMPATIBLE_WITH_ARG_L \
|
||||
E_ENUM_VAL_OVERFLOWS_INT_MAX, \
|
||||
DISABLED_WARNINGS_CXX_solstudio := \
|
||||
truncwarn wvarhidenmem wvarhidemem wbadlkginit identexpected \
|
||||
hidevf w_novirtualdescr arrowrtn2 unknownpragma, \
|
||||
DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090 4996 4146 4334 4819 4101 4068 4805 4138, \
|
||||
DISABLED_WARNINGS_microsoft := 4018 4146 4244 4996 4996 4146 4334 4819 4101 4068 4805 4138, \
|
||||
LDFLAGS := $(subst -Xlinker -z -Xlinker defs,, \
|
||||
$(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB))) $(LDFLAGS_CXX_JDK) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
@@ -671,14 +739,17 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
|
||||
LDFLAGS_aix := -Wl$(COMMA)-berok, \
|
||||
LIBS := $(BUILD_LIBFONTMANAGER_FONTLIB), \
|
||||
LIBS_unix := -lawt -ljava -ljvm $(LIBM) $(LIBCXX), \
|
||||
LIBS_macosx := -lawt_lwawt -framework CoreText -framework CoreFoundation \
|
||||
-framework CoreGraphics, \
|
||||
LIBS_macosx := -lawt_lwawt, \
|
||||
LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
|
||||
$(WIN_AWT_LIB), \
|
||||
))
|
||||
|
||||
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
|
||||
|
||||
ifeq ($(USE_EXTERNAL_HARFBUZZ), false)
|
||||
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBHARFBUZZ)
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
$(BUILD_LIBFONTMANAGER): $(call FindLib, $(MODULE), awt_lwawt)
|
||||
endif
|
||||
|
||||
@@ -54,4 +54,5 @@ jdk.security.jgss,
|
||||
jdk.unsupported,
|
||||
jdk.xml.dom,
|
||||
jdk.zipfs,
|
||||
jdk.hotspot.agent
|
||||
jdk.hotspot.agent,
|
||||
jdk.jcmd
|
||||
|
||||
@@ -736,16 +736,17 @@ public final class SSLSocketImpl
|
||||
// Is it ready to close inbound?
|
||||
//
|
||||
// No need to throw exception if the initial handshake is not started.
|
||||
if (checkCloseNotify && !conContext.isInputCloseNotified &&
|
||||
(conContext.isNegotiated || conContext.handshakeContext != null)) {
|
||||
|
||||
throw conContext.fatal(Alert.INTERNAL_ERROR,
|
||||
try {
|
||||
if (checkCloseNotify && !conContext.isInputCloseNotified &&
|
||||
(conContext.isNegotiated || conContext.handshakeContext != null)) {
|
||||
throw new SSLException(
|
||||
"closing inbound before receiving peer's close_notify");
|
||||
}
|
||||
|
||||
conContext.closeInbound();
|
||||
if ((autoClose || !isLayered()) && !super.isInputShutdown()) {
|
||||
super.shutdownInput();
|
||||
}
|
||||
} finally {
|
||||
conContext.closeInbound();
|
||||
if ((autoClose || !isLayered()) && !super.isInputShutdown()) {
|
||||
super.shutdownInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -944,9 +944,12 @@ class WindowsNativeDispatcher {
|
||||
CreateSymbolicLink0(linkBuffer.address(),
|
||||
targetBuffer.address(), flags);
|
||||
return;
|
||||
} catch (WindowsException ignored) {
|
||||
} catch (WindowsException xx) {
|
||||
// Will fail with ERROR_INVALID_PARAMETER for Windows
|
||||
// builds older than 14972.
|
||||
if (xx.lastError() != ERROR_INVALID_PARAMETER) {
|
||||
x = xx;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw x;
|
||||
|
||||
@@ -100,6 +100,17 @@ final class ScreenMenuItem extends MenuItem
|
||||
fMenuItem.removeComponentListener(this);
|
||||
}
|
||||
|
||||
static void syncAcceleratorText(MenuItem menuItem, JMenuItem fMenuItem) {
|
||||
Object acceleratorText = fMenuItem.getClientProperty("accelerator.text");
|
||||
if (acceleratorText instanceof String) {
|
||||
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(menuItem);
|
||||
if (peer instanceof CMenuItem) {
|
||||
final CMenuItem cmi = (CMenuItem) peer;
|
||||
cmi.setAcceleratorText((String)acceleratorText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) {
|
||||
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(menuItem);
|
||||
if (!(peer instanceof CMenuItem)) {
|
||||
@@ -123,6 +134,12 @@ final class ScreenMenuItem extends MenuItem
|
||||
@Override
|
||||
public void setAccelerator(final KeyStroke ks) {
|
||||
syncLabelAndKS(this, fMenuItem.getText(), ks);
|
||||
syncAcceleratorText(this, fMenuItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAcceleratorText(String acceleratorText) {
|
||||
syncAcceleratorText(this, fMenuItem);
|
||||
}
|
||||
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
|
||||
@@ -123,6 +123,12 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem
|
||||
@Override
|
||||
public void setAccelerator(final KeyStroke ks) {
|
||||
ScreenMenuItem.syncLabelAndKS(this, fMenuItem.getText(), ks);
|
||||
ScreenMenuItem.syncAcceleratorText(this, fMenuItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAcceleratorText(String acceleratorText) {
|
||||
ScreenMenuItem.syncAcceleratorText(this, fMenuItem);
|
||||
}
|
||||
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
|
||||
@@ -36,6 +36,7 @@ interface ScreenMenuPropertyHandler {
|
||||
public void setLabel(String f);
|
||||
public void setIcon(Icon icon);
|
||||
public void setAccelerator(KeyStroke ks);
|
||||
default void setAcceleratorText(String acceleratorText) {}
|
||||
public void setToolTipText(String tooltip);
|
||||
public void setChildVisible(javax.swing.JMenuItem child, boolean b);
|
||||
public void setIndeterminate(boolean indeterminate);
|
||||
|
||||
@@ -67,6 +67,11 @@ class ScreenMenuPropertyListener implements PropertyChangeListener {
|
||||
return;
|
||||
}
|
||||
|
||||
if ("accelerator.text".equals(propertyName)) {
|
||||
fMenu.setAcceleratorText((String)e.getNewValue());
|
||||
return;
|
||||
}
|
||||
|
||||
if (AbstractButton.TEXT_CHANGED_PROPERTY.equals(propertyName)) {
|
||||
fMenu.setLabel((String)e.getNewValue());
|
||||
return;
|
||||
|
||||
@@ -234,6 +234,7 @@ public class LWWindowPeer
|
||||
|
||||
setOpaque(getTarget().isOpaque());
|
||||
|
||||
updateInsets(platformWindow.getInsets());
|
||||
if (getSurfaceData() == null) {
|
||||
replaceSurfaceData(false);
|
||||
}
|
||||
@@ -310,7 +311,6 @@ public class LWWindowPeer
|
||||
}
|
||||
}
|
||||
}
|
||||
updateInsets(platformWindow.getInsets());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -104,6 +104,10 @@ public class CMenuItem extends CMenuComponent implements MenuItemPeer {
|
||||
setLabel(label, (char)0, KeyEvent.VK_UNDEFINED, 0);
|
||||
}
|
||||
|
||||
public void setAcceleratorText(String acceleratorText) {
|
||||
execute(ptr -> nativeSetAcceleratorText(ptr, acceleratorText));
|
||||
}
|
||||
|
||||
/**
|
||||
* This is new API that we've added to AWT menu items
|
||||
* because AWT menu items are used for Swing screen menu bars
|
||||
@@ -150,6 +154,7 @@ public class CMenuItem extends CMenuComponent implements MenuItemPeer {
|
||||
private native void nativeSetImage(long modelPtr, long image);
|
||||
private native void nativeSetTooltip(long modelPtr, String text);
|
||||
private native void nativeSetEnabled(long modelPtr, boolean b);
|
||||
private native void nativeSetAcceleratorText(long modelPtr, String acceleratorText);
|
||||
|
||||
// native callbacks
|
||||
void handleAction(final long when, final int modifiers) {
|
||||
|
||||
@@ -95,7 +95,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
double x, double y, double w, double h);
|
||||
private static native void nativeSetNSWindowMinMax(long nsWindowPtr, double minW, double minH, double maxW, double maxH);
|
||||
private static native void nativePushNSWindowToBack(long nsWindowPtr);
|
||||
private static native void nativePushNSWindowToFront(long nsWindowPtr);
|
||||
private static native void nativePushNSWindowToFront(long nsWindowPtr, boolean wait);
|
||||
private static native void nativeSetNSWindowTitle(long nsWindowPtr, String title);
|
||||
private static native void nativeRevalidateNSWindowShadow(long nsWindowPtr);
|
||||
private static native void nativeSetNSWindowMinimizedIcon(long nsWindowPtr, long nsImage);
|
||||
@@ -683,7 +683,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
|
||||
@Override // PlatformWindow
|
||||
public void setBounds(int x, int y, int w, int h) {
|
||||
execute(ptr -> AWTThreading.executeWaitToolkit(() -> nativeSetNSWindowBounds(ptr, x, y, w, h)));
|
||||
execute(ptr -> nativeSetNSWindowBounds(ptr, x, y, w, h));
|
||||
}
|
||||
|
||||
public void setMaximizedBounds(int x, int y, int w, int h) {
|
||||
@@ -919,7 +919,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
lwcToolkit.activateApplicationIgnoringOtherApps();
|
||||
}
|
||||
updateFocusabilityForAutoRequestFocus(false);
|
||||
execute(CPlatformWindow::nativePushNSWindowToFront);
|
||||
execute(ptr -> AWTThreading.executeWaitToolkit(wait -> nativePushNSWindowToFront(ptr, wait)));
|
||||
updateFocusabilityForAutoRequestFocus(true);
|
||||
}
|
||||
|
||||
@@ -1265,11 +1265,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
: SHOULD_BECOME_KEY | SHOULD_BECOME_MAIN;
|
||||
}
|
||||
|
||||
private boolean isBlocked() {
|
||||
LWWindowPeer blocker = (peer != null) ? peer.getBlocker() : null;
|
||||
return (blocker != null);
|
||||
}
|
||||
|
||||
/*
|
||||
* An utility method for the support of the auto request focus.
|
||||
* Updates the focusable state of the window under certain
|
||||
|
||||
@@ -47,7 +47,9 @@ final class CWrapper {
|
||||
// 'level' is one of the keys defined above
|
||||
static native void setLevel(long window, int level);
|
||||
|
||||
static native void makeKeyAndOrderFront(long window);
|
||||
static void makeKeyAndOrderFront(long window) {
|
||||
AWTThreading.executeWaitToolkit(wait -> nativeMakeKeyAndOrderFront(window, wait));
|
||||
}
|
||||
static native void makeMainWindow(long window);
|
||||
static native boolean canBecomeMainWindow(long window);
|
||||
static native boolean isKeyWindow(long window);
|
||||
@@ -62,10 +64,11 @@ final class CWrapper {
|
||||
* @param window the pointer of the NSWindow
|
||||
*/
|
||||
static void orderOut(long window) {
|
||||
AWTThreading.executeWaitToolkit(() -> nativeOrderOut(window));
|
||||
AWTThreading.executeWaitToolkit(wait -> nativeOrderOut(window, wait));
|
||||
}
|
||||
|
||||
private static native void nativeOrderOut(long window);
|
||||
private static native void nativeOrderOut(long window, boolean wait);
|
||||
private static native void nativeMakeKeyAndOrderFront(long window, boolean wait);
|
||||
|
||||
/**
|
||||
* Removes the window from the screen and releases it. According to
|
||||
|
||||
@@ -564,21 +564,6 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
// Tests whether window is blocked by modal dialog/window
|
||||
- (BOOL) isBlocked {
|
||||
BOOL isBlocked = NO;
|
||||
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
|
||||
if (platformWindow != NULL) {
|
||||
static JNF_MEMBER_CACHE(jm_isBlocked, jc_CPlatformWindow, "isBlocked", "()Z");
|
||||
isBlocked = JNFCallBooleanMethod(env, platformWindow, jm_isBlocked) == JNI_TRUE ? YES : NO;
|
||||
(*env)->DeleteLocalRef(env, platformWindow);
|
||||
}
|
||||
|
||||
return isBlocked;
|
||||
}
|
||||
|
||||
// Test whether window is simple window and owned by embedded frame
|
||||
- (BOOL) isSimpleWindowOwnedByEmbeddedFrame {
|
||||
BOOL isSimpleWindowOwnedByEmbeddedFrame = NO;
|
||||
@@ -618,9 +603,8 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
- (void) orderChildWindows:(BOOL)focus {
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
if (self.isMinimizing || [self isBlocked]) {
|
||||
if (self.isMinimizing) {
|
||||
// Do not perform any ordering, if iconify is in progress
|
||||
// or the window is blocked by a modal window
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1046,21 +1030,6 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
- (void)sendEvent:(NSEvent *)event {
|
||||
if ([event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown) {
|
||||
if ([self isBlocked]) {
|
||||
// Move parent windows to front and make sure that a child window is displayed
|
||||
// in front of its nearest parent.
|
||||
if (self.ownerWindow != nil) {
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
|
||||
jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
|
||||
if (platformWindow != NULL) {
|
||||
static JNF_MEMBER_CACHE(jm_orderAboveSiblings, jc_CPlatformWindow, "orderAboveSiblings", "()V");
|
||||
JNFCallVoidMethod(env,platformWindow, jm_orderAboveSiblings);
|
||||
(*env)->DeleteLocalRef(env, platformWindow);
|
||||
}
|
||||
}
|
||||
[self orderChildWindows:YES];
|
||||
}
|
||||
|
||||
NSPoint p = [NSEvent mouseLocation];
|
||||
NSRect frame = [self.nsWindow frame];
|
||||
NSRect contentRect = [self.nsWindow contentRectForFrameRect:frame];
|
||||
@@ -1334,7 +1303,7 @@ JNF_COCOA_ENTER(env);
|
||||
|
||||
// TODO: not sure we need displayIfNeeded message in our view
|
||||
NSWindow *nsWindow = OBJC(windowPtr);
|
||||
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
|
||||
AWTWindow *window = (AWTWindow*)[nsWindow delegate];
|
||||
|
||||
@@ -1479,15 +1448,15 @@ JNF_COCOA_EXIT(env);
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CPlatformWindow
|
||||
* Method: nativePushNSWindowToFront
|
||||
* Signature: (J)V
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativePushNSWindowToFront
|
||||
(JNIEnv *env, jclass clazz, jlong windowPtr)
|
||||
(JNIEnv *env, jclass clazz, jlong windowPtr, jboolean wait)
|
||||
{
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
NSWindow *nsWindow = OBJC(windowPtr);
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
[ThreadUtilities performOnMainThreadWaiting:(BOOL)wait block:^(){
|
||||
|
||||
if (![nsWindow isKeyWindow]) {
|
||||
[nsWindow makeKeyAndOrderFront:nsWindow];
|
||||
|
||||
@@ -169,44 +169,25 @@ canChooseDirectories:(BOOL)inChooseDirectories
|
||||
[thePanel setAppearance:fOwner.appearance];
|
||||
}
|
||||
|
||||
void (^onComplete)(BOOL, BOOL) = ^(BOOL responseOK, BOOL doStopModal) {
|
||||
if (responseOK) {
|
||||
NSOpenPanel *openPanel = (NSOpenPanel *)thePanel;
|
||||
fURLs = (fMode == java_awt_FileDialog_LOAD)
|
||||
? [openPanel URLs]
|
||||
: [NSArray arrayWithObject:[openPanel URL]];
|
||||
fPanelResult = [thePanel runModal];
|
||||
|
||||
fPanelResult = NSFileHandlingPanelOKButton;
|
||||
} else {
|
||||
fURLs = [NSArray array];
|
||||
}
|
||||
[fURLs retain];
|
||||
if (doStopModal)
|
||||
[NSApp stopModal];
|
||||
if (menuBar != nil) {
|
||||
[CMenuBar activate:menuBar modallyDisabled:NO];
|
||||
}
|
||||
};
|
||||
|
||||
[thePanel beginSheetModalForWindow:fOwner completionHandler:^(NSInteger result) {
|
||||
onComplete(result == NSFileHandlingPanelOKButton, YES);
|
||||
}];
|
||||
|
||||
[NSApp runModalForWindow:thePanel];
|
||||
if (menuBar != nil) {
|
||||
[CMenuBar activate:menuBar modallyDisabled:NO];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fPanelResult = [thePanel runModalForDirectory:fDirectory file:fFile];
|
||||
}
|
||||
|
||||
if ([self userClickedOK]) {
|
||||
if (fMode == java_awt_FileDialog_LOAD) {
|
||||
NSOpenPanel *openPanel = (NSOpenPanel *)thePanel;
|
||||
fURLs = [openPanel URLs];
|
||||
} else {
|
||||
fURLs = [NSArray arrayWithObject:[thePanel URL]];
|
||||
}
|
||||
[fURLs retain];
|
||||
if ([self userClickedOK]) {
|
||||
if (fMode == java_awt_FileDialog_LOAD) {
|
||||
NSOpenPanel *openPanel = (NSOpenPanel *)thePanel;
|
||||
fURLs = [openPanel URLs];
|
||||
} else {
|
||||
fURLs = [NSArray arrayWithObject:[thePanel URL]];
|
||||
}
|
||||
[fURLs retain];
|
||||
}
|
||||
|
||||
[thePanel setDelegate:nil];
|
||||
|
||||
@@ -38,6 +38,277 @@
|
||||
|
||||
#define NOT_A_CHECKBOXMENU -2
|
||||
|
||||
@interface CustomMenuItemView : NSView {
|
||||
int16_t fireTimes;
|
||||
BOOL isSelected;
|
||||
NSSize shortcutSize;
|
||||
NSSize textSize;
|
||||
NSTrackingArea * trackingArea;
|
||||
CMenuItem * owner;
|
||||
}
|
||||
|
||||
@property (retain) NSString * keyShortcut;
|
||||
@end
|
||||
|
||||
@implementation CustomMenuItemView
|
||||
|
||||
static CGFloat menuItemHeight = 18.f;
|
||||
static CGFloat marginLeft = 20.f;
|
||||
static CGFloat marginRight = 10.f;
|
||||
|
||||
static CGFloat gapTxtIcon = 5.f;
|
||||
static CGFloat gapTxtShortcut = 23.f;
|
||||
|
||||
static NSFont * menuFont;
|
||||
static NSFont * menuShortcutFont;
|
||||
|
||||
static NSColor * customBg = nil;
|
||||
|
||||
+ (void)initialize {
|
||||
menuFont = [NSFont menuBarFontOfSize:(0)];
|
||||
menuShortcutFont = [NSFont menuBarFontOfSize:(0)];
|
||||
|
||||
NSDictionary * attributes = [NSDictionary dictionaryWithObjectsAndKeys:menuFont, NSFontAttributeName, nil];
|
||||
NSSize qSize = [[[[NSAttributedString alloc] initWithString:@"Q" attributes:attributes] autorelease] size];
|
||||
|
||||
// use empiric proportions (to look like default view)
|
||||
menuItemHeight = qSize.height * 1.1f;
|
||||
marginLeft = menuItemHeight * 1.1f;
|
||||
marginRight = menuItemHeight * 0.55f;
|
||||
|
||||
gapTxtIcon = menuItemHeight * 0.27f;
|
||||
gapTxtShortcut = menuItemHeight * 1.2f;
|
||||
|
||||
// Initialize custom bg color (for light theme with enabled accessibility.reduceTransparency)
|
||||
// If we use transparent bg than we will see visual inconsistency
|
||||
// And it seems that we can't obtain this color from system
|
||||
NSUserDefaults * defs = [NSUserDefaults standardUserDefaults];
|
||||
NSDictionary<NSString *,id> * dict = [defs persistentDomainForName:@"com.apple.universalaccess.plist"];
|
||||
if (dict != nil) {
|
||||
id reduceVal = [dict valueForKey:@"reduceTransparency"];
|
||||
if (reduceVal != nil && [reduceVal isKindOfClass:[NSNumber class]] && [reduceVal intValue] != 0) {
|
||||
NSString * mode = [defs stringForKey:@"AppleInterfaceStyle"];
|
||||
if (mode == nil) { // light system theme
|
||||
customBg = [NSColor colorWithCalibratedWhite:246.f/255 alpha:1.f];
|
||||
[customBg retain];
|
||||
// NSLog(@"\treduceTransparency is enabled (use custom background color for menu items)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NSLog(@"\tmenuItemHeight=%1.2f, marginLeft=%1.2f, marginRight=%1.2f, gapTxtIcon=%1.2f, gapTxtShortcut=%1.2f",
|
||||
// menuItemHeight, marginLeft, marginRight, gapTxtIcon, gapTxtShortcut);
|
||||
}
|
||||
|
||||
- (id)initWithOwner:(CMenuItem *)menuItem {
|
||||
NSRect viewRect = NSMakeRect(0, 0, /* width autoresizes */ 1, menuItemHeight);
|
||||
self = [super initWithFrame:viewRect];
|
||||
if (self == nil) {
|
||||
return self;
|
||||
}
|
||||
|
||||
owner = menuItem;
|
||||
|
||||
self.autoresizingMask = NSViewWidthSizable;
|
||||
self.keyShortcut = nil;
|
||||
|
||||
fireTimes = 0;
|
||||
isSelected = NO;
|
||||
trackingArea = nil;
|
||||
shortcutSize = NSZeroSize;
|
||||
textSize = NSZeroSize;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
if(trackingArea != nil) {
|
||||
[trackingArea release];
|
||||
}
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)mouseEntered:(NSEvent*)event {
|
||||
if ([owner isEnabled] && !isSelected) {
|
||||
isSelected = YES;
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)mouseExited:(NSEvent *)event {
|
||||
if (isSelected) {
|
||||
isSelected = NO;
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)mouseUp:(NSEvent*)event {
|
||||
if (![owner isEnabled])
|
||||
return;
|
||||
|
||||
fireTimes = 0;
|
||||
isSelected = !isSelected;
|
||||
[self setNeedsDisplay:YES];
|
||||
|
||||
NSTimer *timer = [NSTimer timerWithTimeInterval:0.05 target:self selector:@selector(animateDismiss:) userInfo:nil repeats:YES];
|
||||
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSEventTrackingRunLoopMode];
|
||||
}
|
||||
|
||||
-(void)updateTrackingAreas {
|
||||
[super updateTrackingAreas];
|
||||
if(trackingArea != nil) {
|
||||
[self removeTrackingArea:trackingArea];
|
||||
[trackingArea release];
|
||||
}
|
||||
|
||||
int opts = (NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways);
|
||||
trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
|
||||
options:opts
|
||||
owner:self
|
||||
userInfo:nil];
|
||||
[self addTrackingArea:trackingArea];
|
||||
}
|
||||
|
||||
-(void)animateDismiss:(NSTimer *)aTimer {
|
||||
if (fireTimes <= 2) {
|
||||
isSelected = !isSelected;
|
||||
[self setNeedsDisplay:YES];
|
||||
} else {
|
||||
[aTimer invalidate];
|
||||
[self sendAction];
|
||||
}
|
||||
|
||||
fireTimes++;
|
||||
}
|
||||
|
||||
- (void)sendAction {
|
||||
NSMenuItem * mi = owner.menuItem;
|
||||
[NSApp sendAction:[mi action] to:[mi target] from:mi];
|
||||
|
||||
NSMenu *menu = [mi menu];
|
||||
[menu cancelTracking];
|
||||
|
||||
// NOTE: we can also invoke handler directly [owner handleAction:[owner menuItem]];
|
||||
}
|
||||
|
||||
//#define VISUAL_DEBUG_CUSTOM_ITEM_VIEW
|
||||
|
||||
- (void) drawRect:(NSRect)dirtyRect {
|
||||
NSRect rectBounds = [self bounds];
|
||||
NSString * text = owner.menuItem.title;
|
||||
|
||||
#ifdef VISUAL_DEBUG_CUSTOM_ITEM_VIEW
|
||||
[[NSColor yellowColor] set];
|
||||
NSFrameRectWithWidth([self bounds], 1.0f);
|
||||
#endif // VISUAL_DEBUG_CUSTOM_ITEM_VIEW
|
||||
|
||||
const BOOL isEnabled = [owner isEnabled];
|
||||
|
||||
NSColor * textColor = [NSColor textColor];
|
||||
NSColor * bgColor = customBg != nil ? customBg : [NSColor clearColor];
|
||||
if (!isEnabled) {
|
||||
textColor = [NSColor grayColor];
|
||||
} else if (isSelected) {
|
||||
if (@available(macOS 10.14, *)) {
|
||||
bgColor = [NSColor controlAccentColor];
|
||||
} else {
|
||||
bgColor = [NSColor selectedControlColor];
|
||||
}
|
||||
textColor = [NSColor selectedMenuItemTextColor];
|
||||
}
|
||||
|
||||
// 1. draw bg
|
||||
[bgColor set];
|
||||
NSRectFill(rectBounds);
|
||||
|
||||
// 2. draw icon if presented
|
||||
CGFloat x = rectBounds.origin.x + marginLeft;
|
||||
NSImage * image = owner.menuItem.image;
|
||||
if (image != nil) {
|
||||
NSRect imageBounds = rectBounds;
|
||||
imageBounds.origin.x = x;
|
||||
imageBounds.size.width = image.size.width;
|
||||
[image drawInRect:imageBounds];
|
||||
|
||||
x += image.size.width + gapTxtIcon;
|
||||
#ifdef VISUAL_DEBUG_CUSTOM_ITEM_VIEW
|
||||
[[NSColor redColor] set];
|
||||
NSFrameRectWithWidth(imageBounds, 1.0f);
|
||||
#endif // VISUAL_DEBUG_CUSTOM_ITEM_VIEW
|
||||
}
|
||||
|
||||
// 3. draw text
|
||||
[textColor set];
|
||||
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
menuFont, NSFontAttributeName,
|
||||
textColor, NSForegroundColorAttributeName,
|
||||
nil];
|
||||
NSRect txtBounds = rectBounds;
|
||||
txtBounds.origin.x = x;
|
||||
txtBounds.size.width = textSize.width;
|
||||
[text drawInRect:txtBounds withAttributes:attributes];
|
||||
#ifdef VISUAL_DEBUG_CUSTOM_ITEM_VIEW
|
||||
[[NSColor blackColor] set];
|
||||
NSFrameRectWithWidth(txtBounds, 1.0f);
|
||||
#endif // VISUAL_DEBUG_CUSTOM_ITEM_VIEW
|
||||
|
||||
if (self.keyShortcut != nil) {
|
||||
// 4.1 draw shortcut
|
||||
NSRect keyBounds = rectBounds;
|
||||
keyBounds.origin.x = keyBounds.size.width - marginRight - shortcutSize.width;
|
||||
keyBounds.size.width = shortcutSize.width;
|
||||
NSDictionary *keyAttr = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
menuShortcutFont, NSFontAttributeName,
|
||||
textColor, NSForegroundColorAttributeName,
|
||||
nil];
|
||||
[self.keyShortcut drawInRect:keyBounds withAttributes:keyAttr];
|
||||
|
||||
#ifdef VISUAL_DEBUG_CUSTOM_ITEM_VIEW
|
||||
[[NSColor magentaColor] set];
|
||||
NSFrameRectWithWidth(keyBounds, 1.0f);
|
||||
#endif // VISUAL_DEBUG_CUSTOM_ITEM_VIEW
|
||||
} else {
|
||||
if ([owner isKindOfClass:CMenu.class]) {
|
||||
// 4.2 draw arrow-image of submenu
|
||||
NSImage *arrow = [NSImage imageNamed:NSImageNameRightFacingTriangleTemplate]; // TODO: use correct triangle image
|
||||
NSRect arrowBounds = rectBounds;
|
||||
arrowBounds.origin.x = rectBounds.size.width - marginRight - arrow.size.width;
|
||||
arrowBounds.origin.y = rectBounds.origin.y + (rectBounds.size.height - arrow.size.height) / 2;
|
||||
arrowBounds.size = arrow.size;
|
||||
[arrow drawInRect:arrowBounds];
|
||||
#ifdef VISUAL_DEBUG_CUSTOM_ITEM_VIEW
|
||||
[[NSColor magentaColor] set];
|
||||
NSFrameRectWithWidth(arrowBounds, 1.0f);
|
||||
#endif // VISUAL_DEBUG_CUSTOM_ITEM_VIEW
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)recalcSizes {
|
||||
NSString * text = owner.menuItem.title;
|
||||
NSImage * image = owner.menuItem.image;
|
||||
|
||||
NSDictionary * attributes = [NSDictionary dictionaryWithObjectsAndKeys:menuFont, NSFontAttributeName, nil];
|
||||
textSize = [[[[NSAttributedString alloc] initWithString:text attributes:attributes] autorelease] size];
|
||||
|
||||
NSSize resultSize = NSMakeSize(textSize.width + marginLeft + marginRight, menuItemHeight);
|
||||
|
||||
if (image != nil) {
|
||||
NSSize imgSize = image.size;
|
||||
resultSize.width += imgSize.width + gapTxtIcon;
|
||||
}
|
||||
|
||||
if (self.keyShortcut != nil) {
|
||||
NSDictionary * ksa = [NSDictionary dictionaryWithObjectsAndKeys:menuShortcutFont, NSFontAttributeName, nil];
|
||||
shortcutSize = [[[[NSAttributedString alloc] initWithString:self.keyShortcut attributes:ksa] autorelease] size];
|
||||
resultSize.width += shortcutSize.width + gapTxtShortcut;
|
||||
}
|
||||
|
||||
[self.widthAnchor constraintGreaterThanOrEqualToConstant:resultSize.width].active = YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CMenuItem
|
||||
|
||||
@@ -140,6 +411,20 @@
|
||||
|
||||
}
|
||||
|
||||
- (void) setAcceleratorText:(NSString *)acceleratorText {
|
||||
if ([acceleratorText isEqualToString:@""]) {
|
||||
acceleratorText = nil;
|
||||
}
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
CustomMenuItemView *menuItemView = fMenuItem.view;
|
||||
if (menuItemView == nil) {
|
||||
fMenuItem.view = menuItemView = [[[CustomMenuItemView alloc] initWithOwner:self] autorelease];
|
||||
}
|
||||
menuItemView.keyShortcut = acceleratorText;
|
||||
[menuItemView recalcSizes];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void) setJavaLabel:(NSString *)theLabel shortcut:(NSString *)theKeyEquivalent modifierMask:(jint)modifiers {
|
||||
|
||||
NSUInteger modifierMask = 0;
|
||||
@@ -166,13 +451,18 @@
|
||||
[fMenuItem setKeyEquivalent:theKeyEquivalent];
|
||||
[fMenuItem setKeyEquivalentModifierMask:modifierMask];
|
||||
[fMenuItem setTitle:theLabel];
|
||||
if ([fMenuItem.view isKindOfClass:CustomMenuItemView.class]) {
|
||||
[(CustomMenuItemView *)fMenuItem.view recalcSizes];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void) setJavaImage:(NSImage *)theImage {
|
||||
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
[fMenuItem setImage:theImage];
|
||||
if ([fMenuItem.view isKindOfClass:CustomMenuItemView.class]) {
|
||||
[(CustomMenuItemView *)fMenuItem.view recalcSizes];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -183,7 +473,6 @@
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
- (void)setJavaEnabled:(BOOL) enabled {
|
||||
|
||||
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
|
||||
@@ -358,6 +647,21 @@ Java_sun_lwawt_macosx_CMenuItem_nativeSetLabel
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CMenuItem
|
||||
* Method: nativeSetAcceleratorText
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_lwawt_macosx_CMenuItem_nativeSetAcceleratorText
|
||||
(JNIEnv *env, jobject peer, jlong menuItemObj, jstring acceleratorText)
|
||||
{
|
||||
JNF_COCOA_ENTER(env);
|
||||
NSString *theText = JNFJavaToNSString(env, acceleratorText);
|
||||
[((CMenuItem *)jlong_to_ptr(menuItemObj)) setAcceleratorText:theText];
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CMenuItem
|
||||
* Method: nativeSetTooltip
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CWrapper$NSWindow
|
||||
* Method: makeKeyAndOrderFront
|
||||
* Signature: (J)V
|
||||
* Method: nativeMakeKeyAndOrderFront
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_makeKeyAndOrderFront
|
||||
(JNIEnv *env, jclass cls, jlong windowPtr)
|
||||
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_nativeMakeKeyAndOrderFront
|
||||
(JNIEnv *env, jclass cls, jlong windowPtr, jboolean wait)
|
||||
{
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
@@ -42,7 +42,7 @@ JNF_COCOA_ENTER(env);
|
||||
[ThreadUtilities performOnMainThread:@selector(makeKeyAndOrderFront:)
|
||||
on:window
|
||||
withObject:nil
|
||||
waitUntilDone:NO];
|
||||
waitUntilDone:(BOOL)wait];
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
@@ -136,11 +136,11 @@ JNF_COCOA_EXIT(env);
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CWrapper$NSWindow
|
||||
* Method: nativeOrderOut
|
||||
* Signature: (J)V
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_nativeOrderOut
|
||||
(JNIEnv *env, jclass cls, jlong windowPtr)
|
||||
(JNIEnv *env, jclass cls, jlong windowPtr, jboolean wait)
|
||||
{
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
@@ -148,7 +148,7 @@ JNF_COCOA_ENTER(env);
|
||||
[ThreadUtilities performOnMainThread:@selector(orderOut:)
|
||||
on:window
|
||||
withObject:window
|
||||
waitUntilDone:YES];
|
||||
waitUntilDone:(BOOL)wait];
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
@@ -606,6 +606,8 @@ CGGI_CreateNewGlyphInfoFrom(CGSize advance, CGRect bbox,
|
||||
glyphInfo->height = height;
|
||||
glyphInfo->rowBytes = width * pixelSize;
|
||||
glyphInfo->cellInfo = NULL;
|
||||
glyphInfo->subpixelResolutionX = 1;
|
||||
glyphInfo->subpixelResolutionY = 1;
|
||||
|
||||
#ifdef USE_IMAGE_ALIGNED_MEMORY
|
||||
glyphInfo->image = image;
|
||||
|
||||
@@ -163,6 +163,28 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
// inform any interested parties that the AWT has arrived and is pumping
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:JNFRunLoopDidStartNotification object:self];
|
||||
|
||||
// fix for JBR-3127 Modal dialogs invoked from modal or floating dialogs are opened in full screen
|
||||
[defs setBool:NO forKey:@"NSWindowAllowsImplicitFullScreen"];
|
||||
|
||||
// temporary possibility to load deprecated NSJavaVirtualMachine (just for testing)
|
||||
// todo: remove when completely tested on BigSur
|
||||
// see https://youtrack.jetbrains.com/issue/JBR-3127#focus=Comments-27-4684465.0-0
|
||||
NSString * loadNSJVMProp = [PropertiesUtilities
|
||||
javaSystemPropertyForKey:@"apple.awt.application.instantiate.NSJavaVirtualMachine"
|
||||
withEnv:env];
|
||||
if ([@"true" isCaseInsensitiveLike:loadNSJVMProp]) {
|
||||
if (objc_lookUpClass("NSJavaVirtualMachine") != nil) {
|
||||
NSLog(@"objc class NSJavaVirtualMachine is already registered");
|
||||
} else {
|
||||
Class nsjvm = objc_allocateClassPair([NSObject class], "NSJavaVirtualMachine", 0);
|
||||
objc_registerClassPair(nsjvm);
|
||||
NSLog(@"registered class NSJavaVirtualMachine: %@", nsjvm);
|
||||
|
||||
id nsjvmInst = [[nsjvm alloc] init];
|
||||
NSLog(@"instantiated dummy NSJavaVirtualMachine: %@", nsjvmInst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center
|
||||
|
||||
@@ -632,4 +632,45 @@ public class FileDialog extends Dialog {
|
||||
boolean postsOldMouseEvents() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Text for "Open" button (used when common file dialogs are enabled on
|
||||
* Windows).
|
||||
*/
|
||||
private String openButtonText;
|
||||
|
||||
/**
|
||||
* Text for "Select Folder" button (used when common file dialogs are
|
||||
* enabled on Windows).
|
||||
*/
|
||||
private String selectFolderButtonText;
|
||||
|
||||
/**
|
||||
* Called using reflection; sets localization strings used when common
|
||||
* file dialogs are enabled on Windows.
|
||||
*/
|
||||
private void setLocalizationStrings(String openButtonText, String selectFolderButtonText) {
|
||||
this.openButtonText = openButtonText;
|
||||
this.selectFolderButtonText = selectFolderButtonText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to enable folder picker mode (used when common file dialogs are
|
||||
* enabled on Windows).
|
||||
*/
|
||||
private boolean folderPickerMode;
|
||||
|
||||
private void setFolderPickerMode(boolean folderPickerMode) {
|
||||
this.folderPickerMode = folderPickerMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to enable exclusive file picker mode, with no folder picker
|
||||
* available (used when common file dialogs are enabled on Windows).
|
||||
*/
|
||||
private boolean fileExclusivePickerMode;
|
||||
|
||||
private void setFileExclusivePickerMode(boolean fileExclusivePickerMode) {
|
||||
this.fileExclusivePickerMode = fileExclusivePickerMode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1117,14 +1117,18 @@ public class Window extends Container implements Accessible {
|
||||
* {@link #setVisible(boolean)}.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void hide() {
|
||||
WeakReference<Window>[] ownedWindowArray;
|
||||
synchronized(ownedWindowList) {
|
||||
for (int i = 0; i < ownedWindowList.size(); i++) {
|
||||
Window child = ownedWindowList.elementAt(i).get();
|
||||
if ((child != null) && child.visible) {
|
||||
child.hide();
|
||||
child.showWithParent = true;
|
||||
}
|
||||
ownedWindowArray = new WeakReference[ownedWindowList.size()];
|
||||
ownedWindowList.copyInto(ownedWindowArray);
|
||||
}
|
||||
for (WeakReference<Window> childRef : ownedWindowArray) {
|
||||
Window child = childRef.get();
|
||||
if ((child != null) && child.visible) {
|
||||
child.hide();
|
||||
child.showWithParent = true;
|
||||
}
|
||||
}
|
||||
if (isModalBlocked()) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package sun.awt;
|
||||
|
||||
import sun.font.FontUtilities;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.InvocationEvent;
|
||||
@@ -15,6 +16,8 @@ import java.util.concurrent.*;
|
||||
* Used to perform a cross threads (EventDispatch, Toolkit) execution so that the execution does not cause a deadlock.
|
||||
*/
|
||||
public class AWTThreading {
|
||||
private static final PlatformLogger logger = PlatformLogger.getLogger("sun.awt.AWTThreading");
|
||||
|
||||
private ExecutorService executor;
|
||||
// every invokeAndWait() pushes a queue of invocations
|
||||
private final Stack<TrackingQueue> invocations = new Stack<>();
|
||||
@@ -51,11 +54,14 @@ public class AWTThreading {
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as {@link #executeWaitToolkit(Callable)}, but without returning a value.
|
||||
* Same as {@link #executeWaitToolkit(Callable)}, but without returning a value. If requested (as indicated by
|
||||
* the passed parameter), the invoked native method is supposed to wait for the result of invocation on AppKit
|
||||
* thread, and vice versa.
|
||||
*/
|
||||
public static void executeWaitToolkit(Runnable runnable) {
|
||||
public static void executeWaitToolkit(Task runnable) {
|
||||
boolean wait = EventQueue.isDispatchThread();
|
||||
executeWaitToolkit(() -> {
|
||||
runnable.run();
|
||||
runnable.run(wait);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@@ -66,12 +72,20 @@ public class AWTThreading {
|
||||
public static <T> T executeWaitToolkit(Callable<T> callable, long timeout, TimeUnit unit) {
|
||||
if (callable == null) return null;
|
||||
|
||||
if (FontUtilities.isMacOSX && EventQueue.isDispatchThread()) {
|
||||
boolean isEDT = EventQueue.isDispatchThread();
|
||||
|
||||
if (FontUtilities.isMacOSX && isEDT) {
|
||||
AWTThreading instance = getInstance(Thread.currentThread());
|
||||
if (instance != null) {
|
||||
return instance.execute(callable, timeout, unit);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isEDT && logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
// this can cause deadlock if calling thread is holding a lock which EDT might require (e.g. AWT tree lock)
|
||||
logger.fine("AWTThreading.executeWaitToolkit invoked from non-EDT thread", new Throwable());
|
||||
}
|
||||
|
||||
// fallback to default
|
||||
try {
|
||||
return callable.call();
|
||||
@@ -231,4 +245,8 @@ public class AWTThreading {
|
||||
|
||||
return EDT_TO_INSTANCE_MAP.computeIfAbsent(edt, key -> new AWTThreading());
|
||||
}
|
||||
|
||||
public interface Task {
|
||||
void run(boolean wait);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
package sun.font;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -58,6 +58,8 @@ public final class FontUtilities {
|
||||
|
||||
public static boolean isOpenJDK;
|
||||
|
||||
public static Dimension supplementarySubpixelGlyphResolution;
|
||||
|
||||
static final String LUCIDA_FILE_NAME = "LucidaSansRegular.ttf";
|
||||
|
||||
static final String DROID_FILE_NAME = "DroidSans.ttf";
|
||||
@@ -131,6 +133,20 @@ public final class FontUtilities {
|
||||
logging = logger.isEnabled();
|
||||
}
|
||||
|
||||
try {
|
||||
String property = System.getProperty("java2d.font.subpixelResolution", "");
|
||||
int separatorIndex = property.indexOf('x');
|
||||
final int MAX_RESOLUTION = 16;
|
||||
supplementarySubpixelGlyphResolution = new Dimension(
|
||||
Math.max(Math.min(Integer.parseUnsignedInt(
|
||||
property.substring(0, separatorIndex)), MAX_RESOLUTION), 1),
|
||||
Math.max(Math.min(Integer.parseUnsignedInt(
|
||||
property.substring(separatorIndex + 1)), MAX_RESOLUTION), 1)
|
||||
);
|
||||
} catch (Exception ignore) {
|
||||
supplementarySubpixelGlyphResolution = new Dimension(1, 1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -74,11 +74,14 @@ class FreetypeFontScaler extends FontScaler {
|
||||
});
|
||||
|
||||
initIDs(FreetypeFontScaler.class, Toolkit.class, PhysicalFont.class,
|
||||
fontConfName);
|
||||
fontConfName,
|
||||
FontUtilities.supplementarySubpixelGlyphResolution.width,
|
||||
FontUtilities.supplementarySubpixelGlyphResolution.height);
|
||||
}
|
||||
|
||||
private static native void initIDs(Class<?> FFS, Class<?> toolkitClass, Class<?> pfClass,
|
||||
String jreFontDirName);
|
||||
String jreFontDirName,
|
||||
int subpixelResolutionX, int subpixelResolutionY);
|
||||
|
||||
private void invalidateScaler() throws FontScalerException {
|
||||
nativeScaler = 0;
|
||||
|
||||
@@ -114,6 +114,8 @@ public final class StrikeCache {
|
||||
static int pixelDataOffset;
|
||||
static int cacheCellOffset;
|
||||
static int managedOffset;
|
||||
static int subpixelResolutionXOffset;
|
||||
static int subpixelResolutionYOffset;
|
||||
static long invisibleGlyphPtr;
|
||||
|
||||
/* Native method used to return information used for unsafe
|
||||
@@ -130,12 +132,16 @@ public final class StrikeCache {
|
||||
* arr[8] = offset of topLeftY
|
||||
* arr[9] = offset of pixel data.
|
||||
* arr[10] = address of a GlyphImageRef representing the invisible glyph
|
||||
* arr[11] = offset of cellInfo
|
||||
* arr[12] = offset of managed
|
||||
* arr[13] = offset of subpixelResolutionX
|
||||
* arr[14] = offset of subpixelResolutionY
|
||||
*/
|
||||
static native void getGlyphCacheDescription(long[] infoArray);
|
||||
|
||||
static {
|
||||
|
||||
long[] nativeInfo = new long[13];
|
||||
long[] nativeInfo = new long[15];
|
||||
getGlyphCacheDescription(nativeInfo);
|
||||
//Can also get address size from Unsafe class :-
|
||||
//nativeAddressSize = unsafe.addressSize();
|
||||
@@ -152,6 +158,8 @@ public final class StrikeCache {
|
||||
invisibleGlyphPtr = nativeInfo[10];
|
||||
cacheCellOffset = (int) nativeInfo[11];
|
||||
managedOffset = (int) nativeInfo[12];
|
||||
subpixelResolutionXOffset = (int) nativeInfo[13];
|
||||
subpixelResolutionYOffset = (int) nativeInfo[14];
|
||||
|
||||
if (nativeAddressSize < 4) {
|
||||
throw new InternalError("Unexpected address size for font data: " +
|
||||
|
||||
@@ -340,10 +340,6 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
jreFontMap.put("FiraCode-Retina.ttf", new BundledFontInfo("FiraCode-Retina", 1, 206, 0));
|
||||
jreFontMap.put("FiraCode-Regular.ttf", new BundledFontInfo("FiraCode-Regular", 1, 206, 0));
|
||||
|
||||
jreFamilyMap.put("FiraCode-Medium", "Fira Code Medium");
|
||||
jreFamilyMap.put("FiraCode-Retina", "Fira Code Retina");
|
||||
jreFamilyMap.put("FiraCode-Light", "Fira Code Light");
|
||||
|
||||
jreFontMap.put("SourceCodePro-BoldIt.ttf", new BundledFontInfo("SourceCodePro-BoldIt", 1, 30, 0));
|
||||
jreFontMap.put("SourceCodePro-Regular.ttf", new BundledFontInfo("SourceCodePro-Regular", 2, 10, 0));
|
||||
jreFontMap.put("SourceCodePro-Bold.ttf", new BundledFontInfo("SourceCodePro-Bold", 2, 10, 0));
|
||||
@@ -357,10 +353,21 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
jreFamilyMap.put("Roboto-Light", "Roboto Light");
|
||||
jreFamilyMap.put("Roboto-Thin", "Roboto Thin");
|
||||
|
||||
jreFontMap.put("JetBrainsMono-Bold.ttf", new BundledFontInfo("JetBrainsMono-Bold", 1, 0, 2));
|
||||
jreFontMap.put("JetBrainsMono-Regular.ttf", new BundledFontInfo("JetBrainsMono-Regular", 1, 0, 2));
|
||||
jreFontMap.put("JetBrainsMono-Italic.ttf", new BundledFontInfo("JetBrainsMono-Italic", 1, 0, 2));
|
||||
jreFontMap.put("JetBrainsMono-Bold-Italic.ttf", new BundledFontInfo("JetBrainsMono-BoldItalic", 1, 0, 2));
|
||||
jreFontMap.put("JetBrainsMono-Bold.ttf", new BundledFontInfo("JetBrainsMono-Bold", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-Bold-Italic.ttf", new BundledFontInfo("JetBrainsMono-Bold-Italic", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-BoldItalic.ttf", new BundledFontInfo("JetBrainsMono-BoldItalic", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-ExtraBold.ttf", new BundledFontInfo("JetBrainsMono-ExtraBold", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-ExtraBoldItalic.ttf", new BundledFontInfo("JetBrainsMono-ExtraBoldItalic", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-ExtraLight.ttf", new BundledFontInfo("JetBrainsMono-ExtraLight", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-ExtraLightItalic.ttf", new BundledFontInfo("JetBrainsMono-ExtraLightItalic", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-Italic.ttf", new BundledFontInfo("JetBrainsMono-Italic", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-Light.ttf", new BundledFontInfo("JetBrainsMono-Light", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-LightItalic.ttf", new BundledFontInfo("JetBrainsMono-LightItalic", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-Medium.ttf", new BundledFontInfo("JetBrainsMono-Medium", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-MediumItalic.ttf", new BundledFontInfo("JetBrainsMono-MediumItalic", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-Regular.ttf", new BundledFontInfo("JetBrainsMono-Regular", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-Thin.ttf", new BundledFontInfo("JetBrainsMono-Thin", 2, 225, 0));
|
||||
jreFontMap.put("JetBrainsMono-ThinItalic.ttf", new BundledFontInfo("JetBrainsMono-ThinItalic", 2, 225, 0));
|
||||
|
||||
jreBundledFontFiles.addAll(jreFontMap.keySet());
|
||||
}
|
||||
|
||||
BIN
src/java.desktop/share/fonts/JetBrainsMono-ExtraBold.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-ExtraBold.ttf
Normal file
Binary file not shown.
BIN
src/java.desktop/share/fonts/JetBrainsMono-ExtraBoldItalic.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-ExtraBoldItalic.ttf
Normal file
Binary file not shown.
BIN
src/java.desktop/share/fonts/JetBrainsMono-ExtraLight.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-ExtraLight.ttf
Normal file
Binary file not shown.
BIN
src/java.desktop/share/fonts/JetBrainsMono-ExtraLightItalic.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-ExtraLightItalic.ttf
Normal file
Binary file not shown.
BIN
src/java.desktop/share/fonts/JetBrainsMono-Light.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-Light.ttf
Normal file
Binary file not shown.
BIN
src/java.desktop/share/fonts/JetBrainsMono-LightItalic.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-LightItalic.ttf
Normal file
Binary file not shown.
BIN
src/java.desktop/share/fonts/JetBrainsMono-Medium.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-Medium.ttf
Normal file
Binary file not shown.
BIN
src/java.desktop/share/fonts/JetBrainsMono-MediumItalic.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-MediumItalic.ttf
Normal file
Binary file not shown.
BIN
src/java.desktop/share/fonts/JetBrainsMono-Thin.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-Thin.ttf
Normal file
Binary file not shown.
BIN
src/java.desktop/share/fonts/JetBrainsMono-ThinItalic.ttf
Normal file
BIN
src/java.desktop/share/fonts/JetBrainsMono-ThinItalic.ttf
Normal file
Binary file not shown.
@@ -75,6 +75,8 @@ typedef struct GlyphInfo {
|
||||
UInt16 height;
|
||||
UInt16 rowBytes;
|
||||
UInt8 managed;
|
||||
UInt8 subpixelResolutionX;
|
||||
UInt8 subpixelResolutionY;
|
||||
float topLeftX;
|
||||
float topLeftY;
|
||||
void *cellInfo;
|
||||
|
||||
@@ -35,6 +35,25 @@
|
||||
#include "sun_java2d_loops_DrawGlyphListAA.h"
|
||||
|
||||
|
||||
static UInt8* getSubpixelGlyphImage(GlyphInfo *glyph, float x, float y) {
|
||||
int rx = glyph->subpixelResolutionX;
|
||||
int ry = glyph->subpixelResolutionY;
|
||||
if ((rx == 1 && ry == 1) || rx <= 0 || ry <= 0) {
|
||||
return glyph->image;
|
||||
}
|
||||
int xOffset;
|
||||
int yOffset;
|
||||
if (x >= 0 && y >= 0) {
|
||||
xOffset = ((int) (x * (float) rx)) % rx;
|
||||
yOffset = ((int) (y * (float) ry)) % ry;
|
||||
} else {
|
||||
xOffset = (int) ((x - (float) floor(x)) * (float) rx);
|
||||
yOffset = (int) ((y - (float) floor(y)) * (float) ry);
|
||||
}
|
||||
return glyph->image + (glyph->rowBytes * glyph->height) *
|
||||
(xOffset + yOffset * rx);
|
||||
}
|
||||
|
||||
/*
|
||||
* Need to account for the rare case when (eg) repainting damaged
|
||||
* areas results in the drawing location being negative, in which
|
||||
@@ -50,6 +69,9 @@
|
||||
#define FLOOR_ASSIGN(l, r)\
|
||||
if ((r)<0) (l) = ((int)floor(r)); else (l) = ((int)(r))
|
||||
|
||||
#define ADJUST_SUBPIXEL_GLYPH_POSITION(coord, res) \
|
||||
if ((res) > 1) (coord) += 0.5f / ((float)(res)) - 0.5f;
|
||||
|
||||
GlyphBlitVector* setupBlitVector(JNIEnv *env, jobject glyphlist, jint fromGlyph, jint toGlyph) {
|
||||
|
||||
int g;
|
||||
@@ -101,8 +123,12 @@ GlyphBlitVector* setupBlitVector(JNIEnv *env, jobject glyphlist, jint fromGlyph,
|
||||
jfloat py = y + positions[++n];
|
||||
|
||||
ginfo = (GlyphInfo*)imagePtrs[g + fromGlyph];
|
||||
ADJUST_SUBPIXEL_GLYPH_POSITION(px, ginfo->subpixelResolutionX);
|
||||
ADJUST_SUBPIXEL_GLYPH_POSITION(py, ginfo->subpixelResolutionY);
|
||||
gbv->glyphs[g].glyphInfo = ginfo;
|
||||
gbv->glyphs[g].pixels = ginfo->image;
|
||||
gbv->glyphs[g].pixels = getSubpixelGlyphImage(ginfo,
|
||||
px + ginfo->topLeftX,
|
||||
py + ginfo->topLeftY);
|
||||
gbv->glyphs[g].width = ginfo->width;
|
||||
gbv->glyphs[g].rowBytes = ginfo->rowBytes;
|
||||
gbv->glyphs[g].height = ginfo->height;
|
||||
@@ -113,14 +139,21 @@ GlyphBlitVector* setupBlitVector(JNIEnv *env, jobject glyphlist, jint fromGlyph,
|
||||
positions, JNI_ABORT);
|
||||
} else {
|
||||
for (g=0; g<len; g++) {
|
||||
jfloat px = x;
|
||||
jfloat py = y;
|
||||
|
||||
ginfo = (GlyphInfo*)imagePtrs[g + fromGlyph];
|
||||
ADJUST_SUBPIXEL_GLYPH_POSITION(px, ginfo->subpixelResolutionX);
|
||||
ADJUST_SUBPIXEL_GLYPH_POSITION(py, ginfo->subpixelResolutionY);
|
||||
gbv->glyphs[g].glyphInfo = ginfo;
|
||||
gbv->glyphs[g].pixels = ginfo->image;
|
||||
gbv->glyphs[g].pixels = getSubpixelGlyphImage(ginfo,
|
||||
px + ginfo->topLeftX,
|
||||
py + ginfo->topLeftY);
|
||||
gbv->glyphs[g].width = ginfo->width;
|
||||
gbv->glyphs[g].rowBytes = ginfo->rowBytes;
|
||||
gbv->glyphs[g].height = ginfo->height;
|
||||
FLOOR_ASSIGN(gbv->glyphs[g].x, x + ginfo->topLeftX);
|
||||
FLOOR_ASSIGN(gbv->glyphs[g].y, y + ginfo->topLeftY);
|
||||
FLOOR_ASSIGN(gbv->glyphs[g].x, px + ginfo->topLeftX);
|
||||
FLOOR_ASSIGN(gbv->glyphs[g].y, py + ginfo->topLeftY);
|
||||
|
||||
/* copy image data into this array at x/y locations */
|
||||
x += ginfo->advanceX;
|
||||
|
||||
@@ -87,7 +87,7 @@ jboolean storeGVData(JNIEnv* env,
|
||||
unsigned int* indices;
|
||||
jarray glyphArray, posArray, inxArray;
|
||||
|
||||
if (!init_JNI_IDs(env)) {
|
||||
if (!init_JNI_IDs(env) || !initHBAPI()) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
@@ -280,45 +280,45 @@ JNIEXPORT jboolean JNICALL Java_sun_font_SunLayoutEngine_shape
|
||||
hbface = (hb_face_t*) jlong_to_ptr(pFace);
|
||||
hbfont = hb_jdk_font_create(hbface, jdkFontInfo, NULL);
|
||||
|
||||
buffer = hb_buffer_create();
|
||||
hb_buffer_set_script(buffer, getHBScriptCode(script));
|
||||
hb_buffer_set_language(buffer,
|
||||
hb_ot_tag_to_language(HB_OT_TAG_DEFAULT_LANGUAGE));
|
||||
buffer = p_hb_buffer_create();
|
||||
p_hb_buffer_set_script(buffer, getHBScriptCode(script));
|
||||
p_hb_buffer_set_language(buffer,
|
||||
p_hb_ot_tag_to_language(HB_OT_TAG_DEFAULT_LANGUAGE));
|
||||
if ((flags & TYPO_RTL) != 0) {
|
||||
direction = HB_DIRECTION_RTL;
|
||||
}
|
||||
hb_buffer_set_direction(buffer, direction);
|
||||
hb_buffer_set_cluster_level(buffer,
|
||||
p_hb_buffer_set_direction(buffer, direction);
|
||||
p_hb_buffer_set_cluster_level(buffer,
|
||||
HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
|
||||
|
||||
chars = (*env)->GetCharArrayElements(env, text, NULL);
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
hb_buffer_destroy(buffer);
|
||||
hb_font_destroy(hbfont);
|
||||
p_hb_buffer_destroy(buffer);
|
||||
p_hb_font_destroy(hbfont);
|
||||
free((void*)jdkFontInfo);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
len = (*env)->GetArrayLength(env, text);
|
||||
|
||||
hb_buffer_add_utf16(buffer, chars, len, offset, limit-offset);
|
||||
p_hb_buffer_add_utf16(buffer, chars, len, offset, limit-offset);
|
||||
|
||||
features = calloc(2, sizeof(hb_feature_t));
|
||||
if (features) {
|
||||
hb_feature_from_string(kern, -1, &features[featureCount++]);
|
||||
hb_feature_from_string(liga, -1, &features[featureCount++]);
|
||||
p_hb_feature_from_string(kern, -1, &features[featureCount++]);
|
||||
p_hb_feature_from_string(liga, -1, &features[featureCount++]);
|
||||
}
|
||||
|
||||
hb_shape_full(hbfont, buffer, features, featureCount, 0);
|
||||
glyphCount = hb_buffer_get_length(buffer);
|
||||
glyphInfo = hb_buffer_get_glyph_infos(buffer, 0);
|
||||
glyphPos = hb_buffer_get_glyph_positions(buffer, &buflen);
|
||||
p_hb_shape_full(hbfont, buffer, features, featureCount, 0);
|
||||
glyphCount = p_hb_buffer_get_length(buffer);
|
||||
glyphInfo = p_hb_buffer_get_glyph_infos(buffer, 0);
|
||||
glyphPos = p_hb_buffer_get_glyph_positions(buffer, &buflen);
|
||||
|
||||
ret = storeGVData(env, gvdata, slot, baseIndex, offset, startPt,
|
||||
limit - offset, glyphCount, glyphInfo, glyphPos,
|
||||
jdkFontInfo->devScale);
|
||||
|
||||
hb_buffer_destroy (buffer);
|
||||
hb_font_destroy(hbfont);
|
||||
p_hb_buffer_destroy (buffer);
|
||||
p_hb_font_destroy(hbfont);
|
||||
free((void*)jdkFontInfo);
|
||||
if (features != NULL) free(features);
|
||||
(*env)->ReleaseCharArrayElements(env, text, chars, JNI_ABORT);
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
#define DEFAULT_DPI 72
|
||||
#define MAX_DPI 1024
|
||||
#define ADJUST_FONT_SIZE(X, DPI) (((X)*DEFAULT_DPI + ((DPI)>>1))/(DPI))
|
||||
#define FLOOR_DIV(X, Y) ((X) >= 0 ? (X) / (Y) : ((X) - (Y) + 1) / (Y))
|
||||
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
#define FONTCONFIG_DLL JNI_LIB_NAME("fontconfig")
|
||||
@@ -197,6 +198,8 @@ static FcInitLoadConfigAndFontsPtrType FcInitLoadConfigAndFontsPtr;
|
||||
static FcGetVersionPtrType FcGetVersionPtr;
|
||||
#endif
|
||||
|
||||
static FT_UnitVector supplementarySubpixelGlyphResolution;
|
||||
|
||||
static void* openFontConfig() {
|
||||
void* libfontconfig = NULL;
|
||||
#ifndef DISABLE_FONTCONFIG
|
||||
@@ -227,7 +230,9 @@ static void* openFontConfig() {
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_font_FreetypeFontScaler_initIDs(
|
||||
JNIEnv *env, jobject scaler, jclass FFSClass, jclass TKClass,
|
||||
jclass PFClass, jstring jreFontConfName)
|
||||
jclass PFClass, jstring jreFontConfName,
|
||||
jint subpixelResolutionX,
|
||||
jint subpixelResolutionY)
|
||||
{
|
||||
const char *fssLogEnabled = getenv("OPENJDK_LOG_FFS");
|
||||
const char *fontConf = (jreFontConfName == NULL) ?
|
||||
@@ -237,6 +242,9 @@ Java_sun_font_FreetypeFontScaler_initIDs(
|
||||
logFFS = JNI_TRUE;
|
||||
}
|
||||
|
||||
supplementarySubpixelGlyphResolution.x = subpixelResolutionX;
|
||||
supplementarySubpixelGlyphResolution.y = subpixelResolutionY;
|
||||
|
||||
invalidateScalerMID =
|
||||
(*env)->GetMethodID(env, FFSClass, "invalidateScaler", "()V");
|
||||
getDefaultToolkitMID =
|
||||
@@ -1520,6 +1528,68 @@ static void transformBGRABitmapGlyph(FT_GlyphSlot ftglyph, GlyphInfo* glyphInfo,
|
||||
freeSampledBGRABitmap(&sampledBitmap);
|
||||
}
|
||||
|
||||
/* Size (in pixels) of stack-allocated temporary buffer for glyph downscaling.
|
||||
* If glyph is too big and requires more memory, it will use malloc. */
|
||||
#define SUBPIXEL_DOWNSCALE_STATIC_BUFFER_SIZE 2048
|
||||
|
||||
/* In order to get an extended set of grayscale glyph images, we pick single
|
||||
* upscaled image and downscale it with different offsets by x and y axis */
|
||||
static void CopySupplementarySubpixelToGrey8(const UInt8* srcImage, int srcRowBytes,
|
||||
int srcWidth, int srcHeight,
|
||||
UInt8* dstImage, int dstRowBytes,
|
||||
int dstWidth, int dstHeight,
|
||||
int xOffset, int yOffset,
|
||||
int xResolution, int yResolution,
|
||||
int imageSize) {
|
||||
short staticBuffer[SUBPIXEL_DOWNSCALE_STATIC_BUFFER_SIZE];
|
||||
int bufferSize = dstWidth * srcHeight;
|
||||
int useStaticBuffer = bufferSize <= SUBPIXEL_DOWNSCALE_STATIC_BUFFER_SIZE;
|
||||
short *buffer = useStaticBuffer ?
|
||||
staticBuffer : malloc(sizeof(short) * bufferSize);
|
||||
|
||||
int xGlyph, yGlyph, x, y;
|
||||
// For each subpixel offset by x axis
|
||||
for (xGlyph = 0; xGlyph < xResolution; xGlyph++) {
|
||||
// Sum values by x axis and store into temporary buffer
|
||||
for (y = 0; y < srcHeight; y++) {
|
||||
for (x = 0; x < dstWidth; x++) {
|
||||
int value = 0;
|
||||
int xFrom = x * xResolution - xOffset - xGlyph,
|
||||
xTo = xFrom + xResolution;
|
||||
if (xFrom < 0) xFrom = 0;
|
||||
if (xTo > srcWidth) xTo = srcWidth;
|
||||
int i;
|
||||
for (i = xFrom; i < xTo; i++) {
|
||||
value += srcImage[y * srcRowBytes + i];
|
||||
}
|
||||
buffer[y * dstWidth + x] = (short) value;
|
||||
}
|
||||
}
|
||||
// For each subpixel offset by y axis
|
||||
for (yGlyph = 0; yGlyph < yResolution; yGlyph++) {
|
||||
UInt8 *dst = dstImage +
|
||||
imageSize * (xGlyph + yGlyph * xResolution);
|
||||
// Sum values by y axis and store average into destination image
|
||||
for (y = 0; y < dstHeight; y++) {
|
||||
for (x = 0; x < dstWidth; x++) {
|
||||
int value = 0;
|
||||
int yFrom = y * yResolution - yOffset - yGlyph,
|
||||
yTo = yFrom + yResolution;
|
||||
if (yFrom < 0) yFrom = 0;
|
||||
if (yTo > srcHeight) yTo = srcHeight;
|
||||
int j;
|
||||
for (j = yFrom; j < yTo; j++) {
|
||||
value += buffer[j * dstWidth + x];
|
||||
}
|
||||
dst[y * dstRowBytes + x] =
|
||||
value / xResolution / yResolution;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!useStaticBuffer) free(buffer);
|
||||
}
|
||||
|
||||
/* JDK does not use glyph images for fonts with a
|
||||
* pixel size > 100 (see THRESHOLD in OutlineTextRenderer.java)
|
||||
@@ -1647,7 +1717,29 @@ static jlong
|
||||
|
||||
/* generate bitmap if it is not done yet
|
||||
e.g. if algorithmic styling is performed and style was added to outline */
|
||||
int subpixelGlyph = FALSE;
|
||||
int subpixelResolutionX = 1;
|
||||
int subpixelResolutionY = 1;
|
||||
if (renderImage && outlineGlyph) {
|
||||
/* We can create an extended glyph when rendering with grayscale AA thus
|
||||
* increasing subpixel resolution & reducing glyph spacing issues.
|
||||
* We do this by rendering the glyph in bigger resolution and then
|
||||
* downscaling it with different subpixel offsets, which results in
|
||||
* subpixelResolutionX * subpixelResolutionY images per glyph. */
|
||||
if (ftglyph->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY &&
|
||||
context->aaType == TEXT_AA_ON && context->fmType == TEXT_FM_ON) {
|
||||
subpixelResolutionX = supplementarySubpixelGlyphResolution.x;
|
||||
subpixelResolutionY = supplementarySubpixelGlyphResolution.y;
|
||||
if (subpixelResolutionX > 1 || subpixelResolutionY > 1) {
|
||||
subpixelGlyph = TRUE;
|
||||
FT_Matrix matrix;
|
||||
matrix.xx = (long) FT_MATRIX_ONE * subpixelResolutionX;
|
||||
matrix.xy = 0;
|
||||
matrix.yx = 0;
|
||||
matrix.yy = (long) FT_MATRIX_ONE * subpixelResolutionY;
|
||||
FT_Outline_Transform(&(ftglyph->outline), &matrix);
|
||||
}
|
||||
}
|
||||
FT_BBox bbox;
|
||||
FT_Outline_Get_CBox(&(ftglyph->outline), &bbox);
|
||||
int w = (int)((bbox.xMax>>6)-(bbox.xMin>>6));
|
||||
@@ -1666,10 +1758,23 @@ static jlong
|
||||
context->ptsz, scalerInfo->face->available_sizes[context->fixedSizeIndex].size);
|
||||
FT_Matrix manualTransform;
|
||||
FT_BBox manualTransformBoundingBox;
|
||||
int topLeftX, topLeftY;
|
||||
if (renderImage) {
|
||||
if (context->fixedSizeIndex == -1) {
|
||||
if (subpixelGlyph) {
|
||||
topLeftX = FLOOR_DIV(ftglyph->bitmap_left, subpixelResolutionX);
|
||||
topLeftY = FLOOR_DIV(-ftglyph->bitmap_top, subpixelResolutionY);
|
||||
width = -FLOOR_DIV(
|
||||
-ftglyph->bitmap_left - (int) ftglyph->bitmap.width -
|
||||
subpixelResolutionX + 1, subpixelResolutionX) - topLeftX;
|
||||
height = -FLOOR_DIV(
|
||||
ftglyph->bitmap_top - (int) ftglyph->bitmap.rows -
|
||||
subpixelResolutionX + 1, subpixelResolutionY) - topLeftY;
|
||||
}
|
||||
else if (context->fixedSizeIndex == -1) {
|
||||
width = (UInt16) ftglyph->bitmap.width;
|
||||
height = (UInt16) ftglyph->bitmap.rows;
|
||||
topLeftX = ftglyph->bitmap_left;
|
||||
topLeftY = -ftglyph->bitmap_top;
|
||||
}
|
||||
else {
|
||||
/* Fixed size glyph, prepare matrix and
|
||||
@@ -1684,6 +1789,8 @@ static jlong
|
||||
manualTransformBoundingBox.xMin);
|
||||
height = (UInt16) (manualTransformBoundingBox.yMax -
|
||||
manualTransformBoundingBox.yMin);
|
||||
topLeftX = manualTransformBoundingBox.xMin;
|
||||
topLeftY = -manualTransformBoundingBox.yMax;
|
||||
}
|
||||
if (width > MAX_GLYPH_DIM || height > MAX_GLYPH_DIM) {
|
||||
glyphInfo = getNullGlyphImage();
|
||||
@@ -1706,7 +1813,8 @@ static jlong
|
||||
|
||||
|
||||
imageSize = rowBytes*height;
|
||||
glyphInfo = (GlyphInfo*) calloc(sizeof(GlyphInfo) + imageSize, 1);
|
||||
glyphInfo = (GlyphInfo*) calloc(sizeof(GlyphInfo) +
|
||||
imageSize * subpixelResolutionX * subpixelResolutionY, 1);
|
||||
if (glyphInfo == NULL) {
|
||||
glyphInfo = getNullGlyphImage();
|
||||
return ptr_to_jlong(glyphInfo);
|
||||
@@ -1716,17 +1824,12 @@ static jlong
|
||||
glyphInfo->rowBytes = rowBytes;
|
||||
glyphInfo->width = width;
|
||||
glyphInfo->height = height;
|
||||
glyphInfo->topLeftX = (float) topLeftX;
|
||||
glyphInfo->topLeftY = (float) topLeftY;
|
||||
glyphInfo->subpixelResolutionX = subpixelResolutionX;
|
||||
glyphInfo->subpixelResolutionY = subpixelResolutionY;
|
||||
|
||||
if (renderImage) {
|
||||
if (context->fixedSizeIndex == -1) {
|
||||
glyphInfo->topLeftX = (float) ftglyph->bitmap_left;
|
||||
glyphInfo->topLeftY = (float) -ftglyph->bitmap_top;
|
||||
}
|
||||
else {
|
||||
glyphInfo->topLeftX = manualTransformBoundingBox.xMin;
|
||||
glyphInfo->topLeftY = -manualTransformBoundingBox.yMax;
|
||||
}
|
||||
|
||||
if (ftglyph->bitmap.pixel_mode == FT_PIXEL_MODE_LCD && width > 0) {
|
||||
glyphInfo->width = width/3;
|
||||
glyphInfo->topLeftX -= 1;
|
||||
@@ -1767,8 +1870,25 @@ static jlong
|
||||
//output format is either 3 bytes per pixel (for subpixel modes)
|
||||
//4 bytes per pixel for BGRA glyphs
|
||||
// or 1 byte per pixel for AA and B&W
|
||||
if (context->fixedSizeIndex == -1) {
|
||||
// Standard format convertation without image transformation
|
||||
if (subpixelGlyph) {
|
||||
int offsetX = ftglyph->bitmap_left - topLeftX * subpixelResolutionX;
|
||||
int offsetY = -ftglyph->bitmap_top - topLeftY * subpixelResolutionY;
|
||||
CopySupplementarySubpixelToGrey8(ftglyph->bitmap.buffer,
|
||||
ftglyph->bitmap.pitch,
|
||||
ftglyph->bitmap.width,
|
||||
ftglyph->bitmap.rows,
|
||||
glyphInfo->image,
|
||||
rowBytes,
|
||||
width,
|
||||
height,
|
||||
offsetX,
|
||||
offsetY,
|
||||
subpixelResolutionX,
|
||||
subpixelResolutionY,
|
||||
imageSize);
|
||||
}
|
||||
else if (context->fixedSizeIndex == -1) {
|
||||
// Standard format conversion without image transformation
|
||||
if (ftglyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO) {
|
||||
/* convert from 8 pixels per byte to 1 byte per pixel */
|
||||
CopyBW2Grey8(ftglyph->bitmap.buffer,
|
||||
|
||||
@@ -27,8 +27,17 @@
|
||||
#include "sun_font_SunLayoutEngine.h"
|
||||
|
||||
#include "hb.h"
|
||||
#include "hb-ot.h"
|
||||
#include "hb-jdk.h"
|
||||
#include <stdlib.h>
|
||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
#include "jvm_md.h"
|
||||
#include "jni_util.h"
|
||||
|
||||
#define JHARFBUZZ_DLL JNI_LIB_NAME("jharfbuzz")
|
||||
#define HARFBUZZ_DLL JNI_LIB_NAME("harfbuzz")
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define HB_UNUSED __attribute__((unused))
|
||||
@@ -36,6 +45,169 @@
|
||||
#define HB_UNUSED
|
||||
#endif
|
||||
|
||||
p_hb_buffer_create_type p_hb_buffer_create;
|
||||
p_hb_buffer_set_script_type p_hb_buffer_set_script;
|
||||
p_hb_buffer_set_language_type p_hb_buffer_set_language;
|
||||
p_hb_buffer_set_direction_type p_hb_buffer_set_direction;
|
||||
p_hb_buffer_set_cluster_level_type p_hb_buffer_set_cluster_level;
|
||||
p_hb_buffer_add_utf16_type p_hb_buffer_add_utf16;
|
||||
p_hb_feature_from_string_type p_hb_feature_from_string;
|
||||
p_hb_buffer_get_length_type p_hb_buffer_get_length;
|
||||
p_hb_buffer_get_glyph_infos_type p_hb_buffer_get_glyph_infos;
|
||||
p_hb_buffer_get_glyph_positions_type p_hb_buffer_get_glyph_positions;
|
||||
p_hb_buffer_destroy_type p_hb_buffer_destroy;
|
||||
p_hb_font_destroy_type p_hb_font_destroy;
|
||||
p_hb_font_funcs_create_type p_hb_font_funcs_create;
|
||||
p_hb_font_funcs_set_nominal_glyphs_func_type p_hb_font_funcs_set_nominal_glyphs_func;
|
||||
p_hb_font_funcs_set_variation_glyph_func_type p_hb_font_funcs_set_variation_glyph_func;
|
||||
p_hb_font_funcs_set_glyph_h_advance_func_type p_hb_font_funcs_set_glyph_h_advance_func;
|
||||
p_hb_font_funcs_set_glyph_v_advance_func_type p_hb_font_funcs_set_glyph_v_advance_func;
|
||||
p_hb_font_funcs_set_glyph_h_origin_func_type p_hb_font_funcs_set_glyph_h_origin_func;
|
||||
p_hb_font_funcs_set_glyph_v_origin_func_type p_hb_font_funcs_set_glyph_v_origin_func;
|
||||
p_hb_font_funcs_set_glyph_h_kerning_func_type p_hb_font_funcs_set_glyph_h_kerning_func;
|
||||
p_hb_font_funcs_set_glyph_v_kerning_func_type p_hb_font_funcs_set_glyph_v_kerning_func;
|
||||
p_hb_font_funcs_set_glyph_extents_func_type p_hb_font_funcs_set_glyph_extents_func;
|
||||
p_hb_font_funcs_set_glyph_contour_point_func_type p_hb_font_funcs_set_glyph_contour_point_func;
|
||||
p_hb_font_funcs_set_glyph_name_func_type p_hb_font_funcs_set_glyph_name_func;
|
||||
p_hb_font_funcs_set_glyph_from_name_func_type p_hb_font_funcs_set_glyph_from_name_func;
|
||||
p_hb_font_funcs_make_immutable_type p_hb_font_funcs_make_immutable;
|
||||
p_hb_blob_create_type p_hb_blob_create;
|
||||
p_hb_face_create_for_tables_type p_hb_face_create_for_tables;
|
||||
p_hb_font_create_type p_hb_font_create;
|
||||
p_hb_font_set_funcs_type p_hb_font_set_funcs;
|
||||
p_hb_font_set_scale_type p_hb_font_set_scale;
|
||||
p_hb_shape_full_type p_hb_shape_full;
|
||||
p_hb_font_funcs_set_nominal_glyph_func_type p_hb_font_funcs_set_nominal_glyph_func;
|
||||
p_hb_face_destroy_type p_hb_face_destroy;
|
||||
p_hb_ot_tag_to_language_type p_hb_ot_tag_to_language;
|
||||
|
||||
static int initialisedHBAPI = 0;
|
||||
static int initialisationFailed = 0;
|
||||
|
||||
int initHBAPI() {
|
||||
if (initialisedHBAPI) {
|
||||
return initialisedHBAPI;
|
||||
}
|
||||
|
||||
if (initialisationFailed) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
void* libharfbuzz = NULL;
|
||||
libharfbuzz = dlopen(JHARFBUZZ_DLL, RTLD_LOCAL | RTLD_LAZY);
|
||||
if (libharfbuzz == NULL) {
|
||||
initialisationFailed = 1;
|
||||
CHECK_NULL_RETURN(libharfbuzz = dlopen(HARFBUZZ_DLL, RTLD_LOCAL | RTLD_LAZY), 0);
|
||||
initialisationFailed = 0;
|
||||
}
|
||||
|
||||
p_hb_buffer_create = (p_hb_buffer_create_type)dlsym(libharfbuzz, "hb_buffer_create");
|
||||
p_hb_buffer_set_script = (p_hb_buffer_set_script_type)dlsym(libharfbuzz, "hb_buffer_set_script");
|
||||
p_hb_buffer_set_language = (p_hb_buffer_set_language_type)dlsym(libharfbuzz, "hb_buffer_set_language");
|
||||
p_hb_buffer_set_direction = (p_hb_buffer_set_direction_type)dlsym(libharfbuzz, "hb_buffer_set_direction");
|
||||
p_hb_buffer_set_cluster_level = (p_hb_buffer_set_cluster_level_type)dlsym(libharfbuzz, "hb_buffer_set_cluster_level");
|
||||
p_hb_buffer_add_utf16 = (p_hb_buffer_add_utf16_type)dlsym(libharfbuzz, "hb_buffer_add_utf16");
|
||||
p_hb_feature_from_string = (p_hb_feature_from_string_type)dlsym(libharfbuzz, "hb_feature_from_string");
|
||||
p_hb_buffer_get_length = (p_hb_buffer_get_length_type)dlsym(libharfbuzz, "hb_buffer_get_length");
|
||||
p_hb_buffer_get_glyph_infos = (p_hb_buffer_get_glyph_infos_type)dlsym(libharfbuzz, "hb_buffer_get_glyph_infos");
|
||||
p_hb_buffer_get_glyph_positions = (p_hb_buffer_get_glyph_positions_type)dlsym(libharfbuzz, "hb_buffer_get_glyph_positions");
|
||||
p_hb_buffer_destroy = (p_hb_buffer_destroy_type)dlsym(libharfbuzz, "hb_buffer_destroy");
|
||||
p_hb_font_destroy = (p_hb_font_destroy_type)dlsym(libharfbuzz, "hb_font_destroy");
|
||||
p_hb_font_funcs_create = (p_hb_font_funcs_create_type)dlsym(libharfbuzz, "hb_font_funcs_create");
|
||||
p_hb_font_funcs_set_nominal_glyphs_func =
|
||||
(p_hb_font_funcs_set_nominal_glyphs_func_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_set_nominal_glyphs_func");
|
||||
p_hb_font_funcs_set_nominal_glyph_func = (p_hb_font_funcs_set_nominal_glyph_func_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_set_nominal_glyph_func");
|
||||
p_hb_font_funcs_set_variation_glyph_func =
|
||||
(p_hb_font_funcs_set_variation_glyph_func_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_set_variation_glyph_func");
|
||||
p_hb_font_funcs_set_glyph_h_advance_func =
|
||||
(p_hb_font_funcs_set_glyph_h_advance_func_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_set_glyph_h_advance_func");
|
||||
p_hb_font_funcs_set_glyph_v_advance_func =
|
||||
(p_hb_font_funcs_set_glyph_v_advance_func_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_set_glyph_v_advance_func");
|
||||
p_hb_font_funcs_set_glyph_h_origin_func =
|
||||
(p_hb_font_funcs_set_glyph_h_origin_func_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_set_glyph_h_origin_func");
|
||||
p_hb_font_funcs_set_glyph_v_origin_func =
|
||||
(p_hb_font_funcs_set_glyph_v_origin_func_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_set_glyph_v_origin_func");
|
||||
p_hb_font_funcs_set_glyph_h_kerning_func =
|
||||
(p_hb_font_funcs_set_glyph_h_kerning_func_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_set_glyph_h_kerning_func");
|
||||
p_hb_font_funcs_set_glyph_v_kerning_func =
|
||||
(p_hb_font_funcs_set_glyph_v_kerning_func_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_set_glyph_v_kerning_func");
|
||||
p_hb_font_funcs_set_glyph_extents_func =
|
||||
(p_hb_font_funcs_set_glyph_extents_func_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_set_glyph_extents_func");
|
||||
p_hb_font_funcs_set_glyph_contour_point_func =
|
||||
(p_hb_font_funcs_set_glyph_contour_point_func_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_set_glyph_contour_point_func");
|
||||
p_hb_font_funcs_set_glyph_name_func =
|
||||
(p_hb_font_funcs_set_glyph_name_func_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_set_glyph_name_func");
|
||||
p_hb_font_funcs_set_glyph_from_name_func =
|
||||
(p_hb_font_funcs_set_glyph_from_name_func_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_set_glyph_from_name_func");
|
||||
p_hb_font_funcs_make_immutable =
|
||||
(p_hb_font_funcs_make_immutable_type)dlsym(
|
||||
libharfbuzz, "hb_font_funcs_make_immutable");
|
||||
p_hb_blob_create =
|
||||
(p_hb_blob_create_type)dlsym(libharfbuzz, "hb_blob_create");
|
||||
p_hb_face_create_for_tables =
|
||||
(p_hb_face_create_for_tables_type)dlsym(libharfbuzz, "hb_face_create_for_tables");
|
||||
p_hb_font_create =
|
||||
(p_hb_font_create_type)dlsym(libharfbuzz, "hb_font_create");
|
||||
p_hb_font_set_funcs =
|
||||
(p_hb_font_set_funcs_type)dlsym(libharfbuzz, "hb_font_set_funcs");
|
||||
p_hb_font_set_scale =
|
||||
(p_hb_font_set_scale_type)dlsym(libharfbuzz, "hb_font_set_scale");
|
||||
p_hb_shape_full = (p_hb_shape_full_type)dlsym(libharfbuzz, "hb_shape_full");
|
||||
p_hb_ot_tag_to_language = (p_hb_ot_tag_to_language_type)dlsym(libharfbuzz, "hb_ot_tag_to_language");
|
||||
#else
|
||||
p_hb_buffer_create = hb_buffer_create;
|
||||
p_hb_buffer_set_script = hb_buffer_set_script;
|
||||
p_hb_buffer_set_language = hb_buffer_set_language;
|
||||
p_hb_buffer_set_direction = hb_buffer_set_direction;
|
||||
p_hb_buffer_set_cluster_level = hb_buffer_set_cluster_level;
|
||||
p_hb_buffer_add_utf16 = hb_buffer_add_utf16;
|
||||
p_hb_feature_from_string = hb_feature_from_string;
|
||||
p_hb_buffer_get_length = hb_buffer_get_length;
|
||||
p_hb_buffer_get_glyph_infos = hb_buffer_get_glyph_infos;
|
||||
p_hb_buffer_get_glyph_positions = hb_buffer_get_glyph_positions;
|
||||
p_hb_buffer_destroy = hb_buffer_destroy;
|
||||
p_hb_font_destroy = hb_font_destroy;
|
||||
p_hb_font_funcs_create = hb_font_funcs_create;
|
||||
p_hb_font_funcs_set_nominal_glyph_func = hb_font_funcs_set_nominal_glyph_func;
|
||||
p_hb_font_funcs_set_nominal_glyphs_func = hb_font_funcs_set_nominal_glyphs_func;
|
||||
p_hb_font_funcs_set_variation_glyph_func = hb_font_funcs_set_variation_glyph_func;
|
||||
p_hb_font_funcs_set_glyph_h_advance_func = hb_font_funcs_set_glyph_h_advance_func;
|
||||
p_hb_font_funcs_set_glyph_v_advance_func = hb_font_funcs_set_glyph_v_advance_func;
|
||||
p_hb_font_funcs_set_glyph_h_origin_func = hb_font_funcs_set_glyph_h_origin_func;
|
||||
p_hb_font_funcs_set_glyph_v_origin_func = hb_font_funcs_set_glyph_v_origin_func;
|
||||
p_hb_font_funcs_set_glyph_h_kerning_func = hb_font_funcs_set_glyph_h_kerning_func;
|
||||
p_hb_font_funcs_set_glyph_v_kerning_func = hb_font_funcs_set_glyph_v_kerning_func;
|
||||
p_hb_font_funcs_set_glyph_extents_func = hb_font_funcs_set_glyph_extents_func;
|
||||
p_hb_font_funcs_set_glyph_contour_point_func = hb_font_funcs_set_glyph_contour_point_func;
|
||||
p_hb_font_funcs_set_glyph_name_func = hb_font_funcs_set_glyph_name_func;
|
||||
p_hb_font_funcs_set_glyph_from_name_func = hb_font_funcs_set_glyph_from_name_func;
|
||||
p_hb_font_funcs_make_immutable = hb_font_funcs_make_immutable;
|
||||
p_hb_blob_create = hb_blob_create;
|
||||
p_hb_face_create_for_tables = hb_face_create_for_tables;
|
||||
p_hb_font_create = hb_font_create;
|
||||
p_hb_font_set_funcs = hb_font_set_funcs;
|
||||
p_hb_font_set_scale = hb_font_set_scale;
|
||||
p_hb_shape_full = hb_shape_full;
|
||||
p_hb_ot_tag_to_language = hb_ot_tag_to_language;
|
||||
#endif
|
||||
|
||||
initialisedHBAPI = 1;
|
||||
return initialisedHBAPI;
|
||||
}
|
||||
|
||||
static hb_bool_t
|
||||
hb_jdk_get_nominal_glyph (hb_font_t *font HB_UNUSED,
|
||||
@@ -268,31 +440,31 @@ _hb_jdk_get_font_funcs (void)
|
||||
hb_font_funcs_t *ff;
|
||||
|
||||
if (!jdk_ffuncs) {
|
||||
ff = hb_font_funcs_create();
|
||||
ff = p_hb_font_funcs_create();
|
||||
|
||||
hb_font_funcs_set_nominal_glyph_func(ff, hb_jdk_get_nominal_glyph, NULL, NULL);
|
||||
hb_font_funcs_set_variation_glyph_func(ff, hb_jdk_get_variation_glyph, NULL, NULL);
|
||||
hb_font_funcs_set_glyph_h_advance_func(ff,
|
||||
p_hb_font_funcs_set_nominal_glyph_func(ff, hb_jdk_get_nominal_glyph, NULL, NULL);
|
||||
p_hb_font_funcs_set_variation_glyph_func(ff, hb_jdk_get_variation_glyph, NULL, NULL);
|
||||
p_hb_font_funcs_set_glyph_h_advance_func(ff,
|
||||
hb_jdk_get_glyph_h_advance, NULL, NULL);
|
||||
hb_font_funcs_set_glyph_v_advance_func(ff,
|
||||
p_hb_font_funcs_set_glyph_v_advance_func(ff,
|
||||
hb_jdk_get_glyph_v_advance, NULL, NULL);
|
||||
hb_font_funcs_set_glyph_h_origin_func(ff,
|
||||
p_hb_font_funcs_set_glyph_h_origin_func(ff,
|
||||
hb_jdk_get_glyph_h_origin, NULL, NULL);
|
||||
hb_font_funcs_set_glyph_v_origin_func(ff,
|
||||
p_hb_font_funcs_set_glyph_v_origin_func(ff,
|
||||
hb_jdk_get_glyph_v_origin, NULL, NULL);
|
||||
hb_font_funcs_set_glyph_h_kerning_func(ff,
|
||||
p_hb_font_funcs_set_glyph_h_kerning_func(ff,
|
||||
hb_jdk_get_glyph_h_kerning, NULL, NULL);
|
||||
hb_font_funcs_set_glyph_v_kerning_func(ff,
|
||||
p_hb_font_funcs_set_glyph_v_kerning_func(ff,
|
||||
hb_jdk_get_glyph_v_kerning, NULL, NULL);
|
||||
hb_font_funcs_set_glyph_extents_func(ff,
|
||||
p_hb_font_funcs_set_glyph_extents_func(ff,
|
||||
hb_jdk_get_glyph_extents, NULL, NULL);
|
||||
hb_font_funcs_set_glyph_contour_point_func(ff,
|
||||
p_hb_font_funcs_set_glyph_contour_point_func(ff,
|
||||
hb_jdk_get_glyph_contour_point, NULL, NULL);
|
||||
hb_font_funcs_set_glyph_name_func(ff,
|
||||
p_hb_font_funcs_set_glyph_name_func(ff,
|
||||
hb_jdk_get_glyph_name, NULL, NULL);
|
||||
hb_font_funcs_set_glyph_from_name_func(ff,
|
||||
p_hb_font_funcs_set_glyph_from_name_func(ff,
|
||||
hb_jdk_get_glyph_from_name, NULL, NULL);
|
||||
hb_font_funcs_make_immutable(ff); // done setting functions.
|
||||
p_hb_font_funcs_make_immutable(ff); // done setting functions.
|
||||
jdk_ffuncs = ff;
|
||||
}
|
||||
return jdk_ffuncs;
|
||||
@@ -353,7 +525,7 @@ reference_table(hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) {
|
||||
}
|
||||
env->GetByteArrayRegion(tableBytes, 0, length, (jbyte*)buffer);
|
||||
|
||||
return hb_blob_create((const char *)buffer, length,
|
||||
return p_hb_blob_create((const char *)buffer, length,
|
||||
HB_MEMORY_MODE_WRITABLE,
|
||||
buffer, free);
|
||||
}
|
||||
@@ -382,7 +554,7 @@ JNIEXPORT jlong JNICALL Java_sun_font_SunLayoutEngine_createFace(JNIEnv *env,
|
||||
free(fi);
|
||||
return 0;
|
||||
}
|
||||
hb_face_t *face = hb_face_create_for_tables(reference_table, fi,
|
||||
hb_face_t *face = p_hb_face_create_for_tables(reference_table, fi,
|
||||
cleanupFontInfo);
|
||||
return ptr_to_jlong(face);
|
||||
}
|
||||
@@ -396,7 +568,7 @@ JNIEXPORT void JNICALL Java_sun_font_SunLayoutEngine_disposeFace(JNIEnv *env,
|
||||
jclass cls,
|
||||
jlong ptr) {
|
||||
hb_face_t* face = (hb_face_t*) jlong_to_ptr(ptr);
|
||||
hb_face_destroy(face);
|
||||
p_hb_face_destroy(face);
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
@@ -407,11 +579,11 @@ static hb_font_t* _hb_jdk_font_create(hb_face_t* face,
|
||||
|
||||
hb_font_t *font;
|
||||
|
||||
font = hb_font_create(face);
|
||||
hb_font_set_funcs (font,
|
||||
font = p_hb_font_create(face);
|
||||
p_hb_font_set_funcs (font,
|
||||
_hb_jdk_get_font_funcs (),
|
||||
jdkFontInfo, (hb_destroy_func_t) _do_nothing);
|
||||
hb_font_set_scale (font,
|
||||
p_hb_font_set_scale (font,
|
||||
HBFloatToFixed(jdkFontInfo->ptSize*jdkFontInfo->devScale),
|
||||
HBFloatToFixed(jdkFontInfo->ptSize*jdkFontInfo->devScale));
|
||||
return font;
|
||||
|
||||
@@ -72,6 +72,166 @@ hb_jdk_font_create(hb_face_t* hbFace,
|
||||
void
|
||||
hb_jdk_font_set_funcs(hb_font_t *font);
|
||||
|
||||
typedef hb_buffer_t* (*p_hb_buffer_create_type) ();
|
||||
typedef void (*p_hb_buffer_set_script_type) (hb_buffer_t *buffer,
|
||||
hb_script_t script);
|
||||
|
||||
typedef void (*p_hb_buffer_set_language_type) (hb_buffer_t *buffer,
|
||||
hb_language_t language);
|
||||
|
||||
typedef void (*p_hb_buffer_set_direction_type) (hb_buffer_t *buffer,
|
||||
hb_direction_t direction);
|
||||
|
||||
typedef void (*p_hb_buffer_set_cluster_level_type) (hb_buffer_t *buffer,
|
||||
hb_buffer_cluster_level_t cluster_level);
|
||||
|
||||
typedef void (*p_hb_buffer_add_utf16_type) (hb_buffer_t *buffer,
|
||||
const uint16_t *text,
|
||||
int text_length,
|
||||
unsigned int item_offset,
|
||||
int item_length);
|
||||
|
||||
typedef hb_bool_t (*p_hb_feature_from_string_type) (const char *str,
|
||||
int len,
|
||||
hb_feature_t *feature);
|
||||
|
||||
typedef unsigned int (*p_hb_buffer_get_length_type) (hb_buffer_t *buffer);
|
||||
|
||||
typedef hb_glyph_info_t* (*p_hb_buffer_get_glyph_infos_type) (hb_buffer_t *buffer,
|
||||
unsigned int *length);
|
||||
|
||||
typedef hb_glyph_position_t* (*p_hb_buffer_get_glyph_positions_type) (hb_buffer_t *buffer,
|
||||
unsigned int *length);
|
||||
|
||||
typedef void (*p_hb_buffer_destroy_type) (hb_buffer_t *buffer);
|
||||
|
||||
typedef void (*p_hb_font_destroy_type) (hb_font_t *font);
|
||||
|
||||
typedef hb_font_funcs_t* (*p_hb_font_funcs_create_type) ();
|
||||
|
||||
typedef void (*p_hb_font_funcs_set_nominal_glyphs_func_type) (hb_font_funcs_t *ffuncs,
|
||||
hb_font_get_nominal_glyphs_func_t func,
|
||||
void *user_data, hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_font_funcs_set_variation_glyph_func_type) (hb_font_funcs_t *ffuncs,
|
||||
hb_font_get_variation_glyph_func_t func,
|
||||
void *user_data, hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_font_funcs_set_glyph_h_advance_func_type) (hb_font_funcs_t *ffuncs,
|
||||
hb_font_get_glyph_h_advance_func_t func,
|
||||
void *user_data, hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_font_funcs_set_glyph_v_advance_func_type) (hb_font_funcs_t *ffuncs,
|
||||
hb_font_get_glyph_v_advance_func_t func,
|
||||
void *user_data, hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_font_funcs_set_glyph_h_origin_func_type) (hb_font_funcs_t *ffuncs,
|
||||
hb_font_get_glyph_h_origin_func_t func,
|
||||
void *user_data, hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_font_funcs_set_glyph_v_origin_func_type) (hb_font_funcs_t *ffuncs,
|
||||
hb_font_get_glyph_v_origin_func_t func,
|
||||
void *user_data, hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_font_funcs_set_glyph_h_kerning_func_type) (hb_font_funcs_t *ffuncs,
|
||||
hb_font_get_glyph_h_kerning_func_t func,
|
||||
void *user_data, hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_font_funcs_set_glyph_v_kerning_func_type) (hb_font_funcs_t *ffuncs,
|
||||
hb_font_get_glyph_v_kerning_func_t func,
|
||||
void *user_data, hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_font_funcs_set_glyph_extents_func_type) (hb_font_funcs_t *ffuncs,
|
||||
hb_font_get_glyph_extents_func_t func,
|
||||
void *user_data, hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_font_funcs_set_glyph_contour_point_func_type) (hb_font_funcs_t *ffuncs,
|
||||
hb_font_get_glyph_contour_point_func_t func,
|
||||
void *user_data, hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_font_funcs_set_glyph_name_func_type) (hb_font_funcs_t *ffuncs,
|
||||
hb_font_get_glyph_name_func_t func,
|
||||
void *user_data, hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_font_funcs_set_glyph_from_name_func_type) (hb_font_funcs_t *ffuncs,
|
||||
hb_font_get_glyph_from_name_func_t func,
|
||||
void *user_data, hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_font_funcs_make_immutable_type) (hb_font_funcs_t *ffuncs);
|
||||
|
||||
typedef hb_blob_t * (*p_hb_blob_create_type) (const char *data,
|
||||
unsigned int length,
|
||||
hb_memory_mode_t mode,
|
||||
void *user_data,
|
||||
hb_destroy_func_t destroy);
|
||||
|
||||
typedef hb_face_t *
|
||||
(*p_hb_face_create_for_tables_type) (hb_reference_table_func_t reference_table_func,
|
||||
void *user_data,
|
||||
hb_destroy_func_t destroy);
|
||||
|
||||
typedef hb_font_t * (*p_hb_font_create_type) (hb_face_t *face);
|
||||
|
||||
typedef void (*p_hb_font_set_funcs_type) (hb_font_t *font,
|
||||
hb_font_funcs_t *klass,
|
||||
void *font_data,
|
||||
hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_font_set_scale_type) (hb_font_t *font,
|
||||
int x_scale,
|
||||
int y_scale);
|
||||
|
||||
typedef hb_bool_t (*p_hb_shape_full_type) (hb_font_t *font,
|
||||
hb_buffer_t *buffer,
|
||||
const hb_feature_t *features,
|
||||
unsigned int num_features,
|
||||
const char * const *shaper_list);
|
||||
|
||||
typedef void (*p_hb_font_funcs_set_nominal_glyph_func_type) (hb_font_funcs_t *ffuncs,
|
||||
hb_font_get_nominal_glyph_func_t func,
|
||||
void *user_data, hb_destroy_func_t destroy);
|
||||
|
||||
typedef void (*p_hb_face_destroy_type) (hb_face_t *face);
|
||||
|
||||
typedef hb_language_t (*p_hb_ot_tag_to_language_type) (hb_tag_t tag);
|
||||
|
||||
extern p_hb_buffer_create_type p_hb_buffer_create;
|
||||
extern p_hb_buffer_set_script_type p_hb_buffer_set_script;
|
||||
extern p_hb_buffer_set_language_type p_hb_buffer_set_language;
|
||||
extern p_hb_buffer_set_direction_type p_hb_buffer_set_direction;
|
||||
extern p_hb_buffer_set_cluster_level_type p_hb_buffer_set_cluster_level;
|
||||
extern p_hb_buffer_add_utf16_type p_hb_buffer_add_utf16;
|
||||
extern p_hb_feature_from_string_type p_hb_feature_from_string;
|
||||
extern p_hb_buffer_get_length_type p_hb_buffer_get_length;
|
||||
extern p_hb_buffer_get_glyph_infos_type p_hb_buffer_get_glyph_infos;
|
||||
extern p_hb_buffer_get_glyph_positions_type p_hb_buffer_get_glyph_positions;
|
||||
extern p_hb_buffer_destroy_type p_hb_buffer_destroy;
|
||||
extern p_hb_font_destroy_type p_hb_font_destroy;
|
||||
extern p_hb_font_funcs_create_type p_hb_font_funcs_create;
|
||||
extern p_hb_font_funcs_set_nominal_glyphs_func_type p_hb_font_funcs_set_nominal_glyphs_func;
|
||||
extern p_hb_font_funcs_set_variation_glyph_func_type p_hb_font_funcs_set_variation_glyph_func;
|
||||
extern p_hb_font_funcs_set_glyph_h_advance_func_type p_hb_font_funcs_set_glyph_h_advance_func;
|
||||
extern p_hb_font_funcs_set_glyph_v_advance_func_type p_hb_font_funcs_set_glyph_v_advance_func;
|
||||
extern p_hb_font_funcs_set_glyph_h_origin_func_type p_hb_font_funcs_set_glyph_h_origin_func;
|
||||
extern p_hb_font_funcs_set_glyph_v_origin_func_type p_hb_font_funcs_set_glyph_v_origin_func;
|
||||
extern p_hb_font_funcs_set_glyph_h_kerning_func_type p_hb_font_funcs_set_glyph_h_kerning_func;
|
||||
extern p_hb_font_funcs_set_glyph_v_kerning_func_type p_hb_font_funcs_set_glyph_v_kerning_func;
|
||||
extern p_hb_font_funcs_set_glyph_extents_func_type p_hb_font_funcs_set_glyph_extents_func;
|
||||
extern p_hb_font_funcs_set_glyph_contour_point_func_type p_hb_font_funcs_set_glyph_contour_point_func;
|
||||
extern p_hb_font_funcs_set_glyph_name_func_type p_hb_font_funcs_set_glyph_name_func;
|
||||
extern p_hb_font_funcs_set_glyph_from_name_func_type p_hb_font_funcs_set_glyph_from_name_func;
|
||||
extern p_hb_font_funcs_make_immutable_type p_hb_font_funcs_make_immutable;
|
||||
extern p_hb_blob_create_type p_hb_blob_create;
|
||||
extern p_hb_face_create_for_tables_type p_hb_face_create_for_tables;
|
||||
extern p_hb_font_create_type p_hb_font_create;
|
||||
extern p_hb_font_set_funcs_type p_hb_font_set_funcs;
|
||||
extern p_hb_font_set_scale_type p_hb_font_set_scale;
|
||||
extern p_hb_shape_full_type p_hb_shape_full;
|
||||
extern p_hb_font_funcs_set_nominal_glyph_func_type p_hb_font_funcs_set_nominal_glyph_func;
|
||||
extern p_hb_face_destroy_type p_hb_face_destroy;
|
||||
extern p_hb_ot_tag_to_language_type p_hb_ot_tag_to_language;
|
||||
|
||||
int initHBAPI();
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "sun_font_SunFontManager.h"
|
||||
#include "sun_font_NullFontScaler.h"
|
||||
#include "sun_font_StrikeCache.h"
|
||||
#include "hb-jdk.h"
|
||||
|
||||
static void *theNullScalerContext = NULL;
|
||||
extern void AccelGlyphCache_RemoveAllCellInfos(GlyphInfo *glyph);
|
||||
@@ -199,6 +200,7 @@ Java_sun_font_SunFontManager_initIDs
|
||||
(JNIEnv *env, jclass cls) {
|
||||
|
||||
initFontIDs(env);
|
||||
initHBAPI();
|
||||
}
|
||||
|
||||
JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv *env) {
|
||||
@@ -314,7 +316,7 @@ Java_sun_font_StrikeCache_getGlyphCacheDescription
|
||||
GlyphInfo *info;
|
||||
size_t baseAddr;
|
||||
|
||||
if ((*env)->GetArrayLength(env, results) < 13) {
|
||||
if ((*env)->GetArrayLength(env, results) < 15) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -341,6 +343,8 @@ Java_sun_font_StrikeCache_getGlyphCacheDescription
|
||||
nresults[10] = (jlong)(uintptr_t)info; /* invisible glyph */
|
||||
nresults[11] = (size_t)&(info->cellInfo)-baseAddr;
|
||||
nresults[12] = (size_t)&(info->managed)-baseAddr;
|
||||
nresults[13] = (size_t)&(info->subpixelResolutionX)-baseAddr;
|
||||
nresults[14] = (size_t)&(info->subpixelResolutionY)-baseAddr;
|
||||
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, results, nresults, 0);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user