jdk/src/windows/classes/sun/awt/Win32FontManager.java
changeset 26007 dba8f49653ce
parent 25192 4e2dc0f8702d
equal deleted inserted replaced
26006:da0572ecab20 26007:dba8f49653ce
     1 /*
     1 /*
     2  * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    35 import java.util.HashMap;
    35 import java.util.HashMap;
    36 import java.util.Locale;
    36 import java.util.Locale;
    37 import java.util.NoSuchElementException;
    37 import java.util.NoSuchElementException;
    38 import java.util.StringTokenizer;
    38 import java.util.StringTokenizer;
    39 
    39 
    40 import sun.awt.Win32GraphicsEnvironment;
       
    41 import sun.awt.windows.WFontConfiguration;
    40 import sun.awt.windows.WFontConfiguration;
    42 import sun.font.FontManager;
    41 import sun.font.FontManager;
    43 import sun.font.SunFontManager;
    42 import sun.font.SunFontManager;
    44 import sun.font.TrueTypeFont;
    43 import sun.font.TrueTypeFont;
    45 
    44 
    46 /**
    45 /**
    47  * The X11 implementation of {@link FontManager}.
    46  * The X11 implementation of {@link FontManager}.
    48  */
    47  */
    49 public class Win32FontManager extends SunFontManager {
    48 public final class Win32FontManager extends SunFontManager {
    50 
       
    51     private static String[] defaultPlatformFont = null;
       
    52 
    49 
    53     private static TrueTypeFont eudcFont;
    50     private static TrueTypeFont eudcFont;
    54 
    51 
    55     static {
    52     static {
    56 
    53 
   211                                      familyToFontListMap,
   208                                      familyToFontListMap,
   212                                  Locale locale);
   209                                  Locale locale);
   213 
   210 
   214     protected synchronized native String getFontPath(boolean noType1Fonts);
   211     protected synchronized native String getFontPath(boolean noType1Fonts);
   215 
   212 
   216     public String[] getDefaultPlatformFont() {
   213     @Override
   217 
   214     protected String[] getDefaultPlatformFont() {
   218         if (defaultPlatformFont != null) {
       
   219             return defaultPlatformFont;
       
   220         }
       
   221 
       
   222         String[] info = new String[2];
   215         String[] info = new String[2];
   223         info[0] = "Arial";
   216         info[0] = "Arial";
   224         info[1] = "c:\\windows\\fonts";
   217         info[1] = "c:\\windows\\fonts";
   225         final String[] dirs = getPlatformFontDirs(true);
   218         final String[] dirs = getPlatformFontDirs(true);
   226         if (dirs.length > 1) {
   219         if (dirs.length > 1) {
   243             }
   236             }
   244         } else {
   237         } else {
   245             info[1] = dirs[0];
   238             info[1] = dirs[0];
   246         }
   239         }
   247         info[1] = info[1] + File.separator + "arial.ttf";
   240         info[1] = info[1] + File.separator + "arial.ttf";
   248         defaultPlatformFont = info;
   241         return info;
   249         return defaultPlatformFont;
       
   250     }
   242     }
   251 
   243 
   252     /* register only TrueType/OpenType fonts
   244     /* register only TrueType/OpenType fonts
   253      * Because these need to be registed just for use when printing,
   245      * Because these need to be registed just for use when printing,
   254      * we defer the actual registration and the static initialiser
   246      * we defer the actual registration and the static initialiser