Path: blob/master/src/java.desktop/share/classes/sun/font/FontManagerNativeLibrary.java
41155 views
/*1* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.font;2627import sun.java2d.SunGraphicsEnvironment;2829@SuppressWarnings("removal")30public class FontManagerNativeLibrary {31static {32java.security.AccessController.doPrivileged(33new java.security.PrivilegedAction<Object>() {34public Object run() {35/* REMIND do we really have to load awt here? */36System.loadLibrary("awt");37if (System.getProperty("os.name").startsWith("Windows")) {38/* Ideally fontmanager library should not depend on39particular implementation of the font scaler.40However, freetype scaler is basically small wrapper on41top of freetype library (that is used in binary form).4243This wrapper is compiled into fontmanager and this make44fontmanger library depending on freetype library.4546On Windows DLL's in the JRE's BIN directory cannot be47found by windows DLL loading as that directory is not48on the Windows PATH.4950To avoid link error we have to load freetype explicitly51before we load fontmanager.5253NB: consider moving freetype wrapper part to separate54shared library in order to avoid dependency. */55System.loadLibrary("freetype");56}57System.loadLibrary("fontmanager");5859return null;60}61});62}6364/*65* Call this method to ensure libraries are loaded.66*67* Method acts as trigger to ensure this class is loaded68* (and therefore initializer code is executed).69* Actual loading is performed by static initializer.70* (no need to execute doPrivilledged block more than once)71*/72public static void load() {}73}747576