Java 类sun.font.FontConfigManager.FontConfigInfo 实例源码

项目:OpenJSharp    文件:FcFontConfiguration.java   
private void writeFcInfo() {
    Properties props = new Properties();
    props.setProperty("version", fileVersion);
    X11FontManager fm = (X11FontManager) fontManager;
    FontConfigManager fcm = fm.getFontConfigManager();
    FontConfigInfo fcInfo = fcm.getFontConfigInfo();
    props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
    if (fcInfo.cacheDirs != null) {
        for (int i=0;i<fcInfo.cacheDirs.length;i++) {
            if (fcInfo.cacheDirs[i] != null) {
               props.setProperty("cachedir."+i,  fcInfo.cacheDirs[i]);
            }
        }
    }
    for (int i=0; i<fcCompFonts.length; i++) {
        FcCompFont fci = fcCompFonts[i];
        String styleKey = fci.jdkName+"."+fci.style;
        props.setProperty(styleKey+".length",
                          Integer.toString(fci.allFonts.length));
        for (int j=0; j<fci.allFonts.length; j++) {
            props.setProperty(styleKey+"."+j+".family",
                              fci.allFonts[j].familyName);
            props.setProperty(styleKey+"."+j+".file",
                              fci.allFonts[j].fontFile);
        }
    }
    try {
        /* This writes into a temp file then renames when done.
         * Since the rename is an atomic action within the same
         * directory no client will ever see a partially written file.
         */
        File fcInfoFile = getFcInfoFile();
        File dir = fcInfoFile.getParentFile();
        dir.mkdirs();
        File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
        FileOutputStream fos = new FileOutputStream(tempFile);
        props.store(fos,
                  "JDK Font Configuration Generated File: *Do Not Edit*");
        fos.close();
        boolean renamed = tempFile.renameTo(fcInfoFile);
        if (!renamed && FontUtilities.debugFonts()) {
            System.out.println("rename failed");
            warning("Failed renaming file to "+ getFcInfoFile());
        }
    } catch (Exception e) {
        if (FontUtilities.debugFonts()) {
            warning("IOException writing to "+ getFcInfoFile());
        }
    }
}
项目:jdk8u-jdk    文件:FcFontConfiguration.java   
private void writeFcInfo() {
    Properties props = new Properties();
    props.setProperty("version", fileVersion);
    FcFontManager fm = (FcFontManager) fontManager;
    FontConfigManager fcm = fm.getFontConfigManager();
    FontConfigInfo fcInfo = fcm.getFontConfigInfo();
    props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
    if (fcInfo.cacheDirs != null) {
        for (int i=0;i<fcInfo.cacheDirs.length;i++) {
            if (fcInfo.cacheDirs[i] != null) {
               props.setProperty("cachedir."+i,  fcInfo.cacheDirs[i]);
            }
        }
    }
    for (int i=0; i<fcCompFonts.length; i++) {
        FcCompFont fci = fcCompFonts[i];
        String styleKey = fci.jdkName+"."+fci.style;
        props.setProperty(styleKey+".length",
                          Integer.toString(fci.allFonts.length));
        for (int j=0; j<fci.allFonts.length; j++) {
            props.setProperty(styleKey+"."+j+".family",
                              fci.allFonts[j].familyName);
            props.setProperty(styleKey+"."+j+".file",
                              fci.allFonts[j].fontFile);
        }
    }
    try {
        /* This writes into a temp file then renames when done.
         * Since the rename is an atomic action within the same
         * directory no client will ever see a partially written file.
         */
        File fcInfoFile = getFcInfoFile();
        File dir = fcInfoFile.getParentFile();
        dir.mkdirs();
        File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
        FileOutputStream fos = new FileOutputStream(tempFile);
        props.store(fos,
                  "JDK Font Configuration Generated File: *Do Not Edit*");
        fos.close();
        boolean renamed = tempFile.renameTo(fcInfoFile);
        if (!renamed && FontUtilities.debugFonts()) {
            System.out.println("rename failed");
            warning("Failed renaming file to "+ getFcInfoFile());
        }
    } catch (Exception e) {
        if (FontUtilities.debugFonts()) {
            warning("IOException writing to "+ getFcInfoFile());
        }
    }
}
项目:openjdk-jdk10    文件:FcFontConfiguration.java   
private void writeFcInfo() {
    Properties props = new Properties();
    props.setProperty("version", fileVersion);
    FcFontManager fm = (FcFontManager) fontManager;
    FontConfigManager fcm = fm.getFontConfigManager();
    FontConfigInfo fcInfo = fcm.getFontConfigInfo();
    props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
    if (fcInfo.cacheDirs != null) {
        for (int i=0;i<fcInfo.cacheDirs.length;i++) {
            if (fcInfo.cacheDirs[i] != null) {
               props.setProperty("cachedir."+i,  fcInfo.cacheDirs[i]);
            }
        }
    }
    for (int i=0; i<fcCompFonts.length; i++) {
        FcCompFont fci = fcCompFonts[i];
        String styleKey = fci.jdkName+"."+fci.style;
        props.setProperty(styleKey+".length",
                          Integer.toString(fci.allFonts.length));
        for (int j=0; j<fci.allFonts.length; j++) {
            props.setProperty(styleKey+"."+j+".family",
                              fci.allFonts[j].familyName);
            props.setProperty(styleKey+"."+j+".file",
                              fci.allFonts[j].fontFile);
        }
    }
    try {
        /* This writes into a temp file then renames when done.
         * Since the rename is an atomic action within the same
         * directory no client will ever see a partially written file.
         */
        File fcInfoFile = getFcInfoFile();
        File dir = fcInfoFile.getParentFile();
        dir.mkdirs();
        File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
        FileOutputStream fos = new FileOutputStream(tempFile);
        props.store(fos,
                  "JDK Font Configuration Generated File: *Do Not Edit*");
        fos.close();
        boolean renamed = tempFile.renameTo(fcInfoFile);
        if (!renamed && FontUtilities.debugFonts()) {
            System.out.println("rename failed");
            warning("Failed renaming file to "+ getFcInfoFile());
        }
    } catch (Exception e) {
        if (FontUtilities.debugFonts()) {
            warning("IOException writing to "+ getFcInfoFile());
        }
    }
}
项目:openjdk9    文件:FcFontConfiguration.java   
private void writeFcInfo() {
    Properties props = new Properties();
    props.setProperty("version", fileVersion);
    FcFontManager fm = (FcFontManager) fontManager;
    FontConfigManager fcm = fm.getFontConfigManager();
    FontConfigInfo fcInfo = fcm.getFontConfigInfo();
    props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
    if (fcInfo.cacheDirs != null) {
        for (int i=0;i<fcInfo.cacheDirs.length;i++) {
            if (fcInfo.cacheDirs[i] != null) {
               props.setProperty("cachedir."+i,  fcInfo.cacheDirs[i]);
            }
        }
    }
    for (int i=0; i<fcCompFonts.length; i++) {
        FcCompFont fci = fcCompFonts[i];
        String styleKey = fci.jdkName+"."+fci.style;
        props.setProperty(styleKey+".length",
                          Integer.toString(fci.allFonts.length));
        for (int j=0; j<fci.allFonts.length; j++) {
            props.setProperty(styleKey+"."+j+".family",
                              fci.allFonts[j].familyName);
            props.setProperty(styleKey+"."+j+".file",
                              fci.allFonts[j].fontFile);
        }
    }
    try {
        /* This writes into a temp file then renames when done.
         * Since the rename is an atomic action within the same
         * directory no client will ever see a partially written file.
         */
        File fcInfoFile = getFcInfoFile();
        File dir = fcInfoFile.getParentFile();
        dir.mkdirs();
        File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
        FileOutputStream fos = new FileOutputStream(tempFile);
        props.store(fos,
                  "JDK Font Configuration Generated File: *Do Not Edit*");
        fos.close();
        boolean renamed = tempFile.renameTo(fcInfoFile);
        if (!renamed && FontUtilities.debugFonts()) {
            System.out.println("rename failed");
            warning("Failed renaming file to "+ getFcInfoFile());
        }
    } catch (Exception e) {
        if (FontUtilities.debugFonts()) {
            warning("IOException writing to "+ getFcInfoFile());
        }
    }
}
项目:jdk8u_jdk    文件:FcFontConfiguration.java   
private void writeFcInfo() {
    Properties props = new Properties();
    props.setProperty("version", fileVersion);
    FcFontManager fm = (FcFontManager) fontManager;
    FontConfigManager fcm = fm.getFontConfigManager();
    FontConfigInfo fcInfo = fcm.getFontConfigInfo();
    props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
    if (fcInfo.cacheDirs != null) {
        for (int i=0;i<fcInfo.cacheDirs.length;i++) {
            if (fcInfo.cacheDirs[i] != null) {
               props.setProperty("cachedir."+i,  fcInfo.cacheDirs[i]);
            }
        }
    }
    for (int i=0; i<fcCompFonts.length; i++) {
        FcCompFont fci = fcCompFonts[i];
        String styleKey = fci.jdkName+"."+fci.style;
        props.setProperty(styleKey+".length",
                          Integer.toString(fci.allFonts.length));
        for (int j=0; j<fci.allFonts.length; j++) {
            props.setProperty(styleKey+"."+j+".family",
                              fci.allFonts[j].familyName);
            props.setProperty(styleKey+"."+j+".file",
                              fci.allFonts[j].fontFile);
        }
    }
    try {
        /* This writes into a temp file then renames when done.
         * Since the rename is an atomic action within the same
         * directory no client will ever see a partially written file.
         */
        File fcInfoFile = getFcInfoFile();
        File dir = fcInfoFile.getParentFile();
        dir.mkdirs();
        File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
        FileOutputStream fos = new FileOutputStream(tempFile);
        props.store(fos,
                  "JDK Font Configuration Generated File: *Do Not Edit*");
        fos.close();
        boolean renamed = tempFile.renameTo(fcInfoFile);
        if (!renamed && FontUtilities.debugFonts()) {
            System.out.println("rename failed");
            warning("Failed renaming file to "+ getFcInfoFile());
        }
    } catch (Exception e) {
        if (FontUtilities.debugFonts()) {
            warning("IOException writing to "+ getFcInfoFile());
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:FcFontConfiguration.java   
private void writeFcInfo() {
    Properties props = new Properties();
    props.setProperty("version", fileVersion);
    FcFontManager fm = (FcFontManager) fontManager;
    FontConfigManager fcm = fm.getFontConfigManager();
    FontConfigInfo fcInfo = fcm.getFontConfigInfo();
    props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
    if (fcInfo.cacheDirs != null) {
        for (int i=0;i<fcInfo.cacheDirs.length;i++) {
            if (fcInfo.cacheDirs[i] != null) {
               props.setProperty("cachedir."+i,  fcInfo.cacheDirs[i]);
            }
        }
    }
    for (int i=0; i<fcCompFonts.length; i++) {
        FcCompFont fci = fcCompFonts[i];
        String styleKey = fci.jdkName+"."+fci.style;
        props.setProperty(styleKey+".length",
                          Integer.toString(fci.allFonts.length));
        for (int j=0; j<fci.allFonts.length; j++) {
            props.setProperty(styleKey+"."+j+".family",
                              fci.allFonts[j].familyName);
            props.setProperty(styleKey+"."+j+".file",
                              fci.allFonts[j].fontFile);
        }
    }
    try {
        /* This writes into a temp file then renames when done.
         * Since the rename is an atomic action within the same
         * directory no client will ever see a partially written file.
         */
        File fcInfoFile = getFcInfoFile();
        File dir = fcInfoFile.getParentFile();
        dir.mkdirs();
        File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
        FileOutputStream fos = new FileOutputStream(tempFile);
        props.store(fos,
                  "JDK Font Configuration Generated File: *Do Not Edit*");
        fos.close();
        boolean renamed = tempFile.renameTo(fcInfoFile);
        if (!renamed && FontUtilities.debugFonts()) {
            System.out.println("rename failed");
            warning("Failed renaming file to "+ getFcInfoFile());
        }
    } catch (Exception e) {
        if (FontUtilities.debugFonts()) {
            warning("IOException writing to "+ getFcInfoFile());
        }
    }
}
项目:infobip-open-jdk-8    文件:FcFontConfiguration.java   
private void writeFcInfo() {
    Properties props = new Properties();
    props.setProperty("version", fileVersion);
    X11FontManager fm = (X11FontManager) fontManager;
    FontConfigManager fcm = fm.getFontConfigManager();
    FontConfigInfo fcInfo = fcm.getFontConfigInfo();
    props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
    if (fcInfo.cacheDirs != null) {
        for (int i=0;i<fcInfo.cacheDirs.length;i++) {
            if (fcInfo.cacheDirs[i] != null) {
               props.setProperty("cachedir."+i,  fcInfo.cacheDirs[i]);
            }
        }
    }
    for (int i=0; i<fcCompFonts.length; i++) {
        FcCompFont fci = fcCompFonts[i];
        String styleKey = fci.jdkName+"."+fci.style;
        props.setProperty(styleKey+".length",
                          Integer.toString(fci.allFonts.length));
        for (int j=0; j<fci.allFonts.length; j++) {
            props.setProperty(styleKey+"."+j+".family",
                              fci.allFonts[j].familyName);
            props.setProperty(styleKey+"."+j+".file",
                              fci.allFonts[j].fontFile);
        }
    }
    try {
        /* This writes into a temp file then renames when done.
         * Since the rename is an atomic action within the same
         * directory no client will ever see a partially written file.
         */
        File fcInfoFile = getFcInfoFile();
        File dir = fcInfoFile.getParentFile();
        dir.mkdirs();
        File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
        FileOutputStream fos = new FileOutputStream(tempFile);
        props.store(fos,
                  "JDK Font Configuration Generated File: *Do Not Edit*");
        fos.close();
        boolean renamed = tempFile.renameTo(fcInfoFile);
        if (!renamed && FontUtilities.debugFonts()) {
            System.out.println("rename failed");
            warning("Failed renaming file to "+ getFcInfoFile());
        }
    } catch (Exception e) {
        if (FontUtilities.debugFonts()) {
            warning("IOException writing to "+ getFcInfoFile());
        }
    }
}
项目:jdk8u-dev-jdk    文件:FcFontConfiguration.java   
private void writeFcInfo() {
    Properties props = new Properties();
    props.setProperty("version", fileVersion);
    X11FontManager fm = (X11FontManager) fontManager;
    FontConfigManager fcm = fm.getFontConfigManager();
    FontConfigInfo fcInfo = fcm.getFontConfigInfo();
    props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
    if (fcInfo.cacheDirs != null) {
        for (int i=0;i<fcInfo.cacheDirs.length;i++) {
            if (fcInfo.cacheDirs[i] != null) {
               props.setProperty("cachedir."+i,  fcInfo.cacheDirs[i]);
            }
        }
    }
    for (int i=0; i<fcCompFonts.length; i++) {
        FcCompFont fci = fcCompFonts[i];
        String styleKey = fci.jdkName+"."+fci.style;
        props.setProperty(styleKey+".length",
                          Integer.toString(fci.allFonts.length));
        for (int j=0; j<fci.allFonts.length; j++) {
            props.setProperty(styleKey+"."+j+".family",
                              fci.allFonts[j].familyName);
            props.setProperty(styleKey+"."+j+".file",
                              fci.allFonts[j].fontFile);
        }
    }
    try {
        /* This writes into a temp file then renames when done.
         * Since the rename is an atomic action within the same
         * directory no client will ever see a partially written file.
         */
        File fcInfoFile = getFcInfoFile();
        File dir = fcInfoFile.getParentFile();
        dir.mkdirs();
        File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
        FileOutputStream fos = new FileOutputStream(tempFile);
        props.store(fos,
                  "JDK Font Configuration Generated File: *Do Not Edit*");
        fos.close();
        boolean renamed = tempFile.renameTo(fcInfoFile);
        if (!renamed && FontUtilities.debugFonts()) {
            System.out.println("rename failed");
            warning("Failed renaming file to "+ getFcInfoFile());
        }
    } catch (Exception e) {
        if (FontUtilities.debugFonts()) {
            warning("IOException writing to "+ getFcInfoFile());
        }
    }
}
项目:jdk7-jdk    文件:FcFontConfiguration.java   
private void writeFcInfo() {
    Properties props = new Properties();
    props.setProperty("version", fileVersion);
    X11FontManager fm = (X11FontManager) fontManager;
    FontConfigManager fcm = fm.getFontConfigManager();
    FontConfigInfo fcInfo = fcm.getFontConfigInfo();
    props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
    if (fcInfo.cacheDirs != null) {
        for (int i=0;i<fcInfo.cacheDirs.length;i++) {
            if (fcInfo.cacheDirs[i] != null) {
               props.setProperty("cachedir."+i,  fcInfo.cacheDirs[i]);
            }
        }
    }
    for (int i=0; i<fcCompFonts.length; i++) {
        FcCompFont fci = fcCompFonts[i];
        String styleKey = fci.jdkName+"."+fci.style;
        props.setProperty(styleKey+".length",
                          Integer.toString(fci.allFonts.length));
        for (int j=0; j<fci.allFonts.length; j++) {
            props.setProperty(styleKey+"."+j+".family",
                              fci.allFonts[j].familyName);
            props.setProperty(styleKey+"."+j+".file",
                              fci.allFonts[j].fontFile);
        }
    }
    try {
        /* This writes into a temp file then renames when done.
         * Since the rename is an atomic action within the same
         * directory no client will ever see a partially written file.
         */
        File fcInfoFile = getFcInfoFile();
        File dir = fcInfoFile.getParentFile();
        dir.mkdirs();
        File tempFile = File.createTempFile("fcinfo", null, dir);
        FileOutputStream fos = new FileOutputStream(tempFile);
        props.store(fos,
                  "JDK Font Configuration Generated File: *Do Not Edit*");
        fos.close();
        boolean renamed = tempFile.renameTo(fcInfoFile);
        if (!renamed && FontUtilities.debugFonts()) {
            System.out.println("rename failed");
            warning("Failed renaming file to "+ getFcInfoFile());
        }
    } catch (Exception e) {
        if (FontUtilities.debugFonts()) {
            warning("IOException writing to "+ getFcInfoFile());
        }
    }
}
项目:openjdk-source-code-learn    文件:FcFontConfiguration.java   
private void writeFcInfo() {
    Properties props = new Properties();
    props.setProperty("version", fileVersion);
    X11FontManager fm = (X11FontManager) fontManager;
    FontConfigManager fcm = fm.getFontConfigManager();
    FontConfigInfo fcInfo = fcm.getFontConfigInfo();
    props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
    if (fcInfo.cacheDirs != null) {
        for (int i=0;i<fcInfo.cacheDirs.length;i++) {
            if (fcInfo.cacheDirs[i] != null) {
               props.setProperty("cachedir."+i,  fcInfo.cacheDirs[i]);
            }
        }
    }
    for (int i=0; i<fcCompFonts.length; i++) {
        FcCompFont fci = fcCompFonts[i];
        String styleKey = fci.jdkName+"."+fci.style;
        props.setProperty(styleKey+".length",
                          Integer.toString(fci.allFonts.length));
        for (int j=0; j<fci.allFonts.length; j++) {
            props.setProperty(styleKey+"."+j+".family",
                              fci.allFonts[j].familyName);
            props.setProperty(styleKey+"."+j+".file",
                              fci.allFonts[j].fontFile);
        }
    }
    try {
        /* This writes into a temp file then renames when done.
         * Since the rename is an atomic action within the same
         * directory no client will ever see a partially written file.
         */
        File fcInfoFile = getFcInfoFile();
        File dir = fcInfoFile.getParentFile();
        dir.mkdirs();
        File tempFile = File.createTempFile("fcinfo", null, dir);
        FileOutputStream fos = new FileOutputStream(tempFile);
        props.store(fos,
                  "JDK Font Configuration Generated File: *Do Not Edit*");
        fos.close();
        boolean renamed = tempFile.renameTo(fcInfoFile);
        if (!renamed && FontUtilities.debugFonts()) {
            System.out.println("rename failed");
            warning("Failed renaming file to "+ getFcInfoFile());
        }
    } catch (Exception e) {
        if (FontUtilities.debugFonts()) {
            warning("IOException writing to "+ getFcInfoFile());
        }
    }
}
项目:OLD-OpenJDK8    文件:FcFontConfiguration.java   
private void writeFcInfo() {
    Properties props = new Properties();
    props.setProperty("version", fileVersion);
    X11FontManager fm = (X11FontManager) fontManager;
    FontConfigManager fcm = fm.getFontConfigManager();
    FontConfigInfo fcInfo = fcm.getFontConfigInfo();
    props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
    if (fcInfo.cacheDirs != null) {
        for (int i=0;i<fcInfo.cacheDirs.length;i++) {
            if (fcInfo.cacheDirs[i] != null) {
               props.setProperty("cachedir."+i,  fcInfo.cacheDirs[i]);
            }
        }
    }
    for (int i=0; i<fcCompFonts.length; i++) {
        FcCompFont fci = fcCompFonts[i];
        String styleKey = fci.jdkName+"."+fci.style;
        props.setProperty(styleKey+".length",
                          Integer.toString(fci.allFonts.length));
        for (int j=0; j<fci.allFonts.length; j++) {
            props.setProperty(styleKey+"."+j+".family",
                              fci.allFonts[j].familyName);
            props.setProperty(styleKey+"."+j+".file",
                              fci.allFonts[j].fontFile);
        }
    }
    try {
        /* This writes into a temp file then renames when done.
         * Since the rename is an atomic action within the same
         * directory no client will ever see a partially written file.
         */
        File fcInfoFile = getFcInfoFile();
        File dir = fcInfoFile.getParentFile();
        dir.mkdirs();
        File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
        FileOutputStream fos = new FileOutputStream(tempFile);
        props.store(fos,
                  "JDK Font Configuration Generated File: *Do Not Edit*");
        fos.close();
        boolean renamed = tempFile.renameTo(fcInfoFile);
        if (!renamed && FontUtilities.debugFonts()) {
            System.out.println("rename failed");
            warning("Failed renaming file to "+ getFcInfoFile());
        }
    } catch (Exception e) {
        if (FontUtilities.debugFonts()) {
            warning("IOException writing to "+ getFcInfoFile());
        }
    }
}
项目:openjdk-jdk7u-jdk    文件:FcFontConfiguration.java   
private void writeFcInfo() {
    Properties props = new Properties();
    props.setProperty("version", fileVersion);
    X11FontManager fm = (X11FontManager) fontManager;
    FontConfigManager fcm = fm.getFontConfigManager();
    FontConfigInfo fcInfo = fcm.getFontConfigInfo();
    props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
    if (fcInfo.cacheDirs != null) {
        for (int i=0;i<fcInfo.cacheDirs.length;i++) {
            if (fcInfo.cacheDirs[i] != null) {
               props.setProperty("cachedir."+i,  fcInfo.cacheDirs[i]);
            }
        }
    }
    for (int i=0; i<fcCompFonts.length; i++) {
        FcCompFont fci = fcCompFonts[i];
        String styleKey = fci.jdkName+"."+fci.style;
        props.setProperty(styleKey+".length",
                          Integer.toString(fci.allFonts.length));
        for (int j=0; j<fci.allFonts.length; j++) {
            props.setProperty(styleKey+"."+j+".family",
                              fci.allFonts[j].familyName);
            props.setProperty(styleKey+"."+j+".file",
                              fci.allFonts[j].fontFile);
        }
    }
    try {
        /* This writes into a temp file then renames when done.
         * Since the rename is an atomic action within the same
         * directory no client will ever see a partially written file.
         */
        File fcInfoFile = getFcInfoFile();
        File dir = fcInfoFile.getParentFile();
        dir.mkdirs();
        File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
        FileOutputStream fos = new FileOutputStream(tempFile);
        props.store(fos,
                  "JDK Font Configuration Generated File: *Do Not Edit*");
        fos.close();
        boolean renamed = tempFile.renameTo(fcInfoFile);
        if (!renamed && FontUtilities.debugFonts()) {
            System.out.println("rename failed");
            warning("Failed renaming file to "+ getFcInfoFile());
        }
    } catch (Exception e) {
        if (FontUtilities.debugFonts()) {
            warning("IOException writing to "+ getFcInfoFile());
        }
    }
}
项目:openjdk-icedtea7    文件:FcFontConfiguration.java   
private void writeFcInfo() {
    Properties props = new Properties();
    props.setProperty("version", fileVersion);
    X11FontManager fm = (X11FontManager) fontManager;
    FontConfigManager fcm = fm.getFontConfigManager();
    FontConfigInfo fcInfo = fcm.getFontConfigInfo();
    props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
    if (fcInfo.cacheDirs != null) {
        for (int i=0;i<fcInfo.cacheDirs.length;i++) {
            if (fcInfo.cacheDirs[i] != null) {
               props.setProperty("cachedir."+i,  fcInfo.cacheDirs[i]);
            }
        }
    }
    for (int i=0; i<fcCompFonts.length; i++) {
        FcCompFont fci = fcCompFonts[i];
        String styleKey = fci.jdkName+"."+fci.style;
        props.setProperty(styleKey+".length",
                          Integer.toString(fci.allFonts.length));
        for (int j=0; j<fci.allFonts.length; j++) {
            props.setProperty(styleKey+"."+j+".family",
                              fci.allFonts[j].familyName);
            props.setProperty(styleKey+"."+j+".file",
                              fci.allFonts[j].fontFile);
        }
    }
    try {
        /* This writes into a temp file then renames when done.
         * Since the rename is an atomic action within the same
         * directory no client will ever see a partially written file.
         */
        File fcInfoFile = getFcInfoFile();
        File dir = fcInfoFile.getParentFile();
        dir.mkdirs();
        File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
        FileOutputStream fos = new FileOutputStream(tempFile);
        props.store(fos,
                  "JDK Font Configuration Generated File: *Do Not Edit*");
        fos.close();
        boolean renamed = tempFile.renameTo(fcInfoFile);
        if (!renamed && FontUtilities.debugFonts()) {
            System.out.println("rename failed");
            warning("Failed renaming file to "+ getFcInfoFile());
        }
    } catch (Exception e) {
        if (FontUtilities.debugFonts()) {
            warning("IOException writing to "+ getFcInfoFile());
        }
    }
}