From 309f0597eb46ee6545fe0ba9a2f3c4cd92d35758 Mon Sep 17 00:00:00 2001 From: benfry Date: Sat, 19 Jan 2013 20:47:58 +0000 Subject: [PATCH] modify font tool to read from local dir --- app/src/processing/app/tools/CreateFont.java | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/app/src/processing/app/tools/CreateFont.java b/app/src/processing/app/tools/CreateFont.java index d5cea13ba..95f64850b 100644 --- a/app/src/processing/app/tools/CreateFont.java +++ b/app/src/processing/app/tools/CreateFont.java @@ -116,6 +116,34 @@ public class CreateFont extends JFrame implements Tool { GraphicsEnvironment.getLocalGraphicsEnvironment(); Font fonts[] = ge.getAllFonts(); + + if (false) { + ArrayList fontList = new ArrayList(); + File folderList = new File("/Users/fry/coconut/sys/fonts/web"); + for (File folder : folderList.listFiles()) { + if (folder.isDirectory()) { + File[] items = folder.listFiles(new FilenameFilter() { + public boolean accept(File dir, String name) { + if (name.charAt(0) == '.') return false; + return (name.toLowerCase().endsWith(".ttf") || + name.toLowerCase().endsWith(".otf")); + } + }); + for (File fontFile : items) { + try { + Font font = Font.createFont(Font.TRUETYPE_FONT, new FileInputStream(fontFile)); + fontList.add(font); + + } catch (Exception e) { + System.out.println("Ignoring " + fontFile.getName()); + } + } + } + } +// fonts = new Font[fontList.size()]; +// fontList.toArray(fonts); + fonts = fontList.toArray(new Font[fontList.size()]); + } String flist[] = new String[fonts.length]; table = new HashMap();