Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/font/FontManagerNativeLibrary.java
38829 views
/*1* Copyright (c) 2007, 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;2829public class FontManagerNativeLibrary {30static {31java.security.AccessController.doPrivileged(32new java.security.PrivilegedAction() {33public Object run() {34/* REMIND do we really have to load awt here? */35System.loadLibrary("awt");36if (FontUtilities.isOpenJDK &&37System.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.5253Note that we do not need to do this for T2K because54fontmanager.dll does not depend on t2k.dll.5556NB: consider moving freetype wrapper part to separate57shared library in order to avoid dependency. */58System.loadLibrary("freetype");59}60System.loadLibrary("fontmanager");6162return null;63}64});65}6667/*68* Call this method to ensure libraries are loaded.69*70* Method acts as trigger to ensure this class is loaded71* (and therefore initializer code is executed).72* Actual loading is performed by static initializer.73* (no need to execute doPrivilledged block more than once)74*/75public static void load() {}76}777879