From 4cb1d142c84211d7eac9b4a7ed86c7a448da32a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= <34514239+appgurueu@users.noreply.github.com> Date: Sun, 23 Sep 2018 21:35:44 +0200 Subject: [PATCH] Add files via upload --- GenerateLetters.java | 59 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 GenerateLetters.java diff --git a/GenerateLetters.java b/GenerateLetters.java new file mode 100644 index 0000000..c5a0679 --- /dev/null +++ b/GenerateLetters.java @@ -0,0 +1,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])); + } + +}