-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerateLetters.java
More file actions
59 lines (51 loc) · 1.72 KB
/
GenerateLetters.java
File metadata and controls
59 lines (51 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package generateletters;
import java.awt.Font;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JLabel;
/**
*
* @author lars
*/
public class GenerateLetters {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
// TODO code application logic here
JFrame frame=new JFrame("Fonts");
JLabel label=new JLabel("The quick brown fox jumps over the lazy dog.");
label.setFont(new Font("FreeMono",0,64));
frame.add(label);
frame.pack();
for (char c=0; c < 256; c++) {
BufferedImage img=new BufferedImage(48,64,BufferedImage.TYPE_INT_ARGB);
label.setText(c+"");
label.paint(img.createGraphics());
new File("freemono_"+(int)c+".png").createNewFile();
ImageIO.write(img, "PNG", new File("freemono_"+(int)c+".png"));
}
frame.setVisible(true);
}
}
class GenerateLetter {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
// TODO code application logic here
JLabel label=new JLabel(args[0]);
label.setFont(new Font("FreeMono",0,64));
BufferedImage img=new BufferedImage(48*args[0].length(),64,BufferedImage.TYPE_INT_ARGB);
label.paint(img.createGraphics());
ImageIO.write(img, "PNG", new File(args[1]));
}
}