All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fernice.reflare.internal.impl.AATextInfoAccessorImpl Maven / Gradle / Ivy

There is a newer version: 1.3.0
Show newest version
package org.fernice.reflare.internal.impl;

import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Locale;
import java.util.Map;
import org.fernice.reflare.internal.AATextInfoHelper.AATextInfoAccessor;
import sun.swing.SwingUtilities2;

public class AATextInfoAccessorImpl implements AATextInfoAccessor {

    @Override
    public void aaTextInfo(Map defaults) {
        SwingUtilities2.putAATextInfo(getAATextInfoCondition(), defaults);
    }

    private static boolean getAATextInfoCondition() {
        final String language = Locale.getDefault().getLanguage();
        final String desktop = AccessController.doPrivileged((PrivilegedAction) () -> System.getProperty("sun.desktop"));

        final boolean isCjkLocale = (Locale.CHINESE.getLanguage().equals(language) || Locale.JAPANESE.getLanguage().equals(language) ||
                Locale.KOREAN.getLanguage().equals(language));
        final boolean isGnome = "gnome".equals(desktop);
        final boolean isLocal = SwingUtilities2.isLocalDisplay();

        return isLocal && (!isGnome || !isCjkLocale);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy