Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.awt.Font;
- import java.awt.GraphicsEnvironment;
- public class myFontCheck {
- public static void main(String[] args) {
- Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
- for (int i = 0; i < fonts.length; i++) {
- final Font font = fonts[i];
- final String name = font.getFontName();
- if (font.canDisplay('a') &&
- font.canDisplay('z') &&
- font.canDisplay('A') &&
- font.canDisplay('Z') &&
- font.canDisplay('0') &&
- font.canDisplay('1')) {
- //System.out.println(" OK.");
- } else {
- File file = new File("c:\Windows\Fonts\" + name + ".ttf");
- if(file.exists()) {
- System.out.println("Bad Font: " + name);
- file.delete();
- }
- }
- }
- }
- }
- if (font.canDisplay('a') &&
- font.canDisplay('z') &&
- font.canDisplay('A') &&
- font.canDisplay('Z') &&
- font.canDisplay('0') &&
- font.canDisplay('1')) {
- //System.out.println(" OK.");
- } else {
- System.out.println("Bad Font: " + name);
- File file = new File("c:\Windows\Fonts\" + name + ".ttf");
- file.delete();
- }
- } else {
- System.out.println("Bad Font: " + name);
- String fn = "c:\Windows\Fonts\" + name + ".ttf";
- System.out.println("Trying to delete: " + fn);
- File file = new File(fn);
- file.delete();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement