Path: blob/master/src/java.desktop/macosx/classes/sun/font/CFontConfiguration.java
41153 views
/*1* Copyright (c) 2011, 2014, 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 java.nio.charset.Charset;28import java.util.HashMap;29import sun.awt.FontConfiguration;30import sun.font.CompositeFontDescriptor;31import sun.font.SunFontManager;3233class CFontConfiguration extends FontConfiguration {3435private static CompositeFontDescriptor[] emptyDescriptors =36new CompositeFontDescriptor[0];37private static String[] emptyStrings = new String[0];3839public CFontConfiguration(SunFontManager fm) {40super(fm);41}4243public CFontConfiguration(SunFontManager fm,44boolean preferLocaleFonts,45boolean preferPropFonts)46{47super(fm, preferLocaleFonts, preferPropFonts);48}4950/*51* On Mac OS X we essentially ignore the font.properties file, and do52* it all programatically. The intention is end users will use things53* like the Font Book to manage fonts. Plus our fonts automatically do54* unicode substitution, so a localized font is not required.55*56* The following methods therefore act like stubs and return empty values.57*/5859@Override60public int getNumberCoreFonts() {61return 0;62}6364@Override65public String[] getPlatformFontNames() {66return emptyStrings;67}6869@Override70public CompositeFontDescriptor[] get2DCompositeFontInfo() {71return emptyDescriptors;72}7374@Override75protected String mapFileName(String fileName) {76return "";77}7879@Override80protected Charset getDefaultFontCharset(String fontName) {81return Charset.forName("ISO8859_1");82}8384@Override85protected String getEncoding(String awtFontName, String charSubsetName) {86return "default";87}8889@Override90protected String getFaceNameFromComponentFontName(String compFontName) {91return compFontName;92}9394@Override95protected String getFileNameFromComponentFontName(String compFontName) {96return compFontName;97}9899@Override100public String getFallbackFamilyName(String fontName,101String defaultFallback)102{103return defaultFallback;104}105106@Override107protected void initReorderMap() {108reorderMap = new HashMap<>();109}110}111112113