MCPcopy Index your code
hub / github.com/processing/processing / build

Method build

app/src/processing/app/tools/CreateFont.java:328–371  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

326
327
328 public void build() {
329 int fontsize = 0;
330 try {
331 fontsize = Integer.parseInt(sizeSelector.getText().trim());
332 } catch (NumberFormatException e) { }
333
334 if (fontsize <= 0) {
335 JOptionPane.showMessageDialog(this, "Bad font size, try again.",
336 "Badness", JOptionPane.WARNING_MESSAGE);
337 return;
338 }
339
340 String filename = filenameField.getText().trim();
341 if (filename.length() == 0) {
342 JOptionPane.showMessageDialog(this, "Enter a file name for the font.",
343 "Lameness", JOptionPane.WARNING_MESSAGE);
344 return;
345 }
346 if (!filename.endsWith(".vlw")) {
347 filename += ".vlw";
348 }
349
350 try {
351 Font instance = table.get(list[selection]);
352 font = instance.deriveFont(Font.PLAIN, fontsize);
353 //PFont f = new PFont(font, smooth, all ? null : PFont.CHARSET);
354 PFont f = new PFont(font, smooth, charSelector.getCharacters());
355
356 // the editor may have changed while the window was open
357 Editor editor = base.getActiveEditor();
358 // make sure the 'data' folder exists
359 File folder = editor.getSketch().prepareDataFolder();
360 f.save(new FileOutputStream(new File(folder, filename)));
361
362 } catch (IOException e) {
363 JOptionPane.showMessageDialog(CreateFont.this,
364 "An error occurred while creating font.",
365 "No font for you",
366 JOptionPane.WARNING_MESSAGE);
367 e.printStackTrace();
368 }
369
370 setVisible(false);
371 }
372
373
374// /**

Callers 1

actionPerformedMethod · 0.95

Calls 11

getSketchMethod · 0.95
saveMethod · 0.95
parseIntMethod · 0.80
getCharactersMethod · 0.80
getActiveEditorMethod · 0.80
prepareDataFolderMethod · 0.80
getMethod · 0.65
setVisibleMethod · 0.65
trimMethod · 0.45
getTextMethod · 0.45
printStackTraceMethod · 0.45

Tested by

no test coverage detected