mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
add default fonts
This commit is contained in:
@@ -53,7 +53,7 @@ public class Project implements Serializable {
|
||||
public static Size DEFAULT_WIDTH = new Size(29d, SizeUnit.cm);
|
||||
public static Size DEFAULT_HEIGHT = new Size(21d, SizeUnit.cm);
|
||||
public static Size DEFAULT_GRID_SPACING = new Size(0.1d, SizeUnit.in);
|
||||
public static Font DEFAULT_FONT = new Font("Tahoma", Font.PLAIN, 14);
|
||||
public static Font DEFAULT_FONT = new Font("Square721 BT", Font.PLAIN, 14);
|
||||
|
||||
private VersionNumber fileVersion;
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -18,11 +18,15 @@
|
||||
package org.diylc;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontFormatException;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Point;
|
||||
import java.awt.SplashScreen;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -118,8 +122,26 @@ public class DIYLCStarter {
|
||||
Thread fontThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
public void run() {
|
||||
LOG.debug("Starting font pre-loading");
|
||||
|
||||
File dir = new File("fonts");
|
||||
File[] fonts = dir.listFiles();
|
||||
|
||||
for (int i = 0; i < fonts.length; i++) {
|
||||
try {
|
||||
LOG.info("Dynamically loading font: " + fonts[i].getName());
|
||||
Font customFont = Font.createFont(Font.TRUETYPE_FONT, new File(fonts[i].getAbsolutePath())).deriveFont(12f);
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
// register the font
|
||||
ge.registerFont(customFont);
|
||||
} catch (IOException e) {
|
||||
LOG.error("Could not load font", e);
|
||||
} catch (FontFormatException e) {
|
||||
LOG.error("Font format error", e);
|
||||
}
|
||||
}
|
||||
|
||||
FontChooserComboBox box = new FontChooserComboBox();
|
||||
box.getPreferredSize();
|
||||
JPanel p = new JPanel();
|
||||
|
||||
Reference in New Issue
Block a user