mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Analyze fonts in the background to identify ones that are causing
slowness when editing 'Label' components and skip font preview for them to optimize performance
This commit is contained in:
@@ -3366,6 +3366,10 @@
|
|||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Added 'Neutrik Jack' component based on Neutrik NMJx series. Mono/Stereo and PCB/Panel mount options are available</description>
|
<description>Added 'Neutrik Jack' component based on Neutrik NMJx series. Mono/Stereo and PCB/Panel mount options are available</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Analyze fonts in the background to identify ones that are causing slowness when editing 'Label' components and skip font preview for them to optimize performance</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>Improved performance of the application when using dashed and dotted style for 'Hookup Wire' component</description>
|
<description>Improved performance of the application when using dashed and dotted style for 'Hookup Wire' component</description>
|
||||||
|
|||||||
Binary file not shown.
@@ -17,11 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.diylc;
|
package org.diylc;
|
||||||
|
|
||||||
import java.awt.Font;
|
|
||||||
import java.awt.FontFormatException;
|
|
||||||
import java.awt.GraphicsEnvironment;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -29,7 +25,6 @@ import java.util.Properties;
|
|||||||
|
|
||||||
import javax.activity.InvalidActivityException;
|
import javax.activity.InvalidActivityException;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
@@ -45,8 +40,7 @@ import org.diylc.presenter.Presenter;
|
|||||||
import org.diylc.serialization.ProjectFileManager;
|
import org.diylc.serialization.ProjectFileManager;
|
||||||
import org.diylc.swing.gui.MainFrame;
|
import org.diylc.swing.gui.MainFrame;
|
||||||
import org.diylc.swing.gui.TemplateDialog;
|
import org.diylc.swing.gui.TemplateDialog;
|
||||||
import org.diylc.swingframework.FontChooserComboBox;
|
import org.diylc.swingframework.fonts.FontOptimizer;
|
||||||
import org.diylc.utils.ResourceLoader;
|
|
||||||
|
|
||||||
import com.apple.eawt.AppEvent;
|
import com.apple.eawt.AppEvent;
|
||||||
import com.apple.eawt.Application;
|
import com.apple.eawt.Application;
|
||||||
@@ -149,34 +143,10 @@ public class DIYLCStarter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
LOG.debug("Starting font pre-loading");
|
FontOptimizer.run(ConfigurationManager.getInstance());
|
||||||
|
|
||||||
File[] fonts = ResourceLoader.getFiles("fonts");
|
|
||||||
|
|
||||||
if (fonts != null)
|
|
||||||
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();
|
|
||||||
box.paint(p.getGraphics());
|
|
||||||
LOG.debug("Finished font pre-loading");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
fontThread.setPriority(Thread.MIN_PRIORITY);
|
||||||
fontThread.start();
|
fontThread.start();
|
||||||
|
|
||||||
String val = System.getProperty(SCRIPT_RUN);
|
String val = System.getProperty(SCRIPT_RUN);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
DIY Layout Creator (DIYLC).
|
O DIY Layout Creator (DIYLC).
|
||||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||||
|
|
||||||
This file is part of DIYLC.
|
This file is part of DIYLC.
|
||||||
@@ -21,16 +21,16 @@
|
|||||||
*/
|
*/
|
||||||
package org.diylc.swing.gui.editor;
|
package org.diylc.swing.gui.editor;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.event.ItemEvent;
|
import java.awt.event.ItemEvent;
|
||||||
import java.awt.event.ItemListener;
|
import java.awt.event.ItemListener;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
|
|
||||||
import org.diylc.common.PropertyWrapper;
|
import org.diylc.common.PropertyWrapper;
|
||||||
import org.diylc.swingframework.FontChooserComboBox;
|
import org.diylc.swingframework.fonts.FontChooserComboBox;
|
||||||
import org.diylc.utils.Constants;
|
import org.diylc.utils.Constants;
|
||||||
|
|
||||||
public class FontEditor extends FontChooserComboBox {
|
public class FontEditor extends FontChooserComboBox {
|
||||||
|
|||||||
Reference in New Issue
Block a user