├── README.md ├── applyTuxjdk.sh ├── chrootBuild-opensuse-example.sh ├── cloneCheckoutPackOpenjdk.sh ├── cloneCheckoutPackTuxjdk.sh ├── configureBuildOpenjdk.sh ├── default_swing.properties ├── docker ├── Dockerfile └── docker-build-static-tuxjdk.sh ├── launcher.sh ├── quilt-patches ├── backport │ ├── compare-pointer-with-literal.diff │ ├── less-warnings.diff │ └── opensuse-link-zlib-as-needed.diff ├── series ├── tune │ ├── default-gc.diff │ ├── empty-ctsym.diff │ └── full-srczip.diff └── tuxjdk │ ├── add-fontconfig-support.diff │ ├── change-vendor.diff │ └── configurable-ui-fonts.diff ├── setupQuiltEnv.sh ├── tuxjdk-beta.spec ├── tuxjdk-rpmlintrc └── tuxjdk.spec /README.md: -------------------------------------------------------------------------------- 1 | This project contains series of patched to OpenJDK to enhance user experience with Java-based and Swing-based tools (NetBeans, Idea, Android Studio, etc) 2 | 3 | # Download 4 | Download latest build of tuxjdk for different distributions here: 5 | [OBS repository](http://download.opensuse.org/repositories/home:/tuxjdk/)
6 | It will be installed under `/opt/tuxjdk` and will not touch the alternatives and 7 | any other java binaries you might have in path. 8 | 9 | # Quickstart (for packagers and developers) 10 | 11 | TuxJdk uses [Quilt](http://en.wikipedia.org/wiki/Quilt_(software)) to manage patches, and [here](http://www.suse.de/~agruen/quilt.pdf) is a good tutorial on using Quilt.
12 | Additionally, project contains number of helper scripts to automate most common tasks.
13 | To apply tuxjdk, do the following steps: 14 | 15 | ```bash 16 | # clone tuxjdk: 17 | git clone 'https://github.com/tuxjdk/tuxjdk.git' 18 | # clone openjdk: 19 | HGTAG='jdk8u66-b17' 20 | hg clone 'http://hg.openjdk.java.net/jdk8u/jdk8u' $HGTAG 21 | cd $HGTAG 22 | bash ./get_source.sh 23 | bash ./common/bin/hgforest.sh checkout $HGTAG 24 | # run helper script to apply tuxjdk onto openjdk sources: 25 | ../tuxjdk/applyTuxjdk.sh 26 | # tuxjdk applied, now we can create external build folder: 27 | mkdir ../build 28 | cd ../build 29 | # and run configure script with your favourite options: 30 | bash ../$HGTAG/configure 31 | # then make images: 32 | make JAVAC_FLAGS=-g images 33 | # now wait until the build is complete, and go see the images: 34 | ls images/j2sdk-image 35 | ls images/j2re-image 36 | ``` 37 | # Versioning 38 | Verion of tuxjdk is a desperate attempt to put some sense into current java versioning scheme. 39 | First two numbers reflects major and update version of java for which current patches are adapted. 40 | Third number is the version of tuxjdk itself, padded with 0 to have a natural sorting. 41 | 42 | # Distribution packagers 43 | 44 | * Source package files for Ubuntu/Arch/others are appreciated. 45 | * Project is organized into series of patches, they should not be dependent. Feel free to use them selectively and report any issues. 46 | 47 | # Patches list 48 | * **backport** contains patches that may be included in next version of openjdk or those that should but probably will not. 49 | * **compare-pointer-with-literal** fixes a mistake in C code, detected by OBS. 50 | * **less-warnings** disable some most noisy warnings during the compilation. 51 | * **opensuse-link-zlib-as-needed** fixes the linking against system zlib. 52 | * **tune** contains patches to tune the openjdk default settings or distribution package. 53 | * **default-gc** changes the default garbage collector to *ConcMarkSwee*, it greatly lowers the footprint and boosts the performance of NetBeans. 54 | * **empty-ctsym** makes the *ct.sym* file completely empty. 55 | * **full-srczip** forces the openjdk to pack all the existing sources into *src.zip* file, even from *com.sun* and *sun* packages. 56 | * **tuxjdk** contains tuxjdk-specific changes, mostly fonts related. 57 | * **change-vendor** changes the system properties to identify tuxjdk as vendor. 58 | * **add-fontconfig-support** forces reading of system fontconfig settings and rendering the fonts similarly to native toolkits such as Qt and GTK, instead of using hardcoded rendering path. 59 | * **configurable-ui-fonts** fixes the typographical point size (upstream openjdk completely ignores the 1/72" standard), adds a possibility to configure defaut font size (hardcoded to 12 in most locations and to 11 in some locations in upstream) and allows to specify desired default font antialiasing if the are any problems detecting one from system (upstream defaults behaviour is not well-defined, and needs constant attention from developers not to forget to set proper RenderingHints). 60 | 61 | # Planned features, tasks backlog 62 | ## 8.66.04 63 | * [x] change logic of 'awt.useSystemAAFontSettings'. 64 | * [ ] get working cacerts file to make egit work with github. 65 | * [ ] fix the build of openjdk using statically-linked tuxjdk. 66 | 67 | ## 8.66.05 68 | * [ ] add possibility to specify antialiasing 'grayscale.' 69 | * [ ] change antialiasing 'on' to autodetect between grayscale and lcd. 70 | * [ ] font size scaling: configure font size to 12 but render as 9, for badly-written apps like jedit. 71 | * [ ] split single huge patch into series of smaller patches. 72 | * [ ] check fontconfig support for memory leaks. 73 | 74 | ## General tasks 75 | * [ ] add default settings autudetection app. 76 | * [ ] Ubuntu packages 77 | * [ ] document font size settings 78 | * [ ] document font antialiasing settings 79 | * [ ] document font scaling settings 80 | * [ ] document default GC change 81 | -------------------------------------------------------------------------------- /applyTuxjdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | QUILT="$( which quilt 2>/dev/null )" 4 | if [[ -z $QUILT ]] ; then 5 | echo 'quilt not found' >&2 6 | exit 1 7 | fi 8 | 9 | sourceSetupEnv() { 10 | local SCRIPT_SOURCE 11 | local SCRIPT_DIR 12 | ## resolve folder of this script, following all symlinks, 13 | ## http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in 14 | SCRIPT_SOURCE="${BASH_SOURCE[0]}" 15 | while [ -h "$SCRIPT_SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink 16 | SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )" 17 | SCRIPT_SOURCE="$(readlink "$SCRIPT_SOURCE")" 18 | # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located 19 | [[ $SCRIPT_SOURCE != /* ]] && SCRIPT_SOURCE="$SCRIPT_DIR/$SCRIPT_SOURCE" 20 | done 21 | SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )" 22 | 23 | source "$SCRIPT_DIR/setupQuiltEnv.sh" 24 | } 25 | 26 | sourceSetupEnv 27 | 28 | echo "Applying quilt patches on current folder..." 29 | "$QUILT" push -a 30 | 31 | readonly result=$? 32 | if [ "$result" = 0 ] || [ "$result" = 2 ] 33 | then 34 | echo '' 35 | echo 'Quilt patches applied.' 36 | else 37 | echo '' 38 | echo -e '\e[91mQuilt patches application failed\e[0m' 39 | exit 1 40 | fi 41 | -------------------------------------------------------------------------------- /chrootBuild-opensuse-example.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$#" -ne 2 ] ; then 4 | echo "expected 2 arguments:" 5 | echo " * folder to use as chroot for build" 6 | echo " * build number" 7 | exit 1; 8 | fi 9 | 10 | # input parameters: 11 | ROOT=$1 12 | BUILDNUM=$2 13 | 14 | # exit on any fail: 15 | set -e 16 | 17 | # our chroot: 18 | 19 | # installing everything we need: 20 | zypper -n --no-gpg-checks --root $ROOT ar http://download.opensuse.org/distribution/openSUSE-current/repo/oss/ repo-oss 21 | zypper -n --no-gpg-checks --root $ROOT ar http://download.opensuse.org/update/openSUSE-current/ repo-update 22 | zypper -n --no-gpg-checks --root $ROOT refresh 23 | zypper -n --no-gpg-checks --root $ROOT install --no-recommends gcc gcc-c++ make autoconf automake freetype2-devel fontconfig-devel xorg-x11-devel gawk grep zip zlib-devel procps alsa-devel cups-devel unzip findutils tar bzip2 gzip cpio xz which libjpeg62-devel giflib-devel 24 | 25 | # install some developer tools: 26 | zypper -n --no-gpg-checks --root $ROOT install mercurial quilt wget 27 | 28 | # needed for dns lookup: 29 | cp /etc/resolv.conf $ROOT/etc/resolv.conf 30 | 31 | function umountExitHook() { 32 | set +e 33 | echo -n "unmounting $ROOT/dev..." 34 | umount $ROOT/dev 35 | echo "done." 36 | echo -n "unmounting $ROOT/proc..." 37 | umount $ROOT/proc 38 | echo "done." 39 | } 40 | 41 | # bind special folders from host: 42 | echo "" 43 | echo -n "mounting proc and dev..." 44 | trap umountExitHook EXIT 45 | mount --bind /dev $ROOT/dev 46 | mount -t proc proc $ROOT/proc 47 | echo "done." 48 | 49 | # starting the process: 50 | echo -n "creating build script..." 51 | mkdir $ROOT/usr/src/tuxjdk 52 | cat < $ROOT/usr/src/tuxjdk/cloneBuildTuxJdk.sh 53 | #!/bin/bash 54 | # edit on first fail: 55 | set -e 56 | # bootstrap jdk: 57 | cd /opt 58 | wget -4 --no-http-keep-alive --no-check-certificate https://googledrive.com/host/0B68yuEpDuq6waUl5UjNTUWRlYTQ/jdk-8u0-openjdk-vanilla.tar.xz 59 | tar -xJf jdk-8u0-openjdk-vanilla.tar.xz 60 | # now preparing tuxjdk for build: 61 | cd /usr/src/tuxjdk 62 | hg clone https://code.google.com/p/tuxjdk/ tuxjdk 63 | hg clone http://hg.openjdk.java.net/jdk8/jdk8/ jdk-8u0-tuxjdk-$BUILDNUM 64 | cd jdk-8u0-tuxjdk-$BUILDNUM 65 | bash get_source.sh 66 | bash ../tuxjdk/applyTuxjdk.sh 67 | # preparation done, starting actual build: 68 | cd .. 69 | mkdir build 70 | cd build 71 | bash ../jdk-8u0-tuxjdk-$BUILDNUM/configure --with-zlib=system --disable-debug-symbols --disable-zip-debug-info --with-boot-jdk=/opt/jdk-8u0-openjdk-vanilla --with-milestone=tuxjdk --with-build-number=$BUILDNUM --with-jvm-variants=client 72 | make images 73 | EOF 74 | chmod a+x $ROOT/usr/src/tuxjdk/cloneBuildTuxJdk.sh 75 | echo "done." 76 | echo "" 77 | echo "running the build in chroot..." 78 | echo "" 79 | chroot $ROOT /usr/src/tuxjdk/cloneBuildTuxJdk.sh 80 | 81 | # build should be complete by now, packing distribution: 82 | mv $ROOT/usr/src/tuxjdk/build/images/j2sdk-image jdk-8u0-tuxjdk-$BUILDNUM 83 | tar -cJf jdk-8u0-tuxjdk-$BUILDNUM.tar.xz jdk-8u0-tuxjdk-$BUILDNUM 84 | -------------------------------------------------------------------------------- /cloneCheckoutPackOpenjdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | readonly TAG="$1" 4 | readonly HG="$( which hg 2>/dev/null )" 5 | readonly TAR="$( which tar 2>/dev/null )" 6 | 7 | if [[ -n "$2" ]] ; then 8 | readonly UPSTREAM="$2" 9 | else 10 | readonly UPSTREAM='http://hg.openjdk.java.net/jdk8u/jdk8u' 11 | fi 12 | 13 | if [[ -z $TAG ]] ; then 14 | readonly NAME='jdk8u' 15 | else 16 | readonly NAME="$TAG" 17 | fi 18 | 19 | if [[ -z $HG ]] ; then 20 | echo 'hg was not found' >&2 21 | exit 1 22 | fi 23 | if [[ -z $TAR ]] ; then 24 | echo 'tar was not found' >&2 25 | exit 1 26 | fi 27 | 28 | if [[ -a "$NAME" ]] ; then 29 | echo "'$NAME' file or folder already exists" >&2 30 | exit 1 31 | fi 32 | if [[ -a "$NAME.tar.xz" ]] ; then 33 | echo "'$NAME.tar.xz' file or folder already exists" >&2 34 | exit 1 35 | fi 36 | 37 | echo -e "\e[0;35mCloning the source from '$UPSTREAM'...\e[0m" 38 | ( $HG clone "$UPSTREAM" "$NAME" && cd "$NAME" && bash 'get_source.sh' ) 39 | 40 | if [[ -n $TAG ]] ; then 41 | echo -e '\e[0;35mChecking out the tag...\e[0m' 42 | ( cd "$NAME" && bash ./common/bin/hgforest.sh checkout "$TAG" ) 43 | fi 44 | 45 | echo -e '\e[0;35mCreating tarball...\e[0m' 46 | ( tar --exclude-vcs -cJf "$NAME.tar.xz" "$NAME" ) 47 | 48 | echo -e '\e[0;35mDone.\e[0m' 49 | -------------------------------------------------------------------------------- /cloneCheckoutPackTuxjdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | readonly TAG="$1" 4 | readonly GIT="$( which git 2>/dev/null )" 5 | readonly TAR="$( which tar 2>/dev/null )" 6 | 7 | if [[ -n "$2" ]] ; then 8 | readonly UPSTREAM="$2" 9 | else 10 | readonly UPSTREAM='https://github.com/tuxjdk/tuxjdk.git' 11 | fi 12 | 13 | if [[ -z $TAG ]] ; then 14 | readonly NAME='tuxjdk' 15 | else 16 | readonly NAME="tuxjdk-$TAG" 17 | fi 18 | 19 | if [[ -z $GIT ]] ; then 20 | echo 'git was not found' >&2 21 | exit 1 22 | fi 23 | if [[ -z $TAR ]] ; then 24 | echo 'tar was not found' >&2 25 | exit 1 26 | fi 27 | 28 | if [[ -a "$NAME" ]] ; then 29 | echo "'$NAME' file or folder already exists" >&2 30 | exit 1 31 | fi 32 | if [[ -a "$NAME.tar.xz" ]] ; then 33 | echo "'$NAME.tar.xz' file or folder already exists" >&2 34 | exit 1 35 | fi 36 | 37 | echo -e "\e[0;35mCloning the source from '$UPSTREAM'...\e[0m" 38 | ( $GIT clone "$UPSTREAM" "$NAME" ) 39 | 40 | if [[ -n $TAG ]] ; then 41 | echo -e '\e[0;35mChecking out the tag...\e[0m' 42 | ( cd "$NAME" && $GIT checkout "$TAG" ) 43 | fi 44 | 45 | echo -e '\e[0;35mCreating tarball...\e[0m' 46 | ( tar --exclude-vcs -cJf "$NAME.tar.xz" "$NAME" ) 47 | 48 | echo -e '\e[0;35mDone.\e[0m' 49 | -------------------------------------------------------------------------------- /configureBuildOpenjdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ -n "$1" ]] ; then 4 | readonly BOOT_JDK="$1" 5 | else 6 | echo 'Boot jdk argument was not privded, trying to guess...' 7 | if [ -x '/opt/jdk/bin/javac' ] ; then 8 | readonly BOOT_JDK='/opt/jdk' 9 | elif [ -x '/opt/tuxjdk/tuxjdk/bin/javac' ] ; then 10 | readonly BOOT_JDK='/opt/tuxjdk/tuxjdk' 11 | elif [ -x '/usr/lib/jvm/java/bin/javac' ] ; then 12 | readonly BOOT_JDK='/usr/lib/jvm/java' 13 | elif [ -x '/usr/lib64/jvm/java/bin/javac' ] ; then 14 | readonly BOOT_JDK='/usr/lib64/jvm/java' 15 | else 16 | echo 'Could not guess the bootjdk location, exiting.' >&2 17 | exit 1 18 | fi 19 | echo "Using boot jdk: '$BOOT_JDK'" 20 | fi 21 | 22 | readonly MILESTONE='fcs' 23 | readonly USER_SUFFIX='tuxjdk' 24 | readonly PRODUCT_NAME='TuxJdk' 25 | readonly UPDATE_VERSION='152' 26 | readonly BUILD_NUMBER='03' 27 | 28 | unset JAVA_HOME 29 | unset JDK_HOME 30 | unset JRE_HOME 31 | unset _JAVA_OPTIONS 32 | 33 | ## jdk8u45 still does not support linux 4.0 officially, 34 | ## so we have to disable os version check because 35 | ## tumbleweed already has 4.0-based kernel: 36 | export DISABLE_HOTSPOT_OS_VERSION_CHECK=ok 37 | 38 | ( 39 | rm -rf 'build' && mkdir 'build' && cd 'build' \ 40 | && bash ../configure \ 41 | --with-zlib=system \ 42 | --with-giflib=system \ 43 | --disable-debug-symbols \ 44 | --disable-zip-debug-info \ 45 | --with-debug-level=release \ 46 | --with-stdc++lib=dynamic \ 47 | --with-milestone=$MILESTONE \ 48 | --with-update-version=$UPDATE_VERSION \ 49 | --with-user-release-suffix=$USER_SUFFIX \ 50 | --with-build-number=$BUILD_NUMBER \ 51 | --enable-unlimited-crypto \ 52 | --with-boot-jdk="$BOOT_JDK" \ 53 | && make \ 54 | JAVAC_FLAGS=-g \ 55 | COMPRESS_JARS=true \ 56 | LAUNCHER_NAME=$USER_SUFFIX \ 57 | PRODUCT_NAME=$PRODUCT_NAME \ 58 | JDK_UPDATE_VERSION=$UPDATE_VERSION \ 59 | HOTSPOT_VM_DISTRO=$PRODUCT_NAME \ 60 | HOTSPOT_BUILD_VERSION=tuxjdk-$BUILD_NUMBER \ 61 | images 62 | ) 63 | -------------------------------------------------------------------------------- /default_swing.properties: -------------------------------------------------------------------------------- 1 | ui.defaultFont.size=9 2 | ui.defaultFont.antialiasing=lcd 3 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | ## following commands can be used to create and run image: 2 | ## docker build --force-rm -t tuxjdk-static-leap . 3 | ## docker run --rm -v /home/user/dev/tuxjdk/8.66.03/docker:/tuxjdk tuxjdk-static-leap 4 | 5 | FROM opensuse:42.1 6 | 7 | # maybe reuse caches? 8 | VOLUME /var/tmp 9 | VOLUME /var/cache 10 | VOLUME /tmp 11 | 12 | # tuxjdk dependencies: 13 | RUN zypper --non-interactive --gpg-auto-import-keys update --no-recommends && \ 14 | zypper --non-interactive --gpg-auto-import-keys install --no-recommends \ 15 | bash which sed xz make gcc gcc-c++ autoconf automake time tar zip unzip \ 16 | freetype2-devel fontconfig-devel alsa-devel cups-devel gtk2-devel libX11-devel \ 17 | libXi-devel libXinerama-devel libXt-devel libXtst-devel site-config \ 18 | ca-certificates ca-certificates-mozilla ca-certificates-cacert quilt fdupes \ 19 | dejavu-fonts 20 | 21 | ## Optionally, uncomment this line to build with the java-devel provided by openSUSE: 22 | # RUN zypper --non-interactive --gpg-auto-import-keys install --no-recommends java-devel 23 | 24 | ## Setup user environment. Replace 1000 with your user / group id. 25 | RUN \ 26 | export uid=1000 gid=1000 && \ 27 | groupadd --gid ${gid} builder && \ 28 | useradd --uid ${uid} --gid ${gid} --create-home builder && \ 29 | mkdir /tuxjdk && \ 30 | chown builder:builder /tuxjdk 31 | 32 | COPY ./docker-build-static-tuxjdk.sh /home/builder/ 33 | ## choose one of two options, either TuxJdk or Oracle JDK: 34 | ADD ./tuxjdk-static-8.66.03.tar.xz /opt/ 35 | RUN ln -s /opt/tuxjdk-static-8.66.03 /opt/jdk 36 | # ADD ./jdk-8u66-linux-x64.tar.gz /opt/ 37 | # RUN ln -s /opt/jdk1.8.0_66 /opt/jdk 38 | 39 | USER builder 40 | WORKDIR /tuxjdk 41 | VOLUME /tuxjdk 42 | ENTRYPOINT ["/bin/bash"] 43 | CMD ["/home/builder/docker-build-static-tuxjdk.sh"] 44 | -------------------------------------------------------------------------------- /docker/docker-build-static-tuxjdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | set -e 5 | set -o pipefail 6 | 7 | if [ -x '/opt/jdk/bin/javac' ] ; then 8 | readonly BOOT_JDK='/opt/jdk' 9 | elif [ -x '/usr/lib64/jvm/java/bin/javac' ] ; then 10 | readonly BOOT_JDK='/usr/lib64/jvm/java' 11 | else 12 | echo 'No boot jdk found' >&2 13 | exit 1 14 | fi 15 | 16 | readonly MILESTONE='fcs' 17 | readonly USER_SUFFIX='tuxjdk' 18 | readonly PRODUCT_NAME='TuxJdk' 19 | readonly UPDATE_VERSION='152' 20 | readonly BUILD_NUMBER='03' 21 | 22 | unset JAVA_HOME 23 | unset JDK_HOME 24 | unset JRE_HOME 25 | unset _JAVA_OPTIONS 26 | 27 | cd /tuxjdk 28 | 29 | if [[ $( ls -l tuxjdk*.tar.xz | wc -l ) -ne 1 ]] ; then 30 | echo "Found more than one tuxjdk tarball, exactly one expected: $( ls tuxjdk* )" >&2 31 | exit 1 32 | fi 33 | 34 | if [[ $( ls -l jdk*.tar.xz | wc -l ) -ne 1 ]] ; then 35 | echo "Found more than one jdk tarball, exactly one expected: $( ls jdk* )" >&2 36 | exit 1 37 | fi 38 | 39 | rm -rf build && mkdir build && cd build 40 | ( mkdir tuxjdk && cd tuxjdk && tar --strip-components=1 -xJf /tuxjdk/tuxjdk*.tar.xz ) 41 | ( mkdir jdk && cd jdk && tar --strip-components=1 -xJf /tuxjdk/jdk*.tar.xz && bash ../tuxjdk/applyTuxjdk.sh && bash ./common/autoconf/autogen.sh) 42 | ( 43 | mkdir building 44 | cd building 45 | bash /tuxjdk/build/jdk/configure \ 46 | --disable-debug-symbols \ 47 | --disable-zip-debug-info \ 48 | --with-debug-level=release \ 49 | --with-stdc++lib=static \ 50 | --with-milestone=$MILESTONE \ 51 | --with-update-version=$UPDATE_VERSION \ 52 | --with-user-release-suffix=$USER_SUFFIX \ 53 | --with-build-number=$BUILD_NUMBER \ 54 | --enable-unlimited-crypto \ 55 | --with-boot-jdk="$BOOT_JDK" 56 | make \ 57 | JAVAC_FLAGS=-g \ 58 | LAUNCHER_NAME=$USER_SUFFIX \ 59 | PRODUCT_NAME=$PRODUCT_NAME \ 60 | JDK_UPDATE_VERSION=$UPDATE_VERSION \ 61 | HOTSPOT_VM_DISTRO=$PRODUCT_NAME \ 62 | HOTSPOT_BUILD_VERSION=tuxjdk-$BUILD_NUMBER \ 63 | images 64 | ) 65 | # default antialiasing and font size: 66 | ( cd building/images/j2sdk-image/jre/lib && : >swing.properties && echo 'ui.defaultFont.size=9' >>swing.properties && echo 'ui.defaultFont.antialiasing=lcd' >>swing.properties ) 67 | # certificates: 68 | ( cd building/images/j2sdk-image/jre/lib/security && mv cacerts cacerts.orig && cp /var/lib/ca-certificates/java-cacerts ./cacerts ) 69 | # deleting samples and demos: 70 | ( cd building/images/j2sdk-image && rm -rf 'demo' 'sample' ) 71 | # fix permissions for files and dirs: 72 | ( cd building/images/j2sdk-image && chmod -R a-w . && chmod -R a+r . && find "$(pwd)" -type d -exec chmod a+x {} + && chmod a+x bin/* && chmod a+x jre/bin/* ) 73 | # packing: 74 | OUTPUT="tuxjdk-static-8.${UPDATE_VERSION}.${BUILD_NUMBER}" 75 | if [[ -d /tuxjdk/dist ]] ; then 76 | if [[ -f /tuxjdk/dist/$OUTPUT.tar.xz ]] ; then 77 | rm -rf /tuxjdk/dist/$OUTPUT.tar.xz 78 | fi 79 | else 80 | mkdir /tuxjdk/dist 81 | fi 82 | ( cd building/images && mv j2sdk-image $OUTPUT && tar -cJf /tuxjdk/dist/$OUTPUT.tar.xz $OUTPUT ) 83 | # cleaning up: 84 | chmod -R a+w /tuxjdk/build && rm -rf /tuxjdk/build 85 | -------------------------------------------------------------------------------- /launcher.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export JAVA_HOME='/opt/tuxjdk' 3 | /opt/tuxjdk/bin/$( basename "${BASH_SOURCE[0]}" ) "$@" 4 | -------------------------------------------------------------------------------- /quilt-patches/backport/compare-pointer-with-literal.diff: -------------------------------------------------------------------------------- 1 | Index: jdk8u152-b16/jdk/src/solaris/native/sun/awt/awt_Font.c 2 | =================================================================== 3 | --- jdk8u152-b16.orig/jdk/src/solaris/native/sun/awt/awt_Font.c 4 | +++ jdk8u152-b16/jdk/src/solaris/native/sun/awt/awt_Font.c 5 | @@ -502,7 +502,7 @@ awtJNI_GetFontData(JNIEnv * env, jobject 6 | jio_snprintf(fdata->flist[i].xlfd, strlen(nativename) + 10, 7 | nativename, size * 10); 8 | 9 | - if (nativename != NULL && nativename != "") 10 | + if (nativename != NULL && !strcmp(nativename, "")) 11 | JNU_ReleaseStringPlatformChars(env, fontDescriptorName, (const char *) nativename); 12 | 13 | /* 14 | -------------------------------------------------------------------------------- /quilt-patches/backport/less-warnings.diff: -------------------------------------------------------------------------------- 1 | Index: jdk8u152-b16/common/autoconf/generated-configure.sh 2 | =================================================================== 3 | --- jdk8u152-b16.orig/common/autoconf/generated-configure.sh 4 | +++ jdk8u152-b16/common/autoconf/generated-configure.sh 5 | @@ -29731,7 +29731,7 @@ fi 6 | # 7 | case $COMPILER_NAME in 8 | gcc ) 9 | - COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \ 10 | + COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -W -Wno-sign-compare -Wno-deprecated-declarations \ 11 | -pipe \ 12 | -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" 13 | CXXSTD_CXXFLAG="-std=gnu++98" 14 | Index: jdk8u152-b16/common/autoconf/toolchain.m4 15 | =================================================================== 16 | --- jdk8u152-b16.orig/common/autoconf/toolchain.m4 17 | +++ jdk8u152-b16/common/autoconf/toolchain.m4 18 | @@ -1018,7 +1018,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_ 19 | # 20 | case $COMPILER_NAME in 21 | gcc ) 22 | - COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \ 23 | + COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -W -Wno-sign-compare -Wno-deprecated-declarations \ 24 | -pipe \ 25 | -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" 26 | CXXSTD_CXXFLAG="-std=gnu++98" 27 | -------------------------------------------------------------------------------- /quilt-patches/backport/opensuse-link-zlib-as-needed.diff: -------------------------------------------------------------------------------- 1 | Index: jdk8u152-b16/jdk/make/CompileLaunchers.gmk 2 | =================================================================== 3 | --- jdk8u152-b16.orig/jdk/make/CompileLaunchers.gmk 4 | +++ jdk8u152-b16/jdk/make/CompileLaunchers.gmk 5 | @@ -427,7 +427,7 @@ endif 6 | # binary (at least on linux) which causes the size to differ between old and new build. 7 | ifeq ($(USE_EXTERNAL_LIBZ), true) 8 | UNPACKEXE_CFLAGS := -DSYSTEM_ZLIB 9 | - UNPACKEXE_ZIPOBJS := -lz 10 | + UNPACKEXE_LIBS := -lz 11 | else 12 | UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.8 13 | UNPACKEXE_ZIPOBJS := $(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \ 14 | @@ -483,9 +483,9 @@ $(eval $(call SetupNativeCompilation,BUI 15 | LDFLAGS_posix := $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \ 16 | $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX)) \ 17 | $(call SET_SHARED_LIBRARY_ORIGIN), \ 18 | - LDFLAGS_linux := -lc, \ 19 | + LDFLAGS_linux := , \ 20 | LDFLAGS_solaris := $(UNPACKEXE_LDFLAGS_solaris) -lc, \ 21 | - LDFLAGS_SUFFIX := $(LIBCXX), \ 22 | + LDFLAGS_SUFFIX := $(UNPACKEXE_LIBS) $(LIBCXX), \ 23 | OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR), \ 24 | OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR), \ 25 | PROGRAM := unpack200, \ 26 | -------------------------------------------------------------------------------- /quilt-patches/series: -------------------------------------------------------------------------------- 1 | tuxjdk/change-vendor.diff 2 | tune/default-gc.diff 3 | tuxjdk/add-fontconfig-support.diff 4 | tuxjdk/configurable-ui-fonts.diff 5 | tune/full-srczip.diff 6 | tune/empty-ctsym.diff 7 | backport/opensuse-link-zlib-as-needed.diff 8 | backport/compare-pointer-with-literal.diff 9 | backport/less-warnings.diff 10 | -------------------------------------------------------------------------------- /quilt-patches/tune/default-gc.diff: -------------------------------------------------------------------------------- 1 | Index: jdk8u152-b16/hotspot/src/share/vm/runtime/arguments.cpp 2 | =================================================================== 3 | --- jdk8u152-b16.orig/hotspot/src/share/vm/runtime/arguments.cpp 4 | +++ jdk8u152-b16/hotspot/src/share/vm/runtime/arguments.cpp 5 | @@ -1572,11 +1572,7 @@ void Arguments::set_conservative_max_hea 6 | 7 | void Arguments::select_gc_ergonomically() { 8 | if (os::is_server_class_machine()) { 9 | - if (should_auto_select_low_pause_collector()) { 10 | FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true); 11 | - } else { 12 | - FLAG_SET_ERGO(bool, UseParallelGC, true); 13 | - } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /quilt-patches/tune/empty-ctsym.diff: -------------------------------------------------------------------------------- 1 | Index: jdk8u152-b16/jdk/make/CreateJars.gmk 2 | =================================================================== 3 | --- jdk8u152-b16.orig/jdk/make/CreateJars.gmk 4 | +++ jdk8u152-b16/jdk/make/CreateJars.gmk 5 | @@ -556,26 +556,7 @@ EXCLUDE_PROPWARN_PKGS = com.sun.java.swi 6 | EXPORTED_PRIVATE_PKGS = com.oracle.net \ 7 | com.oracle.nio 8 | 9 | -$(IMAGES_OUTPUTDIR)/symbols/_the.symbols: $(IMAGES_OUTPUTDIR)/lib/rt.jar 10 | - $(RM) -r $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym 11 | - $(MKDIR) -p $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym 12 | - $(JAVA) $(NEW_JAVAC) \ 13 | - -bootclasspath $(JDK_OUTPUTDIR)/classes \ 14 | - -XDprocess.packages -proc:only \ 15 | - -processor com.sun.tools.javac.sym.CreateSymbols \ 16 | - -Acom.sun.tools.javac.sym.Jar=$(IMAGES_OUTPUTDIR)/lib/rt.jar \ 17 | - -Acom.sun.tools.javac.sym.Dest=$(IMAGES_OUTPUTDIR)/symbols/META-INF/sym/rt.jar \ 18 | - -Acom.sun.tools.javac.sym.Profiles=profile-rtjar-includes.txt \ 19 | - $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS) 20 | - $(TOUCH) $@ 21 | - 22 | -$(eval $(call MakeDir, $(IMAGES_OUTPUTDIR)/symbols)) 23 | -$(eval $(call SetupArchive,BUILD_CT_SYM, $(IMAGES_OUTPUTDIR)/symbols/_the.symbols, \ 24 | - SRCS := $(IMAGES_OUTPUTDIR)/symbols, \ 25 | - INCLUDES := META-INF/sym, \ 26 | - JAR := $(IMAGES_OUTPUTDIR)/lib/ct.sym, \ 27 | - CHECK_COMPRESS_JAR := true)) 28 | - 29 | +.PHONY: $(IMAGES_OUTPUTDIR)/lib/ct.sym 30 | 31 | ########################################################################################## 32 | 33 | -------------------------------------------------------------------------------- /quilt-patches/tune/full-srczip.diff: -------------------------------------------------------------------------------- 1 | Index: jdk8u152-b16/jdk/make/CreateJars.gmk 2 | =================================================================== 3 | --- jdk8u152-b16.orig/jdk/make/CreateJars.gmk 4 | +++ jdk8u152-b16/jdk/make/CreateJars.gmk 5 | @@ -580,38 +580,12 @@ $(eval $(call SetupArchive,BUILD_CT_SYM, 6 | ########################################################################################## 7 | 8 | SRC_ZIP_INCLUDES = \ 9 | - com/sun/corba \ 10 | - com/sun/image/codec/jpeg \ 11 | - com/sun/imageio \ 12 | - com/sun/java_cup \ 13 | - com/sun/javadoc \ 14 | - com/sun/java/swing \ 15 | - com/sun/jmx \ 16 | - com/sun/naming \ 17 | - com/sun/org/apache \ 18 | - com/sun/security/auth \ 19 | - com/sun/security/jgss \ 20 | - com/sun/source \ 21 | + com \ 22 | java \ 23 | - javax/accessibility \ 24 | - javax/annotation \ 25 | - javax/imageio \ 26 | - javax/lang \ 27 | - javax/management \ 28 | - javax/naming \ 29 | - javax/print \ 30 | - javax/rmi \ 31 | - javax/script \ 32 | - javax/security \ 33 | - javax/sound \ 34 | - javax/sql \ 35 | - javax/swing \ 36 | - javax/tools \ 37 | - javax/xml \ 38 | - org/ietf \ 39 | - org/omg \ 40 | - org/w3c/dom \ 41 | - org/xml/sax \ 42 | + javax \ 43 | + jdk \ 44 | + org \ 45 | + sun \ 46 | # 47 | 48 | SRC_ZIP_SRCS = $(JDK_TOPDIR)/src/share/classes $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes 49 | -------------------------------------------------------------------------------- /quilt-patches/tuxjdk/add-fontconfig-support.diff: -------------------------------------------------------------------------------- 1 | Index: jdk8u152-b16/jdk/make/lib/Awt2dLibraries.gmk 2 | =================================================================== 3 | --- jdk8u152-b16.orig/jdk/make/lib/Awt2dLibraries.gmk 4 | +++ jdk8u152-b16/jdk/make/lib/Awt2dLibraries.gmk 5 | @@ -921,7 +921,7 @@ $(eval $(call SetupNativeCompilation,BUI 6 | LDFLAGS := $(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \ 7 | $(call SET_SHARED_LIBRARY_ORIGIN), \ 8 | LDFLAGS_SUFFIX := $(BUILD_LIBFONTMANAGER_FONTLIB), \ 9 | - LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \ 10 | + LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc -lfontconfig, \ 11 | LDFLAGS_SUFFIX_solaris := -lawt -lawt_headless -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \ 12 | LDFLAGS_SUFFIX_aix := -lawt -lawt_headless $(LIBM) $(LIBCXX) -ljava -ljvm,\ 13 | LDFLAGS_SUFFIX_macosx := -lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup \ 14 | Index: jdk8u152-b16/jdk/src/share/native/sun/font/freetypeScaler.c 15 | =================================================================== 16 | --- jdk8u152-b16.orig/jdk/src/share/native/sun/font/freetypeScaler.c 17 | +++ jdk8u152-b16/jdk/src/share/native/sun/font/freetypeScaler.c 18 | @@ -38,6 +38,10 @@ 19 | #include FT_SIZES_H 20 | #include FT_OUTLINE_H 21 | #include FT_SYNTHESIS_H 22 | +#include FT_LCD_FILTER_H 23 | + 24 | +#include 25 | +#include 26 | 27 | #include "fontscaler.h" 28 | 29 | @@ -48,6 +52,14 @@ 30 | #define ROUND(x) ((int) (x+0.5)) 31 | 32 | typedef struct { 33 | + 34 | + FT_Render_Mode ftRenderMode; 35 | + int ftLoadFlags; 36 | + FT_LcdFilter ftLcdFilter; 37 | + 38 | +} RenderingProperties; 39 | + 40 | +typedef struct { 41 | /* Important note: 42 | JNI forbids sharing same env between different threads. 43 | We are safe, because pointer is overwritten every time we get into 44 | @@ -80,8 +92,146 @@ typedef struct FTScalerContext { 45 | int renderFlags; /* configuration specific to particular engine */ 46 | int pathType; 47 | int ptsz; /* size in points */ 48 | + RenderingProperties* renderingProperties; 49 | } FTScalerContext; 50 | 51 | +static FcPattern* matchedPattern(const FcChar8* family, double ptSize) { 52 | + /* 53 | + we will create pattern to find our family and size in 54 | + fontconfig configuration, and then will return it's 55 | + properties: 56 | + */ 57 | + FcPattern* fcPattern = 0; 58 | + fcPattern = FcPatternCreate(); 59 | + FcValue fcValue; 60 | + fcValue.type = FcTypeString; 61 | + fcValue.u.s = family; 62 | + FcPatternAdd(fcPattern, FC_FAMILY, fcValue, FcTrue); 63 | + FcPatternAddBool(fcPattern, FC_SCALABLE, FcTrue); 64 | + FcPatternAddDouble(fcPattern, FC_SIZE, ptSize); 65 | + // TODO FcPatternAddInteger(pattern, FC_WEIGHT, weight_value); 66 | + // TODO FcPatternAddInteger(pattern, FC_SLANT, slant_value); 67 | + // TODO FcPatternAddDouble(pattern, FC_PIXEL_SIZE, size_value); 68 | + // TODO FcPatternAddInteger(pattern, FC_WIDTH, stretch); 100 in most cases 69 | + FcConfigSubstitute(0, fcPattern, FcMatchPattern); 70 | + FcConfigSubstitute(0, fcPattern, FcMatchFont); 71 | + FcDefaultSubstitute(fcPattern); 72 | + FcResult res; 73 | + 74 | + FcPattern *pattern = 0; 75 | + pattern = FcFontMatch(0, fcPattern, &res); 76 | + FcPatternDestroy(fcPattern); 77 | + return pattern; 78 | +} 79 | + 80 | +static void readFontconfig(const FcChar8* family, double ptSize, jint aaType, RenderingProperties* rp) { 81 | + 82 | + //FcPattern *pattern = matchedPattern((const FcChar8 *) ftFace->family_name); 83 | + FcPattern *pattern = matchedPattern(family, ptSize); 84 | + 85 | + int ftLoadFalgs = FT_LOAD_DEFAULT; 86 | + FT_Render_Mode ftRenderMode = FT_RENDER_MODE_NORMAL; 87 | + FT_LcdFilter ftLcdFilter = FT_LCD_FILTER_DEFAULT; 88 | + char horizontal = 1; 89 | + FcBool b; 90 | + 91 | + // subpixel order: 92 | + if (aaType == TEXT_AA_ON) 93 | + ftRenderMode = FT_RENDER_MODE_NORMAL; 94 | + else if (aaType == TEXT_AA_OFF) 95 | + ftRenderMode = FT_RENDER_MODE_MONO; 96 | + else if (FcPatternGetBool(pattern, FC_ANTIALIAS, 0, &b) == FcResultMatch && b) { 97 | + int subpixel = FC_RGBA_UNKNOWN; 98 | + if (FcPatternGetInteger(pattern, FC_RGBA, 0, &subpixel) == FcResultMatch) { 99 | + if (subpixel == FC_RGBA_UNKNOWN) 100 | + subpixel = FC_RGBA_NONE; 101 | + switch (subpixel) { 102 | + case FC_RGBA_NONE: 103 | + ftRenderMode = FT_RENDER_MODE_NORMAL; 104 | + break; 105 | + case FC_RGBA_RGB: 106 | + case FC_RGBA_BGR: 107 | + ftRenderMode = FT_RENDER_MODE_LCD; 108 | + horizontal = 1; 109 | + break; 110 | + case FC_RGBA_VRGB: 111 | + case FC_RGBA_VBGR: 112 | + ftRenderMode = FT_RENDER_MODE_LCD_V; 113 | + horizontal = 0; 114 | + break; 115 | + default: 116 | + break; 117 | + } 118 | + } 119 | + } else { 120 | + ftRenderMode = FT_RENDER_MODE_NORMAL; 121 | + } 122 | + 123 | + // loading mode: 124 | + if (aaType == TEXT_AA_OFF) 125 | + ftLoadFalgs |= FT_LOAD_TARGET_MONO; 126 | + else { 127 | + int hint_style = FC_HINT_NONE; 128 | + if (FcPatternGetInteger(pattern, FC_HINT_STYLE, 0, &hint_style) == FcResultMatch) { 129 | + switch (hint_style) { 130 | + case FC_HINT_NONE: 131 | + ftLoadFalgs |= FT_LOAD_NO_HINTING; 132 | + break; 133 | + case FC_HINT_SLIGHT: 134 | + ftLoadFalgs |= FT_LOAD_TARGET_LIGHT; 135 | + break; 136 | + case FC_HINT_MEDIUM: 137 | + ftLoadFalgs |= FT_LOAD_TARGET_NORMAL; 138 | + break; 139 | + case FC_HINT_FULL: 140 | + if (aaType == TEXT_AA_ON) 141 | + ftLoadFalgs |= FT_LOAD_TARGET_NORMAL; 142 | + else 143 | + ftLoadFalgs |= horizontal ? FT_LOAD_TARGET_LCD : FT_LOAD_TARGET_LCD_V; 144 | + break; 145 | + default: 146 | + // what else to use as default? 147 | + ftLoadFalgs |= FT_LOAD_TARGET_NORMAL; 148 | + break; 149 | + } 150 | + } 151 | + } 152 | + 153 | + // autohinting: 154 | + if (FcPatternGetBool(pattern, FC_AUTOHINT, 0, &b) == FcResultMatch) 155 | + if (b) 156 | + ftLoadFalgs |= FT_LOAD_FORCE_AUTOHINT; 157 | + 158 | + // LCD filter: 159 | + int filter = FC_LCD_DEFAULT; 160 | + if (FcPatternGetInteger(pattern, FC_LCD_FILTER, 0, &filter) == FcResultMatch) { 161 | + switch (filter) { 162 | + case FC_LCD_NONE: 163 | + ftLcdFilter = FT_LCD_FILTER_NONE; 164 | + break; 165 | + case FC_LCD_DEFAULT: 166 | + ftLcdFilter = FT_LCD_FILTER_DEFAULT; 167 | + break; 168 | + case FC_LCD_LIGHT: 169 | + ftLcdFilter = FT_LCD_FILTER_LIGHT; 170 | + break; 171 | + case FC_LCD_LEGACY: 172 | + ftLcdFilter = FT_LCD_FILTER_LEGACY; 173 | + break; 174 | + default: 175 | + // new unknown lcd filter type?! will use default one: 176 | + ftLcdFilter = FT_LCD_FILTER_DEFAULT; 177 | + break; 178 | + } 179 | + } 180 | + 181 | + FcPatternDestroy(pattern); 182 | + 183 | + rp->ftRenderMode = ftRenderMode; 184 | + rp->ftLoadFlags = ftLoadFalgs; 185 | + rp->ftLcdFilter = ftLcdFilter; 186 | +} 187 | + 188 | #ifdef DEBUG 189 | /* These are referenced in the freetype sources if DEBUG macro is defined. 190 | To simplify work with debuging version of freetype we define 191 | @@ -381,6 +531,11 @@ static int setupFTContext(JNIEnv *env, 192 | scalerInfo->font2D = font2D; 193 | 194 | if (context != NULL) { 195 | + 196 | + RenderingProperties* rp = (RenderingProperties*)calloc(1, sizeof(RenderingProperties)); 197 | + context->renderingProperties = rp; 198 | + readFontconfig((const FcChar8 *) scalerInfo->face->family_name, context->ptsz, context->aaType, context->renderingProperties); 199 | + 200 | FT_Set_Transform(scalerInfo->face, &context->transform, NULL); 201 | 202 | errCode = FT_Set_Char_Size(scalerInfo->face, 0, context->ptsz, 72, 72); 203 | @@ -388,6 +543,9 @@ static int setupFTContext(JNIEnv *env, 204 | if (errCode == 0) { 205 | errCode = FT_Activate_Size(scalerInfo->face->size); 206 | } 207 | + 208 | + FT_Library_SetLcdFilter(scalerInfo->library, context->renderingProperties->ftLcdFilter); 209 | + 210 | } 211 | 212 | return errCode; 213 | @@ -667,12 +825,7 @@ Java_sun_font_FreetypeFontScaler_getGlyp 214 | JNIEnv *env, jobject scaler, jobject font2D, 215 | jlong pScalerContext, jlong pScaler, jint glyphCode) { 216 | 217 | - int error, imageSize; 218 | - UInt16 width, height; 219 | - GlyphInfo *glyphInfo; 220 | - int glyph_index; 221 | - int renderFlags = FT_LOAD_RENDER, target; 222 | - FT_GlyphSlot ftglyph; 223 | + int error; 224 | 225 | FTScalerContext* context = 226 | (FTScalerContext*) jlong_to_ptr(pScalerContext); 227 | @@ -689,53 +842,45 @@ Java_sun_font_FreetypeFontScaler_getGlyp 228 | return ptr_to_jlong(getNullGlyphImage()); 229 | } 230 | 231 | - /* if algorithmic styling is required then we do not request bitmap */ 232 | - if (context->doBold || context->doItalize) { 233 | - renderFlags = FT_LOAD_DEFAULT; 234 | - } 235 | - 236 | - /* NB: in case of non identity transform 237 | - we might also prefer to disable transform before hinting, 238 | - and apply it explicitly after hinting is performed. 239 | - Or we can disable hinting. */ 240 | - 241 | - /* select appropriate hinting mode */ 242 | - if (context->aaType == TEXT_AA_OFF) { 243 | - target = FT_LOAD_TARGET_MONO; 244 | - } else if (context->aaType == TEXT_AA_ON) { 245 | - target = FT_LOAD_TARGET_NORMAL; 246 | - } else if (context->aaType == TEXT_AA_LCD_HRGB || 247 | - context->aaType == TEXT_AA_LCD_HBGR) { 248 | - target = FT_LOAD_TARGET_LCD; 249 | - } else { 250 | - target = FT_LOAD_TARGET_LCD_V; 251 | - } 252 | - renderFlags |= target; 253 | - 254 | - glyph_index = FT_Get_Char_Index(scalerInfo->face, glyphCode); 255 | + /* TODO 256 | + * if algorithmic styling is required then we do not request bitmap 257 | + * if (context->doBold || context->doItalize) { 258 | + */ 259 | 260 | - error = FT_Load_Glyph(scalerInfo->face, glyphCode, renderFlags); 261 | + //FT_UInt glyph_index = FT_Get_Char_Index(scalerInfo->face, glyphCode); 262 | + error = FT_Load_Glyph(scalerInfo->face, glyphCode, context->renderingProperties->ftLoadFlags); 263 | if (error) { 264 | //do not destroy scaler yet. 265 | //this can be problem of particular context (e.g. with bad transform) 266 | return ptr_to_jlong(getNullGlyphImage()); 267 | } 268 | 269 | - ftglyph = scalerInfo->face->glyph; 270 | + FT_GlyphSlot ftglyph = scalerInfo->face->glyph; 271 | + error = FT_Render_Glyph(ftglyph, context->renderingProperties->ftRenderMode); 272 | + if (error) { 273 | + invalidateJavaScaler(env, scaler, scalerInfo); 274 | + return ptr_to_jlong(getNullGlyphImage()); 275 | + } 276 | 277 | - /* apply styles */ 278 | - if (context->doBold) { /* if bold style */ 279 | + /* TODO 280 | + /* apply styles * 281 | + if (context->doBold) { /* if bold style * 282 | FT_GlyphSlot_Embolden(ftglyph); 283 | } 284 | - if (context->doItalize) { /* if oblique */ 285 | + if (context->doItalize) { /* if oblique * 286 | FT_GlyphSlot_Oblique(ftglyph); 287 | } 288 | 289 | /* generate bitmap if it is not done yet 290 | - e.g. if algorithmic styling is performed and style was added to outline */ 291 | + e.g. if algorithmic styling is performed and style was added to outline * 292 | if (ftglyph->format == FT_GLYPH_FORMAT_OUTLINE) { 293 | FT_Render_Glyph(ftglyph, FT_LOAD_TARGET_MODE(target)); 294 | } 295 | + */ 296 | + 297 | + int imageSize; 298 | + UInt16 width, height; 299 | + GlyphInfo *glyphInfo; 300 | 301 | width = (UInt16) ftglyph->bitmap.width; 302 | height = (UInt16) ftglyph->bitmap.rows; 303 | -------------------------------------------------------------------------------- /quilt-patches/tuxjdk/change-vendor.diff: -------------------------------------------------------------------------------- 1 | Index: jdk8u152-b16/jdk/src/share/native/java/lang/System.c 2 | =================================================================== 3 | --- jdk8u152-b16.orig/jdk/src/share/native/java/lang/System.c 4 | +++ jdk8u152-b16/jdk/src/share/native/java/lang/System.c 5 | @@ -109,9 +109,9 @@ Java_java_lang_System_identityHashCode(J 6 | } else ((void) 0) 7 | 8 | #ifndef VENDOR /* Third party may overwrite this. */ 9 | -#define VENDOR "Oracle Corporation" 10 | -#define VENDOR_URL "http://java.oracle.com/" 11 | -#define VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/" 12 | +#define VENDOR "TuxJdk" 13 | +#define VENDOR_URL "https://github.com/tuxjdk/tuxjdk" 14 | +#define VENDOR_URL_BUG "https://github.com/tuxjdk/tuxjdk/issues" 15 | #endif 16 | 17 | #define JAVA_MAX_SUPPORTED_VERSION 52 18 | -------------------------------------------------------------------------------- /quilt-patches/tuxjdk/configurable-ui-fonts.diff: -------------------------------------------------------------------------------- 1 | Index: jdk8u152-b16/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/PangoFonts.java 2 | =================================================================== 3 | --- jdk8u152-b16.orig/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/PangoFonts.java 4 | +++ jdk8u152-b16/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/PangoFonts.java 5 | @@ -159,32 +159,6 @@ class PangoFonts { 6 | * equivalent sizes. If such a change were ever to be made in GTK 7 | * we would need to update for that. 8 | */ 9 | - double dsize = size; 10 | - int dpi = 96; 11 | - Object value = 12 | - Toolkit.getDefaultToolkit().getDesktopProperty("gnome.Xft/DPI"); 13 | - if (value instanceof Integer) { 14 | - dpi = ((Integer)value).intValue() / 1024; 15 | - if (dpi == -1) { 16 | - dpi = 96; 17 | - } 18 | - if (dpi < 50) { /* 50 dpi is the minimum value gnome allows */ 19 | - dpi = 50; 20 | - } 21 | - /* The Java rasteriser assumes pts are in a user space of 22 | - * 72 dpi, so we need to adjust for that. 23 | - */ 24 | - dsize = ((double)(dpi * size)/ 72.0); 25 | - } else { 26 | - /* If there's no property, GTK scales for the resolution 27 | - * reported by the Xserver using the formula listed above. 28 | - * fontScale already accounts for the 72 dpi Java 2D space. 29 | - */ 30 | - dsize = size * fontScale; 31 | - } 32 | - 33 | - /* Round size to nearest integer pt size */ 34 | - size = (int)(dsize + 0.5); 35 | if (size < 1) { 36 | size = 1; 37 | } 38 | @@ -193,13 +167,11 @@ class PangoFonts { 39 | if (FontUtilities.mapFcName(fcFamilyLC) != null) { 40 | /* family is a Fc/Pango logical font which we need to expand. */ 41 | Font font = FontUtilities.getFontConfigFUIR(fcFamilyLC, style, size); 42 | - font = font.deriveFont(style, (float)dsize); 43 | return new FontUIResource(font); 44 | } else { 45 | /* It's a physical font which we will create with a fallback */ 46 | Font font = new Font(family, style, size); 47 | /* a roundabout way to set the font size in floating points */ 48 | - font = font.deriveFont(style, (float)dsize); 49 | FontUIResource fuir = new FontUIResource(font); 50 | return FontUtilities.getCompositeFontUIResource(fuir); 51 | } 52 | Index: jdk8u152-b16/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifDesktopIconUI.java 53 | =================================================================== 54 | --- jdk8u152-b16.orig/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifDesktopIconUI.java 55 | +++ jdk8u152-b16/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifDesktopIconUI.java 56 | @@ -62,8 +62,15 @@ public class MotifDesktopIconUI extends 57 | final static int LABEL_HEIGHT = 18; 58 | final static int LABEL_DIVIDER = 4; // padding between icon and label 59 | 60 | - final static Font defaultTitleFont = 61 | - new Font(Font.SANS_SERIF, Font.PLAIN, 12); 62 | + final static Font defaultTitleFont = defaultTitleFont(); 63 | + private static Font defaultTitleFont() { 64 | + Object o = Toolkit.getDefaultToolkit().getDesktopProperty("ui.defaultFont"); 65 | + if (o instanceof Font) { // implicit null check 66 | + Font f = (Font) o; 67 | + return f; 68 | + } 69 | + return new Font(Font.SANS_SERIF, Font.PLAIN, 9); 70 | + } 71 | 72 | public static ComponentUI createUI(JComponent c) { 73 | return new MotifDesktopIconUI(); 74 | Index: jdk8u152-b16/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java 75 | =================================================================== 76 | --- jdk8u152-b16.orig/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java 77 | +++ jdk8u152-b16/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java 78 | @@ -28,6 +28,7 @@ package com.sun.java.swing.plaf.motif; 79 | import java.awt.Color; 80 | import java.awt.Font; 81 | import java.awt.Insets; 82 | +import java.awt.Toolkit; 83 | import java.awt.event.KeyEvent; 84 | import java.awt.event.InputEvent; 85 | import java.util.*; 86 | @@ -188,14 +189,18 @@ public class MotifLookAndFeel extends Ba 87 | 88 | initResourceBundle(table); 89 | 90 | - FontUIResource dialogPlain12 = new FontUIResource(Font.DIALOG, 91 | - Font.PLAIN, 12); 92 | - FontUIResource serifPlain12 = new FontUIResource(Font.SERIF, 93 | - Font.PLAIN, 12); 94 | - FontUIResource sansSerifPlain12 = new FontUIResource(Font.SANS_SERIF, 95 | - Font.PLAIN, 12); 96 | - FontUIResource monospacedPlain12 = new FontUIResource(Font.MONOSPACED, 97 | - Font.PLAIN, 12); 98 | + Font f; 99 | + Object o = Toolkit.getDefaultToolkit().getDesktopProperty("ui.defaultFont"); 100 | + if (o instanceof Font) { // implicit null check 101 | + f = (Font) o; 102 | + } else { 103 | + f = new Font(Font.SANS_SERIF, Font.PLAIN, 9); 104 | + } 105 | + FontUIResource dialogPlain = new FontUIResource(f); 106 | + FontUIResource serifPlain = new FontUIResource(Font.SERIF, Font.PLAIN, f.getSize()); 107 | + FontUIResource sansSerifPlain = dialogPlain; 108 | + FontUIResource monospacedPlain = new FontUIResource(Font.MONOSPACED, Font.PLAIN, f.getSize()); 109 | + 110 | ColorUIResource red = new ColorUIResource(Color.red); 111 | ColorUIResource black = new ColorUIResource(Color.black); 112 | ColorUIResource white = new ColorUIResource(Color.white); 113 | @@ -558,9 +563,9 @@ public class MotifLookAndFeel extends Ba 114 | 115 | "Panel.background", table.get("control"), 116 | "Panel.foreground", table.get("textText"), 117 | - "Panel.font", dialogPlain12, 118 | + "Panel.font", dialogPlain, 119 | 120 | - "ProgressBar.font", dialogPlain12, 121 | + "ProgressBar.font", dialogPlain, 122 | "ProgressBar.foreground", controlDarker, 123 | "ProgressBar.background", table.get("control"), 124 | "ProgressBar.selectionForeground", table.get("control"), 125 | @@ -575,7 +580,7 @@ public class MotifLookAndFeel extends Ba 126 | "Button.background", table.get("control"), 127 | "Button.foreground", table.get("controlText"), 128 | "Button.select", table.get("controlLightShadow"), 129 | - "Button.font", dialogPlain12, 130 | + "Button.font", dialogPlain, 131 | "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { 132 | "SPACE", "pressed", 133 | "released SPACE", "released" 134 | @@ -617,8 +622,8 @@ public class MotifLookAndFeel extends Ba 135 | 136 | // Menus 137 | "Menu.border", menuMarginBorder, 138 | - "Menu.font", dialogPlain12, 139 | - "Menu.acceleratorFont", dialogPlain12, 140 | + "Menu.font", dialogPlain, 141 | + "Menu.acceleratorFont", dialogPlain, 142 | "Menu.acceleratorSelectionForeground", menuItemPressedForeground, 143 | "Menu.foreground", table.get("menuText"), 144 | "Menu.background", table.get("menu"), 145 | @@ -639,13 +644,13 @@ public class MotifLookAndFeel extends Ba 146 | "MenuBar.border", menuBarBorder, 147 | "MenuBar.background", table.get("menu"), 148 | "MenuBar.foreground", table.get("menuText"), 149 | - "MenuBar.font", dialogPlain12, 150 | + "MenuBar.font", dialogPlain, 151 | "MenuBar.windowBindings", new Object[] { 152 | "F10", "takeFocus" }, 153 | 154 | "MenuItem.border", menuMarginBorder, 155 | - "MenuItem.font", dialogPlain12, 156 | - "MenuItem.acceleratorFont", dialogPlain12, 157 | + "MenuItem.font", dialogPlain, 158 | + "MenuItem.acceleratorFont", dialogPlain, 159 | "MenuItem.acceleratorSelectionForeground", menuItemPressedForeground, 160 | "MenuItem.foreground", table.get("menuText"), 161 | "MenuItem.background", table.get("menu"), 162 | @@ -655,8 +660,8 @@ public class MotifLookAndFeel extends Ba 163 | "MenuItem.arrowIcon", menuItemArrowIcon, 164 | 165 | "RadioButtonMenuItem.border", menuMarginBorder, 166 | - "RadioButtonMenuItem.font", dialogPlain12, 167 | - "RadioButtonMenuItem.acceleratorFont", dialogPlain12, 168 | + "RadioButtonMenuItem.font", dialogPlain, 169 | + "RadioButtonMenuItem.acceleratorFont", dialogPlain, 170 | "RadioButtonMenuItem.acceleratorSelectionForeground", menuItemPressedForeground, 171 | "RadioButtonMenuItem.foreground", table.get("menuText"), 172 | "RadioButtonMenuItem.background", table.get("menu"), 173 | @@ -666,8 +671,8 @@ public class MotifLookAndFeel extends Ba 174 | "RadioButtonMenuItem.arrowIcon", menuItemArrowIcon, 175 | 176 | "CheckBoxMenuItem.border", menuMarginBorder, 177 | - "CheckBoxMenuItem.font", dialogPlain12, 178 | - "CheckBoxMenuItem.acceleratorFont", dialogPlain12, 179 | + "CheckBoxMenuItem.font", dialogPlain, 180 | + "CheckBoxMenuItem.acceleratorFont", dialogPlain, 181 | "CheckBoxMenuItem.acceleratorSelectionForeground", menuItemPressedForeground, 182 | "CheckBoxMenuItem.foreground", table.get("menuText"), 183 | "CheckBoxMenuItem.background", table.get("menu"), 184 | @@ -679,10 +684,10 @@ public class MotifLookAndFeel extends Ba 185 | "PopupMenu.background", table.get("menu"), 186 | "PopupMenu.border", popupMenuBorder, 187 | "PopupMenu.foreground", table.get("menuText"), 188 | - "PopupMenu.font", dialogPlain12, 189 | + "PopupMenu.font", dialogPlain, 190 | "PopupMenu.consumeEventOnClose", Boolean.TRUE, 191 | 192 | - "Label.font", dialogPlain12, 193 | + "Label.font", dialogPlain, 194 | "Label.background", table.get("control"), 195 | "Label.foreground", table.get("controlText"), 196 | 197 | @@ -802,7 +807,7 @@ public class MotifLookAndFeel extends Ba 198 | "END", "maxScroll" 199 | }), 200 | 201 | - "ScrollPane.font", dialogPlain12, 202 | + "ScrollPane.font", dialogPlain, 203 | "ScrollPane.background", table.get("control"), 204 | "ScrollPane.foreground", table.get("controlText"), 205 | "ScrollPane.border", null, 206 | @@ -825,7 +830,7 @@ public class MotifLookAndFeel extends Ba 207 | "ctrl END", "scrollEnd" 208 | }), 209 | 210 | - "Slider.font", dialogPlain12, 211 | + "Slider.font", dialogPlain, 212 | "Slider.border", focusBevelBorder, 213 | "Slider.foreground", table.get("control"), 214 | "Slider.background", controlDarker, 215 | @@ -881,7 +886,7 @@ public class MotifLookAndFeel extends Ba 216 | "ctrl shift TAB", "focusOutBackward" 217 | }), 218 | 219 | - "TabbedPane.font", dialogPlain12, 220 | + "TabbedPane.font", dialogPlain, 221 | "TabbedPane.background", table.get("control"), 222 | "TabbedPane.foreground", table.get("controlText"), 223 | "TabbedPane.light", table.get("controlHighlight"), 224 | @@ -1145,7 +1150,7 @@ public class MotifLookAndFeel extends Ba 225 | "ComboBox.selectionForeground", table.get("text"), 226 | "ComboBox.disabledBackground", table.get("control"), 227 | "ComboBox.disabledForeground", table.get("textInactiveText"), 228 | - "ComboBox.font", dialogPlain12, 229 | + "ComboBox.font", dialogPlain, 230 | "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { 231 | "ESCAPE", "hidePopup", 232 | "PAGE_UP", "pageUpPassThrough", 233 | @@ -1168,7 +1173,7 @@ public class MotifLookAndFeel extends Ba 234 | "TextField.selectionForeground", table.get("textHighlightText"), 235 | "TextField.background", table.get("window"), 236 | "TextField.foreground", table.get("textText"), 237 | - "TextField.font", sansSerifPlain12, 238 | + "TextField.font", sansSerifPlain, 239 | "TextField.border", textFieldBorder, 240 | "TextField.focusInputMap", fieldInputMap, 241 | 242 | @@ -1179,7 +1184,7 @@ public class MotifLookAndFeel extends Ba 243 | "PasswordField.selectionForeground", table.get("textHighlightText"), 244 | "PasswordField.background", table.get("window"), 245 | "PasswordField.foreground", table.get("textText"), 246 | - "PasswordField.font", monospacedPlain12, 247 | + "PasswordField.font", monospacedPlain, 248 | "PasswordField.border", textFieldBorder, 249 | "PasswordField.focusInputMap", passwordInputMap, 250 | 251 | @@ -1190,7 +1195,7 @@ public class MotifLookAndFeel extends Ba 252 | "TextArea.selectionForeground", table.get("textHighlightText"), 253 | "TextArea.background", table.get("window"), 254 | "TextArea.foreground", table.get("textText"), 255 | - "TextArea.font", monospacedPlain12, 256 | + "TextArea.font", monospacedPlain, 257 | "TextArea.border", marginBorder, 258 | "TextArea.focusInputMap", multilineInputMap, 259 | 260 | @@ -1201,7 +1206,7 @@ public class MotifLookAndFeel extends Ba 261 | "TextPane.selectionForeground", table.get("textHighlightText"), 262 | "TextPane.background", white, 263 | "TextPane.foreground", table.get("textText"), 264 | - "TextPane.font", serifPlain12, 265 | + "TextPane.font", serifPlain, 266 | "TextPane.border", marginBorder, 267 | "TextPane.focusInputMap", multilineInputMap, 268 | 269 | @@ -1212,7 +1217,7 @@ public class MotifLookAndFeel extends Ba 270 | "EditorPane.selectionForeground", table.get("textHighlightText"), 271 | "EditorPane.background", white, 272 | "EditorPane.foreground", table.get("textText"), 273 | - "EditorPane.font", serifPlain12, 274 | + "EditorPane.font", serifPlain, 275 | "EditorPane.border", marginBorder, 276 | "EditorPane.focusInputMap", multilineInputMap, 277 | 278 | Index: jdk8u152-b16/jdk/src/share/classes/java/awt/Font.java 279 | =================================================================== 280 | --- jdk8u152-b16.orig/jdk/src/share/classes/java/awt/Font.java 281 | +++ jdk8u152-b16/jdk/src/share/classes/java/awt/Font.java 282 | @@ -1466,9 +1466,9 @@ public class Font implements java.io.Ser 283 | * so the font name may not be properly recognised. 284 | * 285 | *

286 | - * The default size is 12 and the default style is PLAIN. 287 | + * The default size is 9 and the default style is PLAIN. 288 | * If str does not specify a valid size, the returned 289 | - * Font has a size of 12. If str does not 290 | + * Font has a size of 9. If str does not 291 | * specify a valid style, the returned Font has a style of PLAIN. 292 | * If you do not specify a valid font name in 293 | * the str argument, this method will return 294 | @@ -1477,7 +1477,7 @@ public class Font implements java.io.Ser 295 | * your system, use the 296 | * {@link GraphicsEnvironment#getAvailableFontFamilyNames()} method. 297 | * If str is null, a new Font 298 | - * is returned with the family name "Dialog", a size of 12 and a 299 | + * is returned with the family name "Dialog", a size of 9 and a 300 | * PLAIN style. 301 | * @param str the name of the font, or null 302 | * @return the Font object that str 303 | @@ -1489,7 +1489,7 @@ public class Font implements java.io.Ser 304 | public static Font decode(String str) { 305 | String fontName = str; 306 | String styleName = ""; 307 | - int fontSize = 12; 308 | + int fontSize = 9; 309 | int fontStyle = Font.PLAIN; 310 | 311 | if (str == null) { 312 | @@ -1508,7 +1508,7 @@ public class Font implements java.io.Ser 313 | fontSize = 314 | Integer.valueOf(str.substring(sizeIndex+1)).intValue(); 315 | if (fontSize <= 0) { 316 | - fontSize = 12; 317 | + fontSize = 9; 318 | } 319 | } catch (NumberFormatException e) { 320 | /* It wasn't a valid size, if we didn't also find the 321 | Index: jdk8u152-b16/jdk/src/share/classes/java/awt/font/FontRenderContext.java 322 | =================================================================== 323 | --- jdk8u152-b16.orig/jdk/src/share/classes/java/awt/font/FontRenderContext.java 324 | +++ jdk8u152-b16/jdk/src/share/classes/java/awt/font/FontRenderContext.java 325 | @@ -30,6 +30,7 @@ 326 | package java.awt.font; 327 | 328 | import java.awt.RenderingHints; 329 | +import java.awt.Toolkit; 330 | import static java.awt.RenderingHints.*; 331 | import java.awt.geom.AffineTransform; 332 | 333 | @@ -69,13 +70,27 @@ public class FontRenderContext { 334 | private transient Object fmHintValue; 335 | private transient boolean defaulting; 336 | 337 | + private static class LazyDefaults { 338 | + 339 | + private static final Object DEFAULT_TEXT_ANTIALIASING_HINT = discoverDefaultTextAntialiasingHint(); 340 | + 341 | + private static Object discoverDefaultTextAntialiasingHint() { 342 | + Toolkit toolkit = Toolkit.getDefaultToolkit(); 343 | + Object hint = toolkit.getDesktopProperty("ui.defaultFont.antialiasing"); 344 | + if (hint != null) { 345 | + return hint; 346 | + } 347 | + return VALUE_TEXT_ANTIALIAS_DEFAULT; 348 | + } 349 | + } 350 | + 351 | /** 352 | * Constructs a new FontRenderContext 353 | * object. 354 | * 355 | */ 356 | protected FontRenderContext() { 357 | - aaHintValue = VALUE_TEXT_ANTIALIAS_DEFAULT; 358 | + aaHintValue = LazyDefaults.DEFAULT_TEXT_ANTIALIASING_HINT; 359 | fmHintValue = VALUE_FRACTIONALMETRICS_DEFAULT; 360 | defaulting = true; 361 | } 362 | Index: jdk8u152-b16/jdk/src/share/classes/javax/swing/UIManager.java 363 | =================================================================== 364 | --- jdk8u152-b16.orig/jdk/src/share/classes/javax/swing/UIManager.java 365 | +++ jdk8u152-b16/jdk/src/share/classes/javax/swing/UIManager.java 366 | @@ -59,6 +59,7 @@ import sun.security.action.GetPropertyAc 367 | import sun.swing.SwingUtilities2; 368 | import java.lang.reflect.Method; 369 | import java.util.HashMap; 370 | +import javax.swing.plaf.FontUIResource; 371 | import sun.awt.AppContext; 372 | import sun.awt.AWTAccessor; 373 | 374 | @@ -1409,6 +1410,22 @@ public class UIManager implements Serial 375 | 376 | private static void initializeSystemDefaults(Properties swingProps) { 377 | getLAFState().swingProps = swingProps; 378 | + Font defaultFont; 379 | + Object o = Toolkit.getDefaultToolkit().getDesktopProperty("ui.defaultFont"); 380 | + if (o instanceof Font) { // implicit null check 381 | + defaultFont = (Font) o; 382 | + } else { 383 | + defaultFont = new Font(Font.SANS_SERIF, Font.PLAIN, 9); 384 | + } 385 | + defaultFont = new FontUIResource(defaultFont); 386 | + UIDefaults systemDefaults = getLAFState().getSystemDefaults(); 387 | + if (systemDefaults == null) { 388 | + systemDefaults = new UIDefaults(); 389 | + getLAFState().setSystemDefaults(systemDefaults); 390 | + } 391 | + systemDefaults.put("ui.defaultFont", defaultFont); 392 | + systemDefaults.put("ui.defaultFont.size", defaultFont.getSize()); 393 | + systemDefaults.put("customFontSize", defaultFont.getSize()); 394 | } 395 | 396 | 397 | Index: jdk8u152-b16/jdk/src/share/classes/javax/swing/border/TitledBorder.java 398 | =================================================================== 399 | --- jdk8u152-b16.orig/jdk/src/share/classes/javax/swing/border/TitledBorder.java 400 | +++ jdk8u152-b16/jdk/src/share/classes/javax/swing/border/TitledBorder.java 401 | @@ -687,7 +687,7 @@ public class TitledBorder extends Abstra 402 | return font; 403 | } 404 | } 405 | - return new Font(Font.DIALOG, Font.PLAIN, 12); 406 | + return UIManager.getFont("ui.defaultFont"); 407 | } 408 | 409 | private Color getColor(Component c) { 410 | Index: jdk8u152-b16/jdk/src/share/classes/javax/swing/colorchooser/DefaultPreviewPanel.java 411 | =================================================================== 412 | --- jdk8u152-b16.orig/jdk/src/share/classes/javax/swing/colorchooser/DefaultPreviewPanel.java 413 | +++ jdk8u152-b16/jdk/src/share/classes/javax/swing/colorchooser/DefaultPreviewPanel.java 414 | @@ -61,7 +61,7 @@ class DefaultPreviewPanel extends JPanel 415 | 416 | 417 | private int textGap = 5; 418 | - private Font font = new Font(Font.DIALOG, Font.PLAIN, 12); 419 | + private Font font = UIManager.getFont("ui.defaultFont"); 420 | private String sampleText; 421 | 422 | private int swatchWidth = 50; 423 | Index: jdk8u152-b16/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java 424 | =================================================================== 425 | --- jdk8u152-b16.orig/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java 426 | +++ jdk8u152-b16/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java 427 | @@ -459,29 +459,31 @@ public abstract class BasicLookAndFeel e 428 | Long oneThousand = new Long(1000); 429 | 430 | // *** Shared Fonts 431 | - Integer twelve = new Integer(12); 432 | - Integer fontPlain = new Integer(Font.PLAIN); 433 | - Integer fontBold = new Integer(Font.BOLD); 434 | - Object dialogPlain12 = new SwingLazyValue( 435 | + Font f; 436 | + Object o = Toolkit.getDefaultToolkit().getDesktopProperty("ui.defaultFont"); 437 | + if (o instanceof Font) { // implicit null check 438 | + f = (Font) o; 439 | + } else { 440 | + f = new Font(Font.SANS_SERIF, Font.PLAIN, 9); 441 | + } 442 | + Integer fontSize = f.getSize(); 443 | + Object dialogPlain = new SwingLazyValue( 444 | "javax.swing.plaf.FontUIResource", 445 | null, 446 | - new Object[] {Font.DIALOG, fontPlain, twelve}); 447 | - Object serifPlain12 = new SwingLazyValue( 448 | + new Object[] {f.getFamily(), f.getStyle(), fontSize}); 449 | + Object serifPlain = new SwingLazyValue( 450 | "javax.swing.plaf.FontUIResource", 451 | null, 452 | - new Object[] {Font.SERIF, fontPlain, twelve}); 453 | - Object sansSerifPlain12 = new SwingLazyValue( 454 | + new Object[] {Font.SERIF, Font.PLAIN, fontSize}); 455 | + Object sansSerifPlain = dialogPlain; 456 | + Object monospacedPlain = new SwingLazyValue( 457 | "javax.swing.plaf.FontUIResource", 458 | null, 459 | - new Object[] {Font.SANS_SERIF, fontPlain, twelve}); 460 | - Object monospacedPlain12 = new SwingLazyValue( 461 | + new Object[] {Font.MONOSPACED, Font.PLAIN, fontSize}); 462 | + Object dialogBold = new SwingLazyValue( 463 | "javax.swing.plaf.FontUIResource", 464 | null, 465 | - new Object[] {Font.MONOSPACED, fontPlain, twelve}); 466 | - Object dialogBold12 = new SwingLazyValue( 467 | - "javax.swing.plaf.FontUIResource", 468 | - null, 469 | - new Object[] {Font.DIALOG, fontBold, twelve}); 470 | + new Object[] {f.getFamily(), Font.BOLD, fontSize}); 471 | 472 | 473 | // *** Shared Colors 474 | @@ -670,7 +672,7 @@ public abstract class BasicLookAndFeel e 475 | Integer ten = new Integer(10); 476 | Object optionPaneBorder = new SwingLazyValue( 477 | "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource", 478 | - new Object[] {ten, ten, twelve, ten}); 479 | + new Object[] {ten, ten, fontSize, ten}); 480 | 481 | Object optionPaneButtonAreaBorder = new SwingLazyValue( 482 | "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource", 483 | @@ -760,7 +762,7 @@ public abstract class BasicLookAndFeel e 484 | 485 | // *** Buttons 486 | "Button.defaultButtonFollowsFocus", Boolean.TRUE, 487 | - "Button.font", dialogPlain12, 488 | + "Button.font", dialogPlain, 489 | "Button.background", control, 490 | "Button.foreground", controlText, 491 | "Button.shadow", controlShadow, 492 | @@ -778,7 +780,7 @@ public abstract class BasicLookAndFeel e 493 | "released ENTER", "released" 494 | }), 495 | 496 | - "ToggleButton.font", dialogPlain12, 497 | + "ToggleButton.font", dialogPlain, 498 | "ToggleButton.background", control, 499 | "ToggleButton.foreground", controlText, 500 | "ToggleButton.shadow", controlShadow, 501 | @@ -795,7 +797,7 @@ public abstract class BasicLookAndFeel e 502 | "released SPACE", "released" 503 | }), 504 | 505 | - "RadioButton.font", dialogPlain12, 506 | + "RadioButton.font", dialogPlain, 507 | "RadioButton.background", control, 508 | "RadioButton.foreground", controlText, 509 | "RadioButton.shadow", controlShadow, 510 | @@ -814,7 +816,7 @@ public abstract class BasicLookAndFeel e 511 | "RETURN", "pressed" 512 | }), 513 | 514 | - "CheckBox.font", dialogPlain12, 515 | + "CheckBox.font", dialogPlain, 516 | "CheckBox.background", control, 517 | "CheckBox.foreground", controlText, 518 | "CheckBox.border", radioButtonBorder, 519 | @@ -830,7 +832,7 @@ public abstract class BasicLookAndFeel e 520 | "FileChooser.useSystemExtensionHiding", Boolean.FALSE, 521 | 522 | // *** ColorChooser 523 | - "ColorChooser.font", dialogPlain12, 524 | + "ColorChooser.font", dialogPlain, 525 | "ColorChooser.background", control, 526 | "ColorChooser.foreground", controlText, 527 | 528 | @@ -839,7 +841,7 @@ public abstract class BasicLookAndFeel e 529 | "ColorChooser.swatchesDefaultRecentColor", control, 530 | 531 | // *** ComboBox 532 | - "ComboBox.font", sansSerifPlain12, 533 | + "ComboBox.font", sansSerifPlain, 534 | "ComboBox.background", window, 535 | "ComboBox.foreground", textText, 536 | "ComboBox.buttonBackground", control, 537 | @@ -885,7 +887,7 @@ public abstract class BasicLookAndFeel e 538 | "FileView.floppyDriveIcon", floppyDriveIcon, 539 | 540 | // *** InternalFrame 541 | - "InternalFrame.titleFont", dialogBold12, 542 | + "InternalFrame.titleFont", dialogBold, 543 | "InternalFrame.borderColor", control, 544 | "InternalFrame.borderShadow", controlShadow, 545 | "InternalFrame.borderDarkShadow", controlDkShadow, 546 | @@ -971,7 +973,7 @@ public abstract class BasicLookAndFeel e 547 | }), 548 | 549 | // *** Label 550 | - "Label.font", dialogPlain12, 551 | + "Label.font", dialogPlain, 552 | "Label.background", control, 553 | "Label.foreground", controlText, 554 | "Label.disabledForeground", white, 555 | @@ -979,7 +981,7 @@ public abstract class BasicLookAndFeel e 556 | "Label.border", null, 557 | 558 | // *** List 559 | - "List.font", dialogPlain12, 560 | + "List.font", dialogPlain, 561 | "List.background", window, 562 | "List.foreground", textText, 563 | "List.selectionBackground", textHighlight, 564 | @@ -1078,7 +1080,7 @@ public abstract class BasicLookAndFeel e 565 | }), 566 | 567 | // *** Menus 568 | - "MenuBar.font", dialogPlain12, 569 | + "MenuBar.font", dialogPlain, 570 | "MenuBar.background", menu, 571 | "MenuBar.foreground", menuText, 572 | "MenuBar.shadow", controlShadow, 573 | @@ -1087,8 +1089,8 @@ public abstract class BasicLookAndFeel e 574 | "MenuBar.windowBindings", new Object[] { 575 | "F10", "takeFocus" }, 576 | 577 | - "MenuItem.font", dialogPlain12, 578 | - "MenuItem.acceleratorFont", dialogPlain12, 579 | + "MenuItem.font", dialogPlain, 580 | + "MenuItem.acceleratorFont", dialogPlain, 581 | "MenuItem.background", menu, 582 | "MenuItem.foreground", menuText, 583 | "MenuItem.selectionForeground", textHighlightText, 584 | @@ -1104,8 +1106,8 @@ public abstract class BasicLookAndFeel e 585 | "MenuItem.arrowIcon", menuItemArrowIcon, 586 | "MenuItem.commandSound", null, 587 | 588 | - "RadioButtonMenuItem.font", dialogPlain12, 589 | - "RadioButtonMenuItem.acceleratorFont", dialogPlain12, 590 | + "RadioButtonMenuItem.font", dialogPlain, 591 | + "RadioButtonMenuItem.acceleratorFont", dialogPlain, 592 | "RadioButtonMenuItem.background", menu, 593 | "RadioButtonMenuItem.foreground", menuText, 594 | "RadioButtonMenuItem.selectionForeground", textHighlightText, 595 | @@ -1120,8 +1122,8 @@ public abstract class BasicLookAndFeel e 596 | "RadioButtonMenuItem.arrowIcon", menuItemArrowIcon, 597 | "RadioButtonMenuItem.commandSound", null, 598 | 599 | - "CheckBoxMenuItem.font", dialogPlain12, 600 | - "CheckBoxMenuItem.acceleratorFont", dialogPlain12, 601 | + "CheckBoxMenuItem.font", dialogPlain, 602 | + "CheckBoxMenuItem.acceleratorFont", dialogPlain, 603 | "CheckBoxMenuItem.background", menu, 604 | "CheckBoxMenuItem.foreground", menuText, 605 | "CheckBoxMenuItem.selectionForeground", textHighlightText, 606 | @@ -1136,8 +1138,8 @@ public abstract class BasicLookAndFeel e 607 | "CheckBoxMenuItem.arrowIcon", menuItemArrowIcon, 608 | "CheckBoxMenuItem.commandSound", null, 609 | 610 | - "Menu.font", dialogPlain12, 611 | - "Menu.acceleratorFont", dialogPlain12, 612 | + "Menu.font", dialogPlain, 613 | + "Menu.acceleratorFont", dialogPlain, 614 | "Menu.background", menu, 615 | "Menu.foreground", menuText, 616 | "Menu.selectionForeground", textHighlightText, 617 | @@ -1176,7 +1178,7 @@ public abstract class BasicLookAndFeel e 618 | "Menu.preserveTopLevelSelection", Boolean.FALSE, 619 | 620 | // PopupMenu 621 | - "PopupMenu.font", dialogPlain12, 622 | + "PopupMenu.font", dialogPlain, 623 | "PopupMenu.background", menu, 624 | "PopupMenu.foreground", menuText, 625 | "PopupMenu.border", popupMenuBorder, 626 | @@ -1210,7 +1212,7 @@ public abstract class BasicLookAndFeel e 627 | // You can additionaly define OptionPane.messageFont which will 628 | // dictate the fonts used for the message, and 629 | // OptionPane.buttonFont, which defines the font for the buttons. 630 | - "OptionPane.font", dialogPlain12, 631 | + "OptionPane.font", dialogPlain, 632 | "OptionPane.background", control, 633 | "OptionPane.foreground", controlText, 634 | "OptionPane.messageForeground", controlText, 635 | @@ -1240,12 +1242,12 @@ public abstract class BasicLookAndFeel e 636 | "OptionPane.buttonClickThreshhold", fiveHundred, 637 | 638 | // *** Panel 639 | - "Panel.font", dialogPlain12, 640 | + "Panel.font", dialogPlain, 641 | "Panel.background", control, 642 | "Panel.foreground", textText, 643 | 644 | // *** ProgressBar 645 | - "ProgressBar.font", dialogPlain12, 646 | + "ProgressBar.font", dialogPlain, 647 | "ProgressBar.foreground", textHighlight, 648 | "ProgressBar.background", control, 649 | "ProgressBar.selectionForeground", control, 650 | @@ -1301,7 +1303,7 @@ public abstract class BasicLookAndFeel e 651 | }), 652 | "ScrollBar.width", new Integer(16), 653 | 654 | - "ScrollPane.font", dialogPlain12, 655 | + "ScrollPane.font", dialogPlain, 656 | "ScrollPane.background", control, 657 | "ScrollPane.foreground", controlText, 658 | "ScrollPane.border", textFieldBorder, 659 | @@ -1329,12 +1331,12 @@ public abstract class BasicLookAndFeel e 660 | "ctrl PAGE_DOWN", "scrollLeft", 661 | }), 662 | 663 | - "Viewport.font", dialogPlain12, 664 | + "Viewport.font", dialogPlain, 665 | "Viewport.background", control, 666 | "Viewport.foreground", textText, 667 | 668 | // *** Slider 669 | - "Slider.font", dialogPlain12, 670 | + "Slider.font", dialogPlain, 671 | "Slider.foreground", control, 672 | "Slider.background", control, 673 | "Slider.highlight", controlLtHighlight, 674 | @@ -1372,7 +1374,7 @@ public abstract class BasicLookAndFeel e 675 | "Slider.onlyLeftMouseButtonDrag", Boolean.TRUE, 676 | 677 | // *** Spinner 678 | - "Spinner.font", monospacedPlain12, 679 | + "Spinner.font", monospacedPlain, 680 | "Spinner.background", control, 681 | "Spinner.foreground", control, 682 | "Spinner.border", textFieldBorder, 683 | @@ -1417,7 +1419,7 @@ public abstract class BasicLookAndFeel e 684 | }), 685 | 686 | // *** TabbedPane 687 | - "TabbedPane.font", dialogPlain12, 688 | + "TabbedPane.font", dialogPlain, 689 | "TabbedPane.background", control, 690 | "TabbedPane.foreground", controlText, 691 | "TabbedPane.highlight", controlLtHighlight, 692 | @@ -1466,7 +1468,7 @@ public abstract class BasicLookAndFeel e 693 | 694 | 695 | // *** Table 696 | - "Table.font", dialogPlain12, 697 | + "Table.font", dialogPlain, 698 | "Table.foreground", controlText, // cell text color 699 | "Table.background", window, // cell background color 700 | "Table.selectionForeground", textHighlightText, 701 | @@ -1585,7 +1587,7 @@ public abstract class BasicLookAndFeel e 702 | "Table.sortIconColor" }), 703 | "Table.sortIconColor", controlShadow, 704 | 705 | - "TableHeader.font", dialogPlain12, 706 | + "TableHeader.font", dialogPlain, 707 | "TableHeader.foreground", controlText, // header text color 708 | "TableHeader.background", control, // header background 709 | "TableHeader.cellBorder", tableHeaderBorder, 710 | @@ -1614,7 +1616,7 @@ public abstract class BasicLookAndFeel e 711 | }), 712 | 713 | // *** Text 714 | - "TextField.font", sansSerifPlain12, 715 | + "TextField.font", sansSerifPlain, 716 | "TextField.background", window, 717 | "TextField.foreground", textText, 718 | "TextField.shadow", controlShadow, 719 | @@ -1630,7 +1632,7 @@ public abstract class BasicLookAndFeel e 720 | "TextField.border", textFieldBorder, 721 | "TextField.margin", zeroInsets, 722 | 723 | - "FormattedTextField.font", sansSerifPlain12, 724 | + "FormattedTextField.font", sansSerifPlain, 725 | "FormattedTextField.background", window, 726 | "FormattedTextField.foreground", textText, 727 | "FormattedTextField.inactiveForeground", textInactiveText, 728 | @@ -1689,7 +1691,7 @@ public abstract class BasicLookAndFeel e 729 | "KP_DOWN", "decrement", 730 | }), 731 | 732 | - "PasswordField.font", monospacedPlain12, 733 | + "PasswordField.font", monospacedPlain, 734 | "PasswordField.background", window, 735 | "PasswordField.foreground", textText, 736 | "PasswordField.inactiveForeground", textInactiveText, 737 | @@ -1702,7 +1704,7 @@ public abstract class BasicLookAndFeel e 738 | "PasswordField.margin", zeroInsets, 739 | "PasswordField.echoChar", '*', 740 | 741 | - "TextArea.font", monospacedPlain12, 742 | + "TextArea.font", monospacedPlain, 743 | "TextArea.background", window, 744 | "TextArea.foreground", textText, 745 | "TextArea.inactiveForeground", textInactiveText, 746 | @@ -1713,7 +1715,7 @@ public abstract class BasicLookAndFeel e 747 | "TextArea.border", marginBorder, 748 | "TextArea.margin", zeroInsets, 749 | 750 | - "TextPane.font", serifPlain12, 751 | + "TextPane.font", serifPlain, 752 | "TextPane.background", white, 753 | "TextPane.foreground", textText, 754 | "TextPane.selectionBackground", textHighlight, 755 | @@ -1724,7 +1726,7 @@ public abstract class BasicLookAndFeel e 756 | "TextPane.border", marginBorder, 757 | "TextPane.margin", editorMargin, 758 | 759 | - "EditorPane.font", serifPlain12, 760 | + "EditorPane.font", serifPlain, 761 | "EditorPane.background", white, 762 | "EditorPane.foreground", textText, 763 | "EditorPane.selectionBackground", textHighlight, 764 | @@ -1742,12 +1744,12 @@ public abstract class BasicLookAndFeel e 765 | BasicLookAndFeel.class, 766 | "icons/image-failed.png"), 767 | // *** TitledBorder 768 | - "TitledBorder.font", dialogPlain12, 769 | + "TitledBorder.font", dialogPlain, 770 | "TitledBorder.titleColor", controlText, 771 | "TitledBorder.border", etchedBorder, 772 | 773 | // *** ToolBar 774 | - "ToolBar.font", dialogPlain12, 775 | + "ToolBar.font", dialogPlain, 776 | "ToolBar.background", control, 777 | "ToolBar.foreground", controlText, 778 | "ToolBar.shadow", controlShadow, 779 | @@ -1773,7 +1775,7 @@ public abstract class BasicLookAndFeel e 780 | }), 781 | 782 | // *** ToolTips 783 | - "ToolTip.font", sansSerifPlain12, 784 | + "ToolTip.font", sansSerifPlain, 785 | "ToolTip.background", table.get("info"), 786 | "ToolTip.foreground", table.get("infoText"), 787 | "ToolTip.border", blackLineBorder, 788 | @@ -1793,7 +1795,7 @@ public abstract class BasicLookAndFeel e 789 | // *** Tree 790 | "Tree.paintLines", Boolean.TRUE, 791 | "Tree.lineTypeDashed", Boolean.FALSE, 792 | - "Tree.font", dialogPlain12, 793 | + "Tree.font", dialogPlain, 794 | "Tree.background", window, 795 | "Tree.foreground", textText, 796 | "Tree.hash", gray, 797 | Index: jdk8u152-b16/jdk/src/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java 798 | =================================================================== 799 | --- jdk8u152-b16.orig/jdk/src/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java 800 | +++ jdk8u152-b16/jdk/src/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java 801 | @@ -89,106 +89,29 @@ import sun.swing.SwingUtilities2; 802 | * @author Steve Wilson 803 | */ 804 | public class DefaultMetalTheme extends MetalTheme { 805 | - /** 806 | - * Whether or not fonts should be plain. This is only used if 807 | - * the defaults property 'swing.boldMetal' == "false". 808 | - */ 809 | - private static final boolean PLAIN_FONTS; 810 | - 811 | - /** 812 | - * Names of the fonts to use. 813 | - */ 814 | - private static final String[] fontNames = { 815 | - Font.DIALOG,Font.DIALOG,Font.DIALOG,Font.DIALOG,Font.DIALOG,Font.DIALOG 816 | - }; 817 | - /** 818 | - * Styles for the fonts. This is ignored if the defaults property 819 | - * swing.boldMetal is false, or PLAIN_FONTS is true. 820 | - */ 821 | - private static final int[] fontStyles = { 822 | - Font.BOLD, Font.PLAIN, Font.PLAIN, Font.BOLD, Font.BOLD, Font.PLAIN 823 | - }; 824 | - /** 825 | - * Sizes for the fonts. 826 | - */ 827 | - private static final int[] fontSizes = { 828 | - 12, 12, 12, 12, 12, 10 829 | - }; 830 | - 831 | - // note the properties listed here can currently be used by people 832 | - // providing runtimes to hint what fonts are good. For example the bold 833 | - // dialog font looks bad on a Mac, so Apple could use this property to 834 | - // hint at a good font. 835 | - // 836 | - // However, we don't promise to support these forever. We may move 837 | - // to getting these from the swing.properties file, or elsewhere. 838 | - /** 839 | - * System property names used to look up fonts. 840 | - */ 841 | - private static final String[] defaultNames = { 842 | - "swing.plaf.metal.controlFont", 843 | - "swing.plaf.metal.systemFont", 844 | - "swing.plaf.metal.userFont", 845 | - "swing.plaf.metal.controlFont", 846 | - "swing.plaf.metal.controlFont", 847 | - "swing.plaf.metal.smallFont" 848 | - }; 849 | 850 | /** 851 | * Returns the ideal font name for the font identified by key. 852 | */ 853 | static String getDefaultFontName(int key) { 854 | - return fontNames[key]; 855 | + return LazyDefaultFonts.defaultFont.getFamily(); 856 | } 857 | 858 | /** 859 | * Returns the ideal font size for the font identified by key. 860 | */ 861 | static int getDefaultFontSize(int key) { 862 | - return fontSizes[key]; 863 | + if (key == SUB_TEXT_FONT) { 864 | + return LazyDefaultFonts.smallFont.getSize(); 865 | + } 866 | + return LazyDefaultFonts.defaultFont.getSize(); 867 | } 868 | 869 | /** 870 | * Returns the ideal font style for the font identified by key. 871 | */ 872 | static int getDefaultFontStyle(int key) { 873 | - if (key != WINDOW_TITLE_FONT) { 874 | - Object boldMetal = null; 875 | - if (AppContext.getAppContext().get( 876 | - SwingUtilities2.LAF_STATE_KEY) != null) { 877 | - // Only access the boldMetal key if a look and feel has 878 | - // been loaded, otherwise we'll trigger loading the look 879 | - // and feel. 880 | - boldMetal = UIManager.get("swing.boldMetal"); 881 | - } 882 | - if (boldMetal != null) { 883 | - if (Boolean.FALSE.equals(boldMetal)) { 884 | - return Font.PLAIN; 885 | - } 886 | - } 887 | - else if (PLAIN_FONTS) { 888 | - return Font.PLAIN; 889 | - } 890 | - } 891 | - return fontStyles[key]; 892 | - } 893 | - 894 | - /** 895 | - * Returns the default used to look up the specified font. 896 | - */ 897 | - static String getDefaultPropertyName(int key) { 898 | - return defaultNames[key]; 899 | - } 900 | - 901 | - static { 902 | - Object boldProperty = java.security.AccessController.doPrivileged( 903 | - new GetPropertyAction("swing.boldMetal")); 904 | - if (boldProperty == null || !"false".equals(boldProperty)) { 905 | - PLAIN_FONTS = false; 906 | - } 907 | - else { 908 | - PLAIN_FONTS = true; 909 | - } 910 | + return LazyDefaultFonts.defaultFont.getStyle(); 911 | } 912 | 913 | private static final ColorUIResource primary1 = new ColorUIResource( 914 | @@ -204,8 +127,6 @@ public class DefaultMetalTheme extends M 915 | private static final ColorUIResource secondary3 = new ColorUIResource( 916 | 204, 204, 204); 917 | 918 | - private FontDelegate fontDelegate; 919 | - 920 | /** 921 | * Returns the name of this theme. This returns {@code "Steel"}. 922 | * 923 | @@ -330,17 +251,13 @@ public class DefaultMetalTheme extends M 924 | } 925 | 926 | private FontUIResource getFont(int key) { 927 | - return fontDelegate.getFont(key); 928 | + if (key == SUB_TEXT_FONT) { 929 | + return LazyDefaultFonts.smallFont; 930 | + } 931 | + return LazyDefaultFonts.defaultFont; 932 | } 933 | 934 | void install() { 935 | - if (MetalLookAndFeel.isWindows() && 936 | - MetalLookAndFeel.useSystemFonts()) { 937 | - fontDelegate = new WindowsFontDelegate(); 938 | - } 939 | - else { 940 | - fontDelegate = new FontDelegate(); 941 | - } 942 | } 943 | 944 | /** 945 | @@ -351,83 +268,23 @@ public class DefaultMetalTheme extends M 946 | } 947 | 948 | /** 949 | - * FontDelegates add an extra level of indirection to obtaining fonts. 950 | - */ 951 | - private static class FontDelegate { 952 | - private static int[] defaultMapping = { 953 | - CONTROL_TEXT_FONT, SYSTEM_TEXT_FONT, 954 | - USER_TEXT_FONT, CONTROL_TEXT_FONT, 955 | - CONTROL_TEXT_FONT, SUB_TEXT_FONT 956 | - }; 957 | - FontUIResource fonts[]; 958 | - 959 | - // menu and window are mapped to controlFont 960 | - public FontDelegate() { 961 | - fonts = new FontUIResource[6]; 962 | - } 963 | - 964 | - public FontUIResource getFont(int type) { 965 | - int mappedType = defaultMapping[type]; 966 | - if (fonts[type] == null) { 967 | - Font f = getPrivilegedFont(mappedType); 968 | - 969 | - if (f == null) { 970 | - f = new Font(getDefaultFontName(type), 971 | - getDefaultFontStyle(type), 972 | - getDefaultFontSize(type)); 973 | - } 974 | - fonts[type] = new FontUIResource(f); 975 | - } 976 | - return fonts[type]; 977 | - } 978 | - 979 | - /** 980 | - * This is the same as invoking 981 | - * Font.getFont(key), with the exception 982 | - * that it is wrapped inside a doPrivileged call. 983 | - */ 984 | - protected Font getPrivilegedFont(final int key) { 985 | - return java.security.AccessController.doPrivileged( 986 | - new java.security.PrivilegedAction() { 987 | - public Font run() { 988 | - return Font.getFont(getDefaultPropertyName(key)); 989 | - } 990 | - } 991 | - ); 992 | - } 993 | - } 994 | - 995 | - /** 996 | - * The WindowsFontDelegate uses DesktopProperties to obtain fonts. 997 | + * Guarantee lazyness of font initialization. We don't want to waste the memory 998 | + * if user will never use those fonts. 999 | */ 1000 | - private static class WindowsFontDelegate extends FontDelegate { 1001 | - private MetalFontDesktopProperty[] props; 1002 | - private boolean[] checkedPriviledged; 1003 | - 1004 | - public WindowsFontDelegate() { 1005 | - props = new MetalFontDesktopProperty[6]; 1006 | - checkedPriviledged = new boolean[6]; 1007 | - } 1008 | - 1009 | - public FontUIResource getFont(int type) { 1010 | - if (fonts[type] != null) { 1011 | - return fonts[type]; 1012 | - } 1013 | - if (!checkedPriviledged[type]) { 1014 | - Font f = getPrivilegedFont(type); 1015 | - 1016 | - checkedPriviledged[type] = true; 1017 | - if (f != null) { 1018 | - fonts[type] = new FontUIResource(f); 1019 | - return fonts[type]; 1020 | - } 1021 | - } 1022 | - if (props[type] == null) { 1023 | - props[type] = new MetalFontDesktopProperty(type); 1024 | - } 1025 | - // While passing null may seem bad, we don't actually use 1026 | - // the table and looking it up is rather expensive. 1027 | - return (FontUIResource)props[type].createValue(null); 1028 | + private static class LazyDefaultFonts { 1029 | + private static FontUIResource defaultFont; 1030 | + private static FontUIResource smallFont; 1031 | + static { 1032 | + Font f; 1033 | + Object o = Toolkit.getDefaultToolkit().getDesktopProperty("ui.defaultFont"); 1034 | + if (o instanceof Font) { // implicit null check 1035 | + f = (Font) o; 1036 | + } else { 1037 | + f = new Font(Font.SANS_SERIF, Font.PLAIN, 9); 1038 | + } 1039 | + // 90% of size will be small font: 1040 | + defaultFont = new FontUIResource(f); 1041 | + smallFont = new FontUIResource(f.getFamily(), f.getStyle(), (f.getSize() * 9 / 10)); 1042 | } 1043 | } 1044 | } 1045 | Index: jdk8u152-b16/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template 1046 | =================================================================== 1047 | --- jdk8u152-b16.orig/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template 1048 | +++ jdk8u152-b16/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template 1049 | @@ -46,6 +46,7 @@ import java.awt.Dimension; 1050 | import java.awt.Font; 1051 | import java.awt.Graphics2D; 1052 | import java.awt.Insets; 1053 | +import java.awt.Toolkit; 1054 | import java.awt.image.BufferedImage; 1055 | import static java.awt.image.BufferedImage.*; 1056 | import java.beans.PropertyChangeEvent; 1057 | @@ -124,6 +125,15 @@ final class ${LAF_NAME}Defaults { 1058 | UIManager.getDefaults().removePropertyChangeListener(colorTree); 1059 | } 1060 | 1061 | + private FontUIResource defaultFont() { 1062 | + Object o = Toolkit.getDefaultToolkit().getDesktopProperty("ui.defaultFont"); 1063 | + if (o instanceof Font) { // implicit null check 1064 | + Font f = (Font) o; 1065 | + return FontUtilities.getFontConfigFUIR(f.getFamily(), f.getStyle(), f.getSize()); 1066 | + } 1067 | + return FontUtilities.getFontConfigFUIR(Font.SANS_SERIF, Font.PLAIN, 9); 1068 | + } 1069 | + 1070 | /** 1071 | * Create a new ${LAF_NAME}Defaults. This constructor is only called from 1072 | * within ${LAF_NAME}LookAndFeel. 1073 | @@ -135,7 +145,7 @@ final class ${LAF_NAME}Defaults { 1074 | //regions and their states that this class will use for later lookup. 1075 | //Additional regions can be registered later by 3rd party components. 1076 | //These are simply the default registrations. 1077 | - defaultFont = FontUtilities.getFontConfigFUIR("sans", Font.PLAIN, 12); 1078 | + defaultFont = defaultFont(); 1079 | defaultStyle = new DefaultSynthStyle(); 1080 | defaultStyle.setFont(defaultFont); 1081 | 1082 | Index: jdk8u152-b16/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java 1083 | =================================================================== 1084 | --- jdk8u152-b16.orig/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java 1085 | +++ jdk8u152-b16/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java 1086 | @@ -881,7 +881,7 @@ public class StyleSheet extends StyleCon 1087 | * Fetches the font to use for the given set of attributes. 1088 | */ 1089 | public Font getFont(AttributeSet a) { 1090 | - return css.getFont(this, a, 12, this); 1091 | + return css.getFont(this, a, UIManager.getInt("ui.defaultFont.size"), this); 1092 | } 1093 | 1094 | /** 1095 | @@ -2467,19 +2467,20 @@ public class StyleSheet extends StyleCon 1096 | CSS.BackgroundPosition pos = (CSS.BackgroundPosition)a.getAttribute 1097 | (CSS.Attribute.BACKGROUND_POSITION); 1098 | if (pos != null) { 1099 | + int defaultFontSize = UIManager.getInt("ui.defaultFont.size"); 1100 | hPosition = pos.getHorizontalPosition(); 1101 | vPosition = pos.getVerticalPosition(); 1102 | if (pos.isHorizontalPositionRelativeToSize()) { 1103 | flags |= 4; 1104 | } 1105 | else if (pos.isHorizontalPositionRelativeToSize()) { 1106 | - hPosition *= css.getFontSize(a, 12, ss); 1107 | + hPosition *= css.getFontSize(a, defaultFontSize, ss); 1108 | } 1109 | if (pos.isVerticalPositionRelativeToSize()) { 1110 | flags |= 8; 1111 | } 1112 | else if (pos.isVerticalPositionRelativeToFontSize()) { 1113 | - vPosition *= css.getFontSize(a, 12, ss); 1114 | + vPosition *= css.getFontSize(a, defaultFontSize, ss); 1115 | } 1116 | } 1117 | // Determine any repeating values. 1118 | @@ -3331,7 +3332,7 @@ public class StyleSheet extends StyleCon 1119 | * The HTML/CSS size model has seven slots 1120 | * that one can assign sizes to. 1121 | */ 1122 | - static final int sizeMapDefault[] = { 8, 10, 12, 14, 18, 24, 36 }; 1123 | + static final int sizeMapDefault[] = { 4, 6, 7, 9, 11, 14, 20 }; 1124 | 1125 | private int sizeMap[] = sizeMapDefault; 1126 | private boolean w3cLengthUnits = false; 1127 | Index: jdk8u152-b16/jdk/src/share/classes/javax/swing/text/html/default.css 1128 | =================================================================== 1129 | --- jdk8u152-b16.orig/jdk/src/share/classes/javax/swing/text/html/default.css 1130 | +++ jdk8u152-b16/jdk/src/share/classes/javax/swing/text/html/default.css 1131 | @@ -26,8 +26,8 @@ 1132 | /* 1133 | */ 1134 | 1135 | -body {font-size: 14pt; 1136 | - font-family: Serif; 1137 | +body {font-size: 9pt; 1138 | + font-family: sans-serif; 1139 | font-weight: normal; 1140 | margin-left: 0; 1141 | margin-right: 0; 1142 | @@ -174,12 +174,12 @@ big {font-size: x-large} 1143 | small {font-size: x-small} 1144 | 1145 | samp {font-size: small; 1146 | - font-family: Monospaced} 1147 | + font-family: monospace} 1148 | 1149 | cite {font-style: italic} 1150 | 1151 | code {font-size: small; 1152 | - font-family: Monospaced} 1153 | + font-family: monospace} 1154 | 1155 | dfn {font-style: italic} 1156 | 1157 | @@ -190,7 +190,7 @@ i {font-style: italic} 1158 | b {font-weight: bold} 1159 | 1160 | kbd {font-size: small; 1161 | - font-family: Monospaced} 1162 | + font-family: monospace} 1163 | 1164 | s {text-decoration: line-through} 1165 | 1166 | @@ -254,7 +254,7 @@ center {text-align: center} 1167 | 1168 | pre {margin-top: 5; 1169 | margin-bottom: 5; 1170 | - font-family: Monospaced} 1171 | + font-family: monospace} 1172 | 1173 | pre p {margin-top: 0} 1174 | 1175 | Index: jdk8u152-b16/jdk/src/share/classes/sun/awt/SunHints.java 1176 | =================================================================== 1177 | --- jdk8u152-b16.orig/jdk/src/share/classes/sun/awt/SunHints.java 1178 | +++ jdk8u152-b16/jdk/src/share/classes/sun/awt/SunHints.java 1179 | @@ -113,6 +113,11 @@ public class SunHints { 1180 | } 1181 | 1182 | public static Value get(int keyindex, int valueindex) { 1183 | + // array is initialized by accessing RenderingHints, 1184 | + // but it is possible that no one did it before us, 1185 | + // to prevent empty array here we have to touch RenderingHints 1186 | + // ourselves: 1187 | +// RenderingHints.Key key = RenderingHints.KEY_TEXT_ANTIALIASING; 1188 | return ValueObjects[keyindex][valueindex]; 1189 | } 1190 | 1191 | Index: jdk8u152-b16/jdk/src/share/classes/sun/awt/image/OffScreenImage.java 1192 | =================================================================== 1193 | --- jdk8u152-b16.orig/jdk/src/share/classes/sun/awt/image/OffScreenImage.java 1194 | +++ jdk8u152-b16/jdk/src/share/classes/sun/awt/image/OffScreenImage.java 1195 | @@ -32,6 +32,7 @@ import java.awt.Font; 1196 | import java.awt.Graphics; 1197 | import java.awt.Graphics2D; 1198 | import java.awt.GraphicsEnvironment; 1199 | +import java.awt.Toolkit; 1200 | import java.awt.image.BufferedImage; 1201 | import java.awt.image.ImageProducer; 1202 | import java.awt.image.ColorModel; 1203 | @@ -88,7 +89,12 @@ public class OffScreenImage extends Buff 1204 | Font font = c.getFont(); 1205 | if (font == null) { 1206 | if (defaultFont == null) { 1207 | - defaultFont = new Font("Dialog", Font.PLAIN, 12); 1208 | + Object o = Toolkit.getDefaultToolkit().getDesktopProperty("ui.defaultFont"); 1209 | + if (o instanceof Font) { // implicit null check 1210 | + defaultFont = (Font)o; 1211 | + } else { 1212 | + defaultFont = new Font(Font.SANS_SERIF, Font.PLAIN, 9); 1213 | + } 1214 | } 1215 | font = defaultFont; 1216 | } 1217 | Index: jdk8u152-b16/jdk/src/share/classes/sun/awt/image/SunVolatileImage.java 1218 | =================================================================== 1219 | --- jdk8u152-b16.orig/jdk/src/share/classes/sun/awt/image/SunVolatileImage.java 1220 | +++ jdk8u152-b16/jdk/src/share/classes/sun/awt/image/SunVolatileImage.java 1221 | @@ -32,6 +32,7 @@ import java.awt.Font; 1222 | import java.awt.Graphics2D; 1223 | import java.awt.GraphicsConfiguration; 1224 | import java.awt.ImageCapabilities; 1225 | +import java.awt.Toolkit; 1226 | import java.awt.Transparency; 1227 | import java.awt.image.BufferedImage; 1228 | import java.awt.image.ImageObserver; 1229 | @@ -40,6 +41,7 @@ import sun.java2d.SunGraphics2D; 1230 | import sun.java2d.SurfaceManagerFactory; 1231 | import sun.java2d.DestSurfaceProvider; 1232 | import sun.java2d.Surface; 1233 | + 1234 | import static sun.java2d.pipe.hw.AccelSurface.*; 1235 | 1236 | /** 1237 | @@ -203,7 +205,12 @@ public class SunVolatileImage extends Vo 1238 | return comp.getFont(); 1239 | } else { 1240 | if (defaultFont == null) { 1241 | - defaultFont = new Font("Dialog", Font.PLAIN, 12); 1242 | + Object o = Toolkit.getDefaultToolkit().getDesktopProperty("ui.defaultFont"); 1243 | + if (o instanceof Font) { // implicit null check 1244 | + defaultFont = (Font)o; 1245 | + } else { 1246 | + defaultFont = new Font(Font.SANS_SERIF, Font.PLAIN, 9); 1247 | + } 1248 | } 1249 | return defaultFont; 1250 | } 1251 | Index: jdk8u152-b16/jdk/src/share/classes/sun/font/FreetypeFontScaler.java 1252 | =================================================================== 1253 | --- jdk8u152-b16.orig/jdk/src/share/classes/sun/font/FreetypeFontScaler.java 1254 | +++ jdk8u152-b16/jdk/src/share/classes/sun/font/FreetypeFontScaler.java 1255 | @@ -24,12 +24,12 @@ 1256 | */ 1257 | 1258 | package sun.font; 1259 | - 1260 | +import java.awt.geom.AffineTransform; 1261 | +import java.awt.GraphicsEnvironment; 1262 | import java.awt.geom.GeneralPath; 1263 | import java.awt.geom.Point2D; 1264 | import java.awt.geom.Rectangle2D; 1265 | import java.lang.ref.WeakReference; 1266 | - 1267 | /* This is Freetype based implementation of FontScaler. 1268 | * 1269 | * Note that in case of runtime error it is expected that 1270 | @@ -214,8 +214,14 @@ class FreetypeFontScaler extends FontSca 1271 | int aa, int fm, float boldness, float italic, 1272 | boolean disableHinting) { 1273 | if (nativeScaler != 0L) { 1274 | + double ptToPxScale = 1.0d; 1275 | + GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); 1276 | + if (!graphicsEnvironment.isHeadlessInstance()) { 1277 | + AffineTransform normalizingTransform = graphicsEnvironment.getDefaultScreenDevice().getDefaultConfiguration().getNormalizingTransform(); 1278 | + ptToPxScale = normalizingTransform.getScaleY(); 1279 | + } 1280 | return createScalerContextNative(nativeScaler, matrix, 1281 | - aa, fm, boldness, italic); 1282 | + aa, fm, boldness, italic, ptToPxScale); 1283 | } 1284 | return NullFontScaler.getNullScalerContext(); 1285 | } 1286 | @@ -254,7 +260,7 @@ class FreetypeFontScaler extends FontSca 1287 | private native long getUnitsPerEMNative(long pScaler); 1288 | 1289 | native long createScalerContextNative(long pScaler, double[] matrix, 1290 | - int aa, int fm, float boldness, float italic); 1291 | + int aa, int fm, float boldness, float italic, double ptToPxScale); 1292 | 1293 | /* Freetype scaler context does not contain any pointers that 1294 | has to be invalidated if native scaler is bad */ 1295 | Index: jdk8u152-b16/jdk/src/share/classes/sun/java2d/SunGraphics2D.java 1296 | =================================================================== 1297 | --- jdk8u152-b16.orig/jdk/src/share/classes/sun/java2d/SunGraphics2D.java 1298 | +++ jdk8u152-b16/jdk/src/share/classes/sun/java2d/SunGraphics2D.java 1299 | @@ -210,8 +210,6 @@ public final class SunGraphics2D 1300 | 1301 | protected static final Stroke defaultStroke = new BasicStroke(); 1302 | protected static final Composite defaultComposite = AlphaComposite.SrcOver; 1303 | - private static final Font defaultFont = 1304 | - new Font(Font.DIALOG, Font.PLAIN, 12); 1305 | 1306 | public Paint paint; 1307 | public Stroke stroke; 1308 | @@ -278,7 +276,7 @@ public final class SunGraphics2D 1309 | 1310 | renderHint = SunHints.INTVAL_RENDER_DEFAULT; 1311 | antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF; 1312 | - textAntialiasHint = SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT; 1313 | + textAntialiasHint = SunGraphicsEnvironment.LazyDefaults.textAntialiasingHintValue; 1314 | fractionalMetricsHint = SunHints.INTVAL_FRACTIONALMETRICS_OFF; 1315 | lcdTextContrast = lcdTextContrastDefaultValue; 1316 | interpolationHint = -1; 1317 | @@ -297,7 +295,7 @@ public final class SunGraphics2D 1318 | 1319 | font = f; 1320 | if (font == null) { 1321 | - font = defaultFont; 1322 | + font = SunGraphicsEnvironment.LazyDefaults.font; 1323 | } 1324 | 1325 | setDevClip(sd.getBounds()); 1326 | @@ -563,7 +561,7 @@ public final class SunGraphics2D 1327 | 1328 | public Font getFont() { 1329 | if (font == null) { 1330 | - font = defaultFont; 1331 | + font = SunGraphicsEnvironment.LazyDefaults.font; 1332 | } 1333 | return font; 1334 | } 1335 | @@ -1217,7 +1215,7 @@ public final class SunGraphics2D 1336 | if (stateChanged) { 1337 | textStateChanged = 1338 | (textAntialiasHint == 1339 | - SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT); 1340 | + SunGraphicsEnvironment.LazyDefaults.textAntialiasingHintValue); 1341 | if (strokeState != STROKE_CUSTOM) { 1342 | validateBasicStroke((BasicStroke) stroke); 1343 | } 1344 | @@ -1354,7 +1352,7 @@ public final class SunGraphics2D 1345 | this.hints = null; 1346 | renderHint = SunHints.INTVAL_RENDER_DEFAULT; 1347 | antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF; 1348 | - textAntialiasHint = SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT; 1349 | + textAntialiasHint = SunGraphicsEnvironment.LazyDefaults.textAntialiasingHintValue; 1350 | fractionalMetricsHint = SunHints.INTVAL_FRACTIONALMETRICS_OFF; 1351 | lcdTextContrast = lcdTextContrastDefaultValue; 1352 | interpolationHint = -1; 1353 | Index: jdk8u152-b16/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java 1354 | =================================================================== 1355 | --- jdk8u152-b16.orig/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java 1356 | +++ jdk8u152-b16/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java 1357 | @@ -60,6 +60,7 @@ import sun.awt.AppContext; 1358 | import sun.awt.DisplayChangedListener; 1359 | import sun.awt.FontConfiguration; 1360 | import sun.awt.SunDisplayChanger; 1361 | +import sun.awt.SunHints; 1362 | import sun.font.CompositeFontDescriptor; 1363 | import sun.font.Font2D; 1364 | import sun.font.FontManager; 1365 | @@ -78,7 +79,31 @@ public abstract class SunGraphicsEnviron 1366 | implements DisplayChangedListener { 1367 | 1368 | public static boolean isOpenSolaris; 1369 | - private static Font defaultFont; 1370 | + static class LazyDefaults { 1371 | + 1372 | + static final Font font; 1373 | + static final Object textAntialiasingHint; 1374 | + static final int textAntialiasingHintValue; 1375 | + 1376 | + static { 1377 | + Toolkit toolkit = Toolkit.getDefaultToolkit(); 1378 | + Object o = toolkit.getDesktopProperty("ui.defaultFont"); 1379 | + if (o instanceof Font) { // implicit null check 1380 | + font = (Font) o; 1381 | + } else { 1382 | + font = new Font(Font.SANS_SERIF, Font.PLAIN, 9); 1383 | + } 1384 | + Object hint = toolkit.getDesktopProperty("ui.defaultFont.antialiasing"); 1385 | + if (hint instanceof SunHints.Value) { // implicit null check 1386 | + SunHints.Value value = (SunHints.Value) hint; 1387 | + textAntialiasingHint = value; 1388 | + textAntialiasingHintValue = value.getIndex(); 1389 | + } else { 1390 | + textAntialiasingHint = SunHints.VALUE_TEXT_ANTIALIAS_DEFAULT; 1391 | + textAntialiasingHintValue = SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT; 1392 | + } 1393 | + } 1394 | + } 1395 | 1396 | public SunGraphicsEnvironment() { 1397 | java.security.AccessController.doPrivileged( 1398 | @@ -118,9 +143,6 @@ public abstract class SunGraphicsEnviron 1399 | } catch (Exception e) { 1400 | } 1401 | 1402 | - /* Establish the default font to be used by SG2D etc */ 1403 | - defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12); 1404 | - 1405 | return null; 1406 | } 1407 | }); 1408 | @@ -183,7 +205,7 @@ public abstract class SunGraphicsEnviron 1409 | throw new NullPointerException("BufferedImage cannot be null"); 1410 | } 1411 | SurfaceData sd = SurfaceData.getPrimarySurfaceData(img); 1412 | - return new SunGraphics2D(sd, Color.white, Color.black, defaultFont); 1413 | + return new SunGraphics2D(sd, Color.white, Color.black, LazyDefaults.font); 1414 | } 1415 | 1416 | public static FontManagerForSGE getFontManagerForSGE() { 1417 | Index: jdk8u152-b16/jdk/src/share/classes/sun/java2d/SurfaceData.java 1418 | =================================================================== 1419 | --- jdk8u152-b16.orig/jdk/src/share/classes/sun/java2d/SurfaceData.java 1420 | +++ jdk8u152-b16/jdk/src/share/classes/sun/java2d/SurfaceData.java 1421 | @@ -504,8 +504,7 @@ public abstract class SurfaceData 1422 | // For now the answer can only be true in the following cases: 1423 | if (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY && 1424 | sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR && 1425 | - sg2d.clipState <= SunGraphics2D.CLIP_RECTANGULAR && 1426 | - sg2d.surfaceData.getTransparency() == Transparency.OPAQUE) 1427 | + sg2d.clipState <= SunGraphics2D.CLIP_RECTANGULAR) 1428 | { 1429 | if (haveLCDLoop == LOOP_UNKNOWN) { 1430 | DrawGlyphListLCD loop = 1431 | Index: jdk8u152-b16/jdk/src/share/classes/sun/java2d/loops/BlitBg.java 1432 | =================================================================== 1433 | --- jdk8u152-b16.orig/jdk/src/share/classes/sun/java2d/loops/BlitBg.java 1434 | +++ jdk8u152-b16/jdk/src/share/classes/sun/java2d/loops/BlitBg.java 1435 | @@ -29,6 +29,7 @@ import java.awt.Font; 1436 | import java.awt.Color; 1437 | import java.awt.Composite; 1438 | import java.awt.AlphaComposite; 1439 | +import java.awt.Toolkit; 1440 | import java.awt.Transparency; 1441 | import java.awt.image.ColorModel; 1442 | import java.awt.image.WritableRaster; 1443 | @@ -181,7 +182,14 @@ public class BlitBg extends GraphicsPrim 1444 | 0, 0, dstx, dsty, width, height); 1445 | } 1446 | 1447 | - private static Font defaultFont = new Font("Dialog", Font.PLAIN, 12); 1448 | + private static Font defaultFont = defaultFont(); 1449 | + private static Font defaultFont() { 1450 | + Object o = Toolkit.getDefaultToolkit().getDesktopProperty("ui.defaultFont"); 1451 | + if (o instanceof Font) { // implicit null check 1452 | + return (Font) o; 1453 | + } 1454 | + return new Font(Font.SANS_SERIF, Font.PLAIN, 9); 1455 | + } 1456 | } 1457 | 1458 | public GraphicsPrimitive traceWrap() { 1459 | Index: jdk8u152-b16/jdk/src/share/native/sun/font/freetypeScaler.c 1460 | =================================================================== 1461 | --- jdk8u152-b16.orig/jdk/src/share/native/sun/font/freetypeScaler.c 1462 | +++ jdk8u152-b16/jdk/src/share/native/sun/font/freetypeScaler.c 1463 | @@ -92,6 +92,7 @@ typedef struct FTScalerContext { 1464 | int renderFlags; /* configuration specific to particular engine */ 1465 | int pathType; 1466 | int ptsz; /* size in points */ 1467 | + int dpi; /* screen dpi */ 1468 | RenderingProperties* renderingProperties; 1469 | } FTScalerContext; 1470 | 1471 | @@ -487,7 +488,7 @@ static double euclidianDistance(double a 1472 | JNIEXPORT jlong JNICALL 1473 | Java_sun_font_FreetypeFontScaler_createScalerContextNative( 1474 | JNIEnv *env, jobject scaler, jlong pScaler, jdoubleArray matrix, 1475 | - jint aa, jint fm, jfloat boldness, jfloat italic) { 1476 | + jint aa, jint fm, jfloat boldness, jfloat italic, jdouble ptToPxScale) { 1477 | double dmat[4], ptsz; 1478 | FTScalerContext *context = 1479 | (FTScalerContext*) calloc(1, sizeof(FTScalerContext)); 1480 | @@ -504,6 +505,11 @@ Java_sun_font_FreetypeFontScaler_createS 1481 | //text can not be smaller than 1 point 1482 | ptsz = 1.0; 1483 | } 1484 | + 1485 | + // because we operate with quite high numbers - no need to round up DPI: 1486 | + double dpi = 72.0 * ptToPxScale; 1487 | + 1488 | + context->dpi = (int)dpi; 1489 | context->ptsz = (int)(ptsz * 64); 1490 | context->transform.xx = FloatToFTFixed((float)dmat[0]/ptsz); 1491 | context->transform.yx = -FloatToFTFixed((float)dmat[1]/ptsz); 1492 | @@ -538,7 +544,12 @@ static int setupFTContext(JNIEnv *env, 1493 | 1494 | FT_Set_Transform(scalerInfo->face, &context->transform, NULL); 1495 | 1496 | - errCode = FT_Set_Char_Size(scalerInfo->face, 0, context->ptsz, 72, 72); 1497 | + // we could use calculated pixel size for this, 1498 | + // but who knows if we guessed with rounding up, 1499 | + // so we will leave it up to freetype2 to decide the pixel size 1500 | + // based on DPI value: 1501 | + //errCode = FT_Set_Pixel_Sizes(scalerInfo->face, 0, context->pxsz); 1502 | + errCode = FT_Set_Char_Size(scalerInfo->face, 0, context->ptsz, 0, context->dpi); 1503 | 1504 | if (errCode == 0) { 1505 | errCode = FT_Activate_Size(scalerInfo->face->size); 1506 | Index: jdk8u152-b16/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java 1507 | =================================================================== 1508 | --- jdk8u152-b16.orig/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java 1509 | +++ jdk8u152-b16/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java 1510 | @@ -257,7 +257,7 @@ public abstract class InfoWindow extends 1511 | private final static int BALLOON_ICON_HEIGHT = 32; 1512 | private final static int BALLOON_TRAY_ICON_INDENT = 0; 1513 | private final static Color BALLOON_CAPTION_BACKGROUND_COLOR = new Color(200, 200 ,255); 1514 | - private final static Font BALLOON_CAPTION_FONT = new Font(Font.DIALOG, Font.BOLD, 12); 1515 | + private final static Font BALLOON_CAPTION_FONT = new Font(FontDefaults.font.getFamily(), Font.BOLD, FontDefaults.font.getSize()); 1516 | 1517 | private Panel mainPanel = new Panel(); 1518 | private Panel captionPanel = new Panel(); 1519 | Index: jdk8u152-b16/jdk/src/solaris/classes/sun/awt/X11/XAWTLookAndFeel.java 1520 | =================================================================== 1521 | --- jdk8u152-b16.orig/jdk/src/solaris/classes/sun/awt/X11/XAWTLookAndFeel.java 1522 | +++ jdk8u152-b16/jdk/src/solaris/classes/sun/awt/X11/XAWTLookAndFeel.java 1523 | @@ -85,12 +85,11 @@ class XAWTLookAndFeel extends MotifLookA 1524 | protected void initComponentDefaults(UIDefaults table) { 1525 | super.initComponentDefaults(table); 1526 | 1527 | - FontUIResource dialogPlain12 = new FontUIResource(Font.DIALOG, 1528 | - Font.PLAIN, 12); 1529 | - FontUIResource sansSerifPlain12 = new FontUIResource(Font.SANS_SERIF, 1530 | - Font.PLAIN, 12); 1531 | - FontUIResource monospacedPlain12 = new FontUIResource(Font.MONOSPACED, 1532 | - Font.PLAIN, 12); 1533 | + Font f = FontDefaults.font; 1534 | + FontUIResource dialogPlain = new FontUIResource(f); 1535 | + FontUIResource sansSerifPlain = dialogPlain; 1536 | + FontUIResource monospacedPlain = new FontUIResource(Font.MONOSPACED, 1537 | + Font.PLAIN, f.getSize()); 1538 | ColorUIResource red = new ColorUIResource(Color.red); 1539 | ColorUIResource black = new ColorUIResource(Color.black); 1540 | ColorUIResource white = new ColorUIResource(Color.white); 1541 | @@ -289,7 +288,7 @@ class XAWTLookAndFeel extends MotifLookA 1542 | "END", "maxScroll" 1543 | }), 1544 | 1545 | - "ScrollPane.font", dialogPlain12, 1546 | + "ScrollPane.font", dialogPlain, 1547 | "ScrollPane.background", scrollBarBackground, 1548 | "ScrollPane.foreground", table.get("controlText"), 1549 | "ScrollPane.border", null, 1550 | @@ -360,7 +359,7 @@ class XAWTLookAndFeel extends MotifLookA 1551 | "TextField.selectionForeground", table.get("textHighlightText"), 1552 | "TextField.background", table.get("window"), 1553 | "TextField.foreground", table.get("textText"), 1554 | - "TextField.font", sansSerifPlain12, 1555 | + "TextField.font", sansSerifPlain, 1556 | "TextField.border", textFieldBorder, 1557 | "TextField.focusInputMap", fieldInputMap, 1558 | 1559 | @@ -371,7 +370,7 @@ class XAWTLookAndFeel extends MotifLookA 1560 | "PasswordField.selectionForeground", table.get("textHighlightText"), 1561 | "PasswordField.background", table.get("window"), 1562 | "PasswordField.foreground", table.get("textText"), 1563 | - "PasswordField.font", sansSerifPlain12, 1564 | + "PasswordField.font", sansSerifPlain, 1565 | "PasswordField.border", textFieldBorder, 1566 | "PasswordField.focusInputMap", passwordInputMap, 1567 | 1568 | @@ -382,7 +381,7 @@ class XAWTLookAndFeel extends MotifLookA 1569 | "TextArea.selectionForeground", table.get("textHighlightText"), 1570 | "TextArea.background", table.get("window"), 1571 | "TextArea.foreground", table.get("textText"), 1572 | - "TextArea.font", monospacedPlain12, 1573 | + "TextArea.font", monospacedPlain, 1574 | "TextArea.border", marginBorder, 1575 | "TextArea.focusInputMap", multilineInputMap 1576 | }; 1577 | Index: jdk8u152-b16/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java 1578 | =================================================================== 1579 | --- jdk8u152-b16.orig/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java 1580 | +++ jdk8u152-b16/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java 1581 | @@ -187,7 +187,7 @@ class XFileDialogPeer extends XDialogPee 1582 | 1583 | // add components to GridBagLayout "gbl" 1584 | 1585 | - Font f = new Font(Font.DIALOG, Font.PLAIN, 12); 1586 | + Font f = FontDefaults.font; 1587 | 1588 | Label label = new Label(pathLabelText); 1589 | label.setFont(f); 1590 | Index: jdk8u152-b16/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java 1591 | =================================================================== 1592 | --- jdk8u152-b16.orig/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java 1593 | +++ jdk8u152-b16/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java 1594 | @@ -1489,6 +1489,15 @@ public final class XToolkit extends UNIX 1595 | desktopProperties.put("awt.mouse.numButtons", 1596 | Integer.valueOf(getNumberOfButtons())); 1597 | } 1598 | + desktopProperties.put("ui.defaultFont", FontDefaults.font); 1599 | + desktopProperties.put("ui.defaultFont.antialiasing", FontDefaults.antialiasingHint); 1600 | + } 1601 | + 1602 | + @Override 1603 | + protected RenderingHints getDesktopAAHints() { 1604 | + // RenderingHints is mutable class, so we have to return new instance 1605 | + // every time to be on the safe side: 1606 | + return new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING, FontDefaults.antialiasingHint); 1607 | } 1608 | 1609 | /** 1610 | Index: jdk8u152-b16/jdk/src/solaris/classes/sun/awt/X11/XWindow.java 1611 | =================================================================== 1612 | --- jdk8u152-b16.orig/jdk/src/solaris/classes/sun/awt/X11/XWindow.java 1613 | +++ jdk8u152-b16/jdk/src/solaris/classes/sun/awt/X11/XWindow.java 1614 | @@ -104,7 +104,7 @@ class XWindow extends XBaseWindow implem 1615 | 1616 | static synchronized Font getDefaultFont() { 1617 | if (null == defaultFont) { 1618 | - defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12); 1619 | + defaultFont = FontDefaults.font; 1620 | } 1621 | return defaultFont; 1622 | } 1623 | Index: jdk8u152-b16/jdk/src/solaris/classes/sun/awt/X11/FontDefaults.java 1624 | =================================================================== 1625 | --- /dev/null 1626 | +++ jdk8u152-b16/jdk/src/solaris/classes/sun/awt/X11/FontDefaults.java 1627 | @@ -0,0 +1,174 @@ 1628 | +package sun.awt.X11; 1629 | + 1630 | +import java.awt.Font; 1631 | +import java.awt.RenderingHints; 1632 | +import java.io.File; 1633 | +import java.io.FileInputStream; 1634 | +import java.io.InputStreamReader; 1635 | +import java.io.Reader; 1636 | +import java.security.AccessController; 1637 | +import java.security.PrivilegedAction; 1638 | +import java.util.Arrays; 1639 | +import java.util.List; 1640 | +import java.util.Optional; 1641 | +import java.util.Properties; 1642 | +import java.util.function.Supplier; 1643 | + 1644 | +/** 1645 | + * Configuration hierarchy follows "first found":
1646 | + *

    1647 | + *
  1. system property
  2. 1648 | + *
  3. user config in ${user.home}/.config/java.properties
  4. 1649 | + *
  5. system config in /etc/java.properties
  6. 1650 | + *
  7. legacy config in ${java.home}/jre/lib/swing.properties
  8. 1651 | + *
  9. hardcoded default
  10. 1652 | + *
1653 | + */ 1654 | +class FontDefaults { 1655 | + 1656 | + static final Font font; 1657 | + static final Object antialiasingHint; 1658 | + 1659 | + static { 1660 | + FontDefaults resolver = new FontDefaults(); 1661 | + List>> suppliers = Arrays.asList( 1662 | + resolver::readAppConfig, 1663 | + resolver::readUserConfig, 1664 | + resolver::readSystemConfig, 1665 | + resolver::readLegacyConfig 1666 | + ); 1667 | + font = resolver.readFont(suppliers); 1668 | + antialiasingHint = resolver.readFontAntialiasing(suppliers); 1669 | + } 1670 | + 1671 | + private Optional appConfig; 1672 | + private Optional userConfig; 1673 | + private Optional systemConfig; 1674 | + private Optional legacyConfig; 1675 | + 1676 | + private FontDefaults() { 1677 | + } 1678 | + 1679 | + private Font readFont(List>> suppliers) { 1680 | + int size = 9; 1681 | + for (Supplier> sup : suppliers) { 1682 | + Optional properties = sup.get(); 1683 | + if (!properties.isPresent()) { 1684 | + continue; 1685 | + } 1686 | + String value = properties.get().getProperty("ui.defaultFont.size"); 1687 | + if (value == null) { 1688 | + continue; 1689 | + } 1690 | + try { 1691 | + size = Integer.parseInt(value); 1692 | + break; 1693 | + } catch (Exception ignore) { 1694 | + } 1695 | + } 1696 | + return new Font(Font.SANS_SERIF, Font.PLAIN, size); 1697 | + } 1698 | + 1699 | + private Object readFontAntialiasing(List>> suppliers) { 1700 | + for (Supplier> sup : suppliers) { 1701 | + Optional properties = sup.get(); 1702 | + if (!properties.isPresent()) { 1703 | + continue; 1704 | + } 1705 | + String value = properties.get().getProperty("ui.defaultFont.antialiasing"); 1706 | + if (value == null) { 1707 | + continue; 1708 | + } 1709 | + switch (value) { 1710 | + case "off": 1711 | + return RenderingHints.VALUE_TEXT_ANTIALIAS_OFF; 1712 | + case "on": 1713 | + return RenderingHints.VALUE_TEXT_ANTIALIAS_ON; 1714 | + case "gasp": 1715 | + return RenderingHints.VALUE_TEXT_ANTIALIAS_GASP; 1716 | + case "lcd": 1717 | + case "lcd_hrgb": 1718 | + case "hrgb": 1719 | + return RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB; 1720 | + case "hbgr": 1721 | + case "lcd_hbgr": 1722 | + return RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HBGR; 1723 | + case "vrgb": 1724 | + case "lcd_vrgb": 1725 | + return RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB; 1726 | + case "vbgr": 1727 | + case "lcd_vbgr": 1728 | + return RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VBGR; 1729 | + case "default": 1730 | + return RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT; 1731 | + } 1732 | + } 1733 | + // if we are still here - no configuration provided, 1734 | + // attempting to autodiscover: 1735 | + Object hint = sun.font.FontConfigManager.getFontConfigAAHint(); 1736 | + if (hint != null) { 1737 | + return hint; 1738 | + } 1739 | + return RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT; 1740 | + } 1741 | + 1742 | + private Optional readAppConfig() { 1743 | + if (appConfig == null) { 1744 | + PrivilegedAction action = () -> { 1745 | + return System.getProperties(); 1746 | + }; 1747 | + appConfig = Optional.ofNullable(AccessController.doPrivileged(action)); 1748 | + } 1749 | + return appConfig; 1750 | + } 1751 | + 1752 | + private Optional readUserConfig() { 1753 | + if (userConfig == null) { 1754 | + // have to wrap System.getProperty into PrivilegedAction: 1755 | + PrivilegedAction action = () -> { 1756 | + String filePath = System.getProperty("user.home") + File.separatorChar + ".config" + File.separatorChar + "java.properties"; 1757 | + return readProperties(filePath); 1758 | + }; 1759 | + userConfig = Optional.ofNullable(AccessController.doPrivileged(action)); 1760 | + } 1761 | + return userConfig; 1762 | + } 1763 | + 1764 | + private Optional readSystemConfig() { 1765 | + if (systemConfig == null) { 1766 | + // have to wrap System.getProperty into PrivilegedAction: 1767 | + PrivilegedAction action = () -> { 1768 | + String filePath = "/etc/java.properties"; 1769 | + return readProperties(filePath); 1770 | + }; 1771 | + systemConfig = Optional.ofNullable(AccessController.doPrivileged(action)); 1772 | + } 1773 | + return systemConfig; 1774 | + } 1775 | + 1776 | + private Optional readLegacyConfig() { 1777 | + if (legacyConfig == null) { 1778 | + // have to wrap System.getProperty into PrivilegedAction: 1779 | + PrivilegedAction action = () -> { 1780 | + String filePath = System.getProperty("java.home") + File.separatorChar + "lib" + File.separatorChar + "swing.properties"; 1781 | + return readProperties(filePath); 1782 | + }; 1783 | + legacyConfig = Optional.ofNullable(AccessController.doPrivileged(action)); 1784 | + } 1785 | + return legacyConfig; 1786 | + } 1787 | + 1788 | + private Properties readProperties(final String filePath) { 1789 | + File file = new File(filePath); 1790 | + if (file.exists() && file.canRead()) { 1791 | + try (Reader reader = new InputStreamReader(new FileInputStream(file), "UTF-8")) { 1792 | + Properties properties = new Properties(); 1793 | + properties.load(reader); 1794 | + return properties; 1795 | + } catch (Exception ignore) { 1796 | + } 1797 | + } 1798 | + return null; 1799 | + } 1800 | + 1801 | +} 1802 | Index: jdk8u152-b16/jdk/src/share/classes/sun/awt/SunToolkit.java 1803 | =================================================================== 1804 | --- jdk8u152-b16.orig/jdk/src/share/classes/sun/awt/SunToolkit.java 1805 | +++ jdk8u152-b16/jdk/src/share/classes/sun/awt/SunToolkit.java 1806 | @@ -1727,9 +1727,7 @@ public abstract class SunToolkit extends 1807 | } 1808 | 1809 | private static boolean checkedSystemAAFontSettings; 1810 | - private static boolean useSystemAAFontSettings; 1811 | private static boolean lastExtraCondition = true; 1812 | - private static RenderingHints desktopFontHints; 1813 | 1814 | /* Since Swing is the reason for this "extra condition" logic its 1815 | * worth documenting it in some detail. 1816 | @@ -1773,72 +1771,6 @@ public abstract class SunToolkit extends 1817 | } 1818 | } 1819 | 1820 | - /* "false", "off", ""default" aren't explicitly tested, they 1821 | - * just fall through to produce a null return which all are equated to 1822 | - * "false". 1823 | - */ 1824 | - private static RenderingHints getDesktopAAHintsByName(String hintname) { 1825 | - Object aaHint = null; 1826 | - hintname = hintname.toLowerCase(Locale.ENGLISH); 1827 | - if (hintname.equals("on")) { 1828 | - aaHint = VALUE_TEXT_ANTIALIAS_ON; 1829 | - } else if (hintname.equals("gasp")) { 1830 | - aaHint = VALUE_TEXT_ANTIALIAS_GASP; 1831 | - } else if (hintname.equals("lcd") || hintname.equals("lcd_hrgb")) { 1832 | - aaHint = VALUE_TEXT_ANTIALIAS_LCD_HRGB; 1833 | - } else if (hintname.equals("lcd_hbgr")) { 1834 | - aaHint = VALUE_TEXT_ANTIALIAS_LCD_HBGR; 1835 | - } else if (hintname.equals("lcd_vrgb")) { 1836 | - aaHint = VALUE_TEXT_ANTIALIAS_LCD_VRGB; 1837 | - } else if (hintname.equals("lcd_vbgr")) { 1838 | - aaHint = VALUE_TEXT_ANTIALIAS_LCD_VBGR; 1839 | - } 1840 | - if (aaHint != null) { 1841 | - RenderingHints map = new RenderingHints(null); 1842 | - map.put(KEY_TEXT_ANTIALIASING, aaHint); 1843 | - return map; 1844 | - } else { 1845 | - return null; 1846 | - } 1847 | - } 1848 | - 1849 | - /* This method determines whether to use the system font settings, 1850 | - * or ignore them if a L&F has specified they should be ignored, or 1851 | - * to override both of these with a system property specified value. 1852 | - * If the toolkit isn't a SunToolkit, (eg may be headless) then that 1853 | - * system property isn't applied as desktop properties are considered 1854 | - * to be inapplicable in that case. In that headless case although 1855 | - * this method will return "true" the toolkit will return a null map. 1856 | - */ 1857 | - private static boolean useSystemAAFontSettings() { 1858 | - if (!checkedSystemAAFontSettings) { 1859 | - useSystemAAFontSettings = true; /* initially set this true */ 1860 | - String systemAAFonts = null; 1861 | - Toolkit tk = Toolkit.getDefaultToolkit(); 1862 | - if (tk instanceof SunToolkit) { 1863 | - systemAAFonts = 1864 | - AccessController.doPrivileged( 1865 | - new GetPropertyAction("awt.useSystemAAFontSettings")); 1866 | - } 1867 | - if (systemAAFonts != null) { 1868 | - useSystemAAFontSettings = 1869 | - Boolean.valueOf(systemAAFonts).booleanValue(); 1870 | - /* If it is anything other than "true", then it may be 1871 | - * a hint name , or it may be "off, "default", etc. 1872 | - */ 1873 | - if (!useSystemAAFontSettings) { 1874 | - desktopFontHints = getDesktopAAHintsByName(systemAAFonts); 1875 | - } 1876 | - } 1877 | - /* If its still true, apply the extra condition */ 1878 | - if (useSystemAAFontSettings) { 1879 | - useSystemAAFontSettings = lastExtraCondition; 1880 | - } 1881 | - checkedSystemAAFontSettings = true; 1882 | - } 1883 | - return useSystemAAFontSettings; 1884 | - } 1885 | - 1886 | /* A variable defined for the convenience of JDK code */ 1887 | public static final String DESKTOPFONTHINTS = "awt.font.desktophints"; 1888 | 1889 | @@ -1854,22 +1786,12 @@ public abstract class SunToolkit extends 1890 | * to a helper class. 1891 | */ 1892 | public static RenderingHints getDesktopFontHints() { 1893 | - if (useSystemAAFontSettings()) { 1894 | - Toolkit tk = Toolkit.getDefaultToolkit(); 1895 | - if (tk instanceof SunToolkit) { 1896 | - Object map = ((SunToolkit)tk).getDesktopAAHints(); 1897 | - return (RenderingHints)map; 1898 | - } else { /* Headless Toolkit */ 1899 | - return null; 1900 | - } 1901 | - } else if (desktopFontHints != null) { 1902 | - /* cloning not necessary as the return value is cloned later, but 1903 | - * its harmless. 1904 | - */ 1905 | - return (RenderingHints)(desktopFontHints.clone()); 1906 | - } else { 1907 | - return null; 1908 | + Toolkit tk = Toolkit.getDefaultToolkit(); 1909 | + if (tk instanceof SunToolkit) { 1910 | + Object map = ((SunToolkit) tk).getDesktopAAHints(); 1911 | + return (RenderingHints) map; 1912 | } 1913 | + return null; 1914 | } 1915 | 1916 | 1917 | -------------------------------------------------------------------------------- /setupQuiltEnv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | QUILT="$( which quilt 2>/dev/null )" 4 | if [[ -z $QUILT ]] ; then 5 | echo 'quilt not found' >&2 6 | exit 1 7 | fi 8 | 9 | printQuiltPatchesDir() { 10 | local SCRIPT_SOURCE 11 | local SCRIPT_DIR 12 | local QUILT_PATCHES 13 | ## resolve folder of this script, following all symlinks, 14 | ## http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in 15 | SCRIPT_SOURCE="${BASH_SOURCE[0]}" 16 | while [ -h "$SCRIPT_SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink 17 | SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )" 18 | SCRIPT_SOURCE="$(readlink "$SCRIPT_SOURCE")" 19 | # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located 20 | [[ $SCRIPT_SOURCE != /* ]] && SCRIPT_SOURCE="$SCRIPT_DIR/$SCRIPT_SOURCE" 21 | done 22 | SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )" 23 | QUILT_PATCHES="$SCRIPT_DIR/quilt-patches" 24 | echo "$QUILT_PATCHES" 25 | } 26 | 27 | QUILT_PATCHES="$( printQuiltPatchesDir )" 28 | echo "setting QUILT_PATCHES variable to: $QUILT_PATCHES" 29 | export QUILT_PATCHES 30 | 31 | EDITOR='nano' 32 | echo "setting EDITOR to: $EDITOR" 33 | export EDITOR 34 | -------------------------------------------------------------------------------- /tuxjdk-beta.spec: -------------------------------------------------------------------------------- 1 | %global hgtag jdk8u45-b14 2 | %global update 45 3 | %global minor beta 4 | 5 | # openjdk build system is different, 6 | # we are building release so there is no useful debuginfo, 7 | # so disabling debuginfo package creation: 8 | %global debug_package %{nil} 9 | %define __jar_repack %{nil} 10 | 11 | Name: tuxjdk-beta 12 | Version: 8.%{update}.%{minor} 13 | Release: 0 14 | URL: https://github.com/TheIndifferent/tuxjdk 15 | Summary: Beta or early development version of TuxJdk 16 | Conflicts: tuxjdk 17 | #License: GNU General Public License, version 2, with the Classpath Exception 18 | License: GPL-2.0+ 19 | Group: Development/Languages 20 | BuildRequires: bash 21 | BuildRequires: make 22 | BuildRequires: gcc 23 | BuildRequires: gcc-c++ 24 | BuildRequires: autoconf 25 | BuildRequires: automake 26 | BuildRequires: time 27 | BuildRequires: zip 28 | BuildRequires: unzip 29 | BuildRequires: freetype2-devel 30 | BuildRequires: fontconfig-devel 31 | BuildRequires: alsa-devel 32 | BuildRequires: cups-devel 33 | BuildRequires: libpng-devel 34 | BuildRequires: libjpeg-devel 35 | BuildRequires: giflib-devel 36 | BuildRequires: gtk2-devel 37 | BuildRequires: libX11-devel 38 | BuildRequires: libXi-devel 39 | BuildRequires: libXinerama-devel 40 | BuildRequires: libXt-devel 41 | BuildRequires: libXtst-devel 42 | BuildRequires: java-devel 43 | BuildRequires: quilt 44 | BuildRequires: fdupes 45 | Source0: %{name}.tar.xz 46 | Source1: %{hgtag}.tar.xz 47 | Source13: %{name}-rpmlintrc 48 | BuildRoot: %{name} 49 | 50 | %description 51 | Beta/TP/early development version of TuxJdk. 52 | Enhanced Open Java Development Kit for developers on Linux. Contains series of 53 | patched to OpenJDK to enhance user experience with Java-based and Swing-based 54 | tools (NetBeans, Idea, Android Studio, etc). 55 | 56 | %package launchers 57 | Summary: Path launchers for TuxJdk 58 | Group: Development/Languages 59 | Requires: tuxjdk 60 | BuildArch: noarch 61 | 62 | %description launchers 63 | Launch scripts for TuxJdk, located under /usr/local/bin, to be the first 64 | in path but not to conflict with existing jpackage-based packages. 65 | 66 | %prep 67 | %setup -q -n %{name} 68 | %setup -q -T -D -a 1 -n %{name} 69 | ( cd %{hgtag}/jdk/src/share/native/sun/awt && rm -rf giflib ) 70 | ( cd %{hgtag}/jdk/src/share/native/java/util/zip && rm -rf zlib-1.2.8 ) 71 | ( cd %{hgtag} && bash ../applyTuxjdk.sh ) 72 | 73 | %build 74 | pushd %{hgtag} 75 | bash ./common/autoconf/autogen.sh 76 | bash ../configureBuildOpenjdk.sh 77 | popd 78 | 79 | %install 80 | # we are building release build, 81 | # so there should be only minimal debug info, 82 | # and probably for a good reason: 83 | export NO_BRP_STRIP_DEBUG='true' 84 | # creating main dir: 85 | install -dm 755 %{buildroot}/opt/tuxjdk 86 | # processing the image: 87 | pushd %{hgtag}/build/images/j2sdk-image 88 | # deleting useless files: 89 | rm -rf 'demo' 'sample' 90 | # copy everything to /opt: 91 | cp -R * %{buildroot}/opt/tuxjdk/ 92 | popd 93 | # hardlinks instead of duplicates: 94 | %fdupes %{buildroot}/opt/tuxjdk/ 95 | # copy launchers to /usr/local/bin: 96 | install -Dm 755 launcher.sh %{buildroot}/usr/local/bin/java 97 | install -Dm 755 launcher.sh %{buildroot}/usr/local/bin/javac 98 | install -Dm 755 launcher.sh %{buildroot}/usr/local/bin/javap 99 | install -Dm 755 launcher.sh %{buildroot}/usr/local/bin/javah 100 | # hadlink launchers as well: 101 | %fdupes %{buildroot}/usr/local/bin/ 102 | # default font size and antialiasing mode: 103 | # TODO maybe find a better way to do that? 104 | cp default_swing.properties %{buildroot}/opt/tuxjdk/jre/lib/swing.properties 105 | 106 | %files 107 | %defattr(644,root,root,755) 108 | /opt/tuxjdk 109 | %attr(755,root,root) /opt/tuxjdk/bin/* 110 | %attr(755,root,root) /opt/tuxjdk/jre/bin/* 111 | 112 | %files launchers 113 | %defattr(755,root,root,755) 114 | /usr/local/bin/* 115 | 116 | %changelog 117 | * Fri Jun 26 2015 baiduzhyi.devel@gmail.com 118 | - Branching into tuxjdk-beta project. 119 | * Wed Jun 10 2015 baiduzhyi.devel@gmail.com 120 | - Version 03 of tuxjdk: 121 | * configurable default font size; 122 | * configurable default text antialiasing; 123 | * disabling some gcc warnings; 124 | * compressing the jars; 125 | * adding default swing.properties file; 126 | * fixing binaries strip. 127 | * Fri May 29 2015 baiduzhyi.devel@gmail.com 128 | - Do not merge jre into jdk image. 129 | * Tue May 26 2015 baiduzhyi.devel@gmail.com 130 | - Version 02 of tuxjdk: 131 | * spec file uses script for build; 132 | * added launcher scripts under /usr/local/bin/ ; 133 | * dropped verbosity fix patch; 134 | * merging jre and jdk into single dir; 135 | * adding rpmlint config; 136 | * checking support for other distributions; 137 | * Fri Apr 3 2015 baiduzhyi.devel@gmail.com 138 | - Working spec file based on tuxjdk 8.40.0. 139 | * Thu Apr 2 2015 baiduzhyi.devel@gmail.com 140 | - Initial attempt to build normal openJDK source code. 141 | -------------------------------------------------------------------------------- /tuxjdk-rpmlintrc: -------------------------------------------------------------------------------- 1 | setBadness('devel-file-in-non-devel-package', 0) 2 | setBadness('incorrect-fsf-address', 0) 3 | -------------------------------------------------------------------------------- /tuxjdk.spec: -------------------------------------------------------------------------------- 1 | # 2 | # spec file for package tuxjdk 3 | # 4 | # Copyright (c) 2015 Stanislav Baiduzhyi 5 | # 6 | # All modifications and additions to the file contributed by third parties 7 | # remain the property of their copyright owners, unless otherwise agreed 8 | # upon. The license for this file, and modifications and additions to the 9 | # file, is the same license as for the pristine package itself (unless the 10 | # license for the pristine package is not an Open Source License, in which 11 | # case the license is the MIT License). An "Open Source License" is a 12 | # license that conforms to the Open Source Definition (Version 1.9) 13 | # published by the Open Source Initiative. 14 | 15 | %global vendor tuxjdk 16 | 17 | %global hgtag jdk8u152-b16 18 | %global update 152 19 | %global minor 03 20 | 21 | # openjdk build system is different, 22 | # we are building release so there is no useful debuginfo, 23 | # so disabling debuginfo package creation: 24 | %global debug_package %{nil} 25 | # no one should touch our jars, we know better: 26 | %define __jar_repack %{nil} 27 | 28 | 29 | Name: tuxjdk 30 | Version: 8.%{update}.%{minor} 31 | Release: 0 32 | URL: https://github.com/tuxjdk/tuxjdk 33 | Summary: Enhanced Open Java Development Kit for developers on Linux 34 | #License: GNU General Public License, version 2, with the Classpath Exception 35 | License: GPL-2.0+ 36 | Group: Development/Languages 37 | BuildRequires: bash 38 | BuildRequires: make 39 | BuildRequires: gcc 40 | BuildRequires: gcc-c++ 41 | BuildRequires: autoconf 42 | BuildRequires: automake 43 | BuildRequires: time 44 | BuildRequires: zip 45 | BuildRequires: unzip 46 | BuildRequires: freetype2-devel 47 | BuildRequires: fontconfig-devel 48 | BuildRequires: alsa-devel 49 | BuildRequires: cups-devel 50 | BuildRequires: libpng-devel 51 | BuildRequires: libjpeg-devel 52 | BuildRequires: giflib-devel 53 | BuildRequires: gtk2-devel 54 | BuildRequires: libX11-devel 55 | BuildRequires: libXi-devel 56 | BuildRequires: libXinerama-devel 57 | BuildRequires: libXt-devel 58 | BuildRequires: libXtst-devel 59 | BuildRequires: java-devel 60 | BuildRequires: ca-certificates 61 | %if 0%{?is_opensuse} 62 | BuildRequires: ca-certificates-mozilla 63 | BuildRequires: ca-certificates-cacert 64 | %endif 65 | BuildRequires: quilt 66 | BuildRequires: fdupes 67 | Source0: %{name}-%{version}.tar.xz 68 | Source1: %{hgtag}.tar.xz 69 | Source2: launcher.sh 70 | Source13: %{name}-rpmlintrc 71 | 72 | %description 73 | Enhanced Open Java Development Kit for developers on Linux. Contains series of 74 | patched to OpenJDK to enhance user experience with Java-based and Swing-based 75 | tools (NetBeans, Idea, Android Studio, etc). 76 | 77 | %package launchers 78 | Summary: Path launchers for TuxJdk 79 | Group: Development/Languages 80 | Requires: tuxjdk 81 | BuildArch: noarch 82 | 83 | %description launchers 84 | Launch scripts for TuxJdk, located under /usr/local/bin, to be the first 85 | in path but not to conflict with existing jpackage-based packages. 86 | 87 | %prep 88 | %setup -q 89 | %setup -q -T -D -a 1 90 | ( cd %{hgtag}/jdk/src/share/native/sun/awt && rm -rf giflib ) 91 | ( cd %{hgtag}/jdk/src/share/native/java/util/zip && rm -rf zlib-1.2.8 ) 92 | ( cd %{hgtag} && bash ../applyTuxjdk.sh ) 93 | 94 | %build 95 | pushd %{hgtag} 96 | bash ./common/autoconf/autogen.sh 97 | bash ../configureBuildOpenjdk.sh 98 | popd 99 | 100 | %install 101 | # we are building release build, 102 | # so there should be only minimal debug info, 103 | # and probably for a good reason: 104 | export NO_BRP_STRIP_DEBUG='true' 105 | # creating main dir: 106 | install -dm 755 %{buildroot}/opt/%{vendor}/%{name} 107 | # processing the image: 108 | pushd %{hgtag}/build/images/j2sdk-image 109 | # deleting useless files: 110 | rm -rf 'demo' 'sample' 111 | # copy everything to /opt: 112 | cp -R * %{buildroot}/opt/%{vendor}/%{name}/ 113 | popd 114 | # hardlinks instead of duplicates: 115 | %fdupes %{buildroot}/opt/%{vendor}/%{name}/ 116 | # copy launchers to /usr/local/bin: 117 | install -Dm 755 %{SOURCE2} %{buildroot}/usr/local/bin/java 118 | install -Dm 755 %{SOURCE2} %{buildroot}/usr/local/bin/javac 119 | install -Dm 755 %{SOURCE2} %{buildroot}/usr/local/bin/javap 120 | install -Dm 755 %{SOURCE2} %{buildroot}/usr/local/bin/javah 121 | # hadlink launchers as well: 122 | %fdupes %{buildroot}/usr/local/bin/ 123 | # default font size and antialiasing mode: 124 | # TODO maybe find a better way to do that? 125 | cp default_swing.properties %{buildroot}/opt/%{vendor}/%{name}/jre/lib/swing.properties 126 | # copy the certificates: 127 | if [ -f '/var/lib/ca-certificates/java-cacerts' ] ; then 128 | cp -f '/var/lib/ca-certificates/java-cacerts' %{buildroot}/opt/%{vendor}/%{name}/jre/lib/security/cacerts 129 | elif readlink -e '/etc/pki/java/cacerts' ; then 130 | cp -f "$( readlink -e '/etc/pki/java/cacerts' )" %{buildroot}/opt/%{vendor}/%{name}/jre/lib/security/cacerts 131 | else 132 | echo 'No cacerts found!' >&2 133 | exit 1 134 | fi 135 | 136 | %files 137 | %defattr(644,root,root,755) 138 | %dir /opt/%{vendor} 139 | /opt/%{vendor}/%{name} 140 | %attr(755,root,root) /opt/%{vendor}/%{name}/bin/* 141 | %attr(755,root,root) /opt/%{vendor}/%{name}/jre/bin/* 142 | 143 | %files launchers 144 | %defattr(755,root,root,755) 145 | /usr/local/bin/* 146 | 147 | %changelog 148 | * Sun Nov 12 2017 sam@guymer.me 149 | - Refreshing for 8u152. 150 | * Sun May 8 2016 baiduzhyi.devel@gmail.com 151 | - Refreshing for 8u92. 152 | * Sun Nov 15 2015 baiduzhyi.devel@gmail.com 153 | - Adding cacert from the distribution. 154 | * Thu Nov 12 2015 baiduzhyi.devel@gmail.com 155 | - Refreshing for 8u66. 156 | * Fri Aug 21 2015 baiduzhyi.devel@gmail.com 157 | - Refreshing for 8u60. 158 | - Dropping giflib5 and gcc5 patches. 159 | * Wed Jul 15 2015 baiduzhyi.devel@gmail.com 160 | - Refreshing for 8u51. 161 | * Tue Jul 14 2015 - baiduzhyi.devel@gmail.com 162 | - Moving under vendor-specific dir. 163 | * Wed Jun 10 2015 baiduzhyi.devel@gmail.com 164 | - Version 03 of tuxjdk: 165 | * configurable default font size; 166 | * configurable default text antialiasing; 167 | * disabling some gcc warnings; 168 | * compressing the jars; 169 | * adding default swing.properties file; 170 | * fixing binaries strip. 171 | * Fri May 29 2015 baiduzhyi.devel@gmail.com 172 | - Do not merge jre into jdk image. 173 | * Tue May 26 2015 baiduzhyi.devel@gmail.com 174 | - Version 02 of tuxjdk: 175 | * spec file uses script for build; 176 | * added launcher scripts under /usr/local/bin/ ; 177 | * dropped verbosity fix patch; 178 | * merging jre and jdk into single dir; 179 | * adding rpmlint config; 180 | * checking support for other distributions; 181 | * Fri Apr 3 2015 baiduzhyi.devel@gmail.com 182 | - Working spec file based on tuxjdk 8.40.0. 183 | * Thu Apr 2 2015 baiduzhyi.devel@gmail.com 184 | - Initial attempt to build normal openJDK source code. 185 | --------------------------------------------------------------------------------