< prev index next >

modules/javafx.graphics/src/main/java/com/sun/javafx/font/AndroidFontFinder.java

Print this page




  32 import java.io.InputStream;
  33 import java.security.AccessController;
  34 import java.security.PrivilegedAction;
  35 import java.util.ArrayList;
  36 import java.util.HashMap;
  37 import java.util.List;
  38 import java.util.Locale;
  39 
  40 import javax.xml.parsers.SAXParser;
  41 import javax.xml.parsers.SAXParserFactory;
  42 
  43 import org.xml.sax.Attributes;
  44 import org.xml.sax.SAXException;
  45 import org.xml.sax.helpers.DefaultHandler;
  46 
  47 import com.sun.glass.utils.NativeLibLoader;
  48 
  49 /**
  50  * Class AndroidFontFinder reads font descriptor from
  51  * /system/etc/system_fonts.xml. If that file doesn't exist it is replaced by
  52  * embedded font descriptor {@link com/sun/t2k/android_system_fonts.xml} which
  53  * defines some basic mappings based on best guess which fonts are mandatory on
  54  * platforms lower than 4.0 and how they map to typefaces.
  55  */
  56 class AndroidFontFinder {
  57 
  58     private final static String SYSTEM_FONT_NAME    = "sans serif";
  59     private final static float SYSTEM_FONT_SIZE     = 16.0f;
  60 
  61     final static String fontDescriptor_2_X_Path = "/com/sun/javafx/font/android_system_fonts.xml";
  62     final static String fontDescriptor_4_X_Path = "/system/etc/system_fonts.xml";
  63     final static String systemFontsDir = "/system/fonts";
  64 
  65     static {
  66         AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
  67             NativeLibLoader.loadLibrary("javafx_font");
  68             return null;
  69         });
  70     }
  71 
  72     public static String getSystemFont() {




  32 import java.io.InputStream;
  33 import java.security.AccessController;
  34 import java.security.PrivilegedAction;
  35 import java.util.ArrayList;
  36 import java.util.HashMap;
  37 import java.util.List;
  38 import java.util.Locale;
  39 
  40 import javax.xml.parsers.SAXParser;
  41 import javax.xml.parsers.SAXParserFactory;
  42 
  43 import org.xml.sax.Attributes;
  44 import org.xml.sax.SAXException;
  45 import org.xml.sax.helpers.DefaultHandler;
  46 
  47 import com.sun.glass.utils.NativeLibLoader;
  48 
  49 /**
  50  * Class AndroidFontFinder reads font descriptor from
  51  * /system/etc/system_fonts.xml. If that file doesn't exist it is replaced by
  52  * embedded font descriptor {@link com/sun/javafx/font/android_system_fonts.xml} which
  53  * defines some basic mappings based on best guess which fonts are mandatory on
  54  * platforms lower than 4.0 and how they map to typefaces.
  55  */
  56 class AndroidFontFinder {
  57 
  58     private final static String SYSTEM_FONT_NAME    = "sans serif";
  59     private final static float SYSTEM_FONT_SIZE     = 16.0f;
  60 
  61     final static String fontDescriptor_2_X_Path = "/com/sun/javafx/font/android_system_fonts.xml";
  62     final static String fontDescriptor_4_X_Path = "/system/etc/system_fonts.xml";
  63     final static String systemFontsDir = "/system/fonts";
  64 
  65     static {
  66         AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
  67             NativeLibLoader.loadLibrary("javafx_font");
  68             return null;
  69         });
  70     }
  71 
  72     public static String getSystemFont() {


< prev index next >