JDK : Font Creator

- added support for horizontal and vertical padding
- added support for letter spacing
- added a field to change the file name
- redisigned the UI a bit

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9109 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 13 years ago
parent 26665e5df0
commit edc7a8b37c
  1. 22
      sdk/jme3-angelfont/src/com/jme3/gde/angelfont/AngelFontVisualPanel1.form
  2. 17
      sdk/jme3-angelfont/src/com/jme3/gde/angelfont/AngelFontVisualPanel1.java
  3. 293
      sdk/jme3-angelfont/src/com/jme3/gde/angelfont/AngelFontVisualPanel2.form
  4. 242
      sdk/jme3-angelfont/src/com/jme3/gde/angelfont/AngelFontVisualPanel2.java
  5. 16
      sdk/jme3-angelfont/src/com/jme3/gde/angelfont/AngelFontWizardIterator.java
  6. 5
      sdk/jme3-angelfont/src/com/jme3/gde/angelfont/AngelFontWizardPanel2.java
  7. 20
      sdk/jme3-angelfont/src/com/jme3/gde/angelfont/Bundle.properties
  8. 24
      sdk/jme3-angelfont/src/com/jme3/gde/angelfont/FontCreator.java

@ -25,7 +25,7 @@
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="300" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="338" max="32767" attributes="0"/>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
@ -66,12 +66,21 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" alignment="0" pref="236" max="32767" attributes="0"/>
<Component id="jLabel1" alignment="0" pref="341" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="279" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" alignment="0" pref="300" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" pref="313" max="-2" attributes="0"/>
<EmptySpace pref="11" max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
@ -89,6 +98,13 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel1.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>

@ -41,6 +41,7 @@ public final class AngelFontVisualPanel1 extends JPanel {
jList1 = new javax.swing.JList();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jList1.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
@ -60,15 +61,24 @@ public final class AngelFontVisualPanel1 extends JPanel {
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel1.class, "AngelFontVisualPanel1.jLabel1.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel1.class, "AngelFontVisualPanel1.jLabel2.text")); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addComponent(jLabel2)
.addContainerGap(279, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 313, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
.addComponent(jLabel2))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
@ -82,7 +92,7 @@ public final class AngelFontVisualPanel1 extends JPanel {
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 338, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
@ -93,6 +103,7 @@ public final class AngelFontVisualPanel1 extends JPanel {
}//GEN-LAST:event_updateFont
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JList jList1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;

@ -1,6 +1,15 @@
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</NonVisualComponents>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
@ -16,16 +25,23 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jToolBar1" alignment="1" pref="441" max="32767" attributes="0"/>
<Component id="jPanel1" alignment="0" pref="441" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="jPanel3" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jPanel1" alignment="0" pref="531" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jPanel1" pref="307" max="32767" attributes="0"/>
<Component id="jPanel1" pref="404" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jToolBar1" min="-2" pref="25" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jPanel2" max="32767" attributes="1"/>
<Component id="jPanel3" alignment="0" max="32767" attributes="1"/>
</Group>
</Group>
</Group>
</DimensionLayout>
@ -49,14 +65,240 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JToolBar" name="jToolBar1">
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="floatable" type="boolean" value="false"/>
<Property name="rollover" type="boolean" value="true"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Image">
<ResourceString PropertyName="titleX" bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jPanel2.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</TitledBorder>
</Border>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel2" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="0" min="-2" pref="52" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jSpinner3" pref="156" max="32767" attributes="1"/>
<Group type="103" alignment="1" groupAlignment="0" max="-2" attributes="0">
<Component id="jSpinner2" alignment="0" max="32767" attributes="1"/>
<Component id="jTextField1" alignment="1" pref="156" max="32767" attributes="1"/>
</Group>
<Component id="jSpinner4" alignment="1" pref="156" max="32767" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="45" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jSpinner2" alignment="3" min="-2" pref="23" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jSpinner3" alignment="3" min="-2" pref="23" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jSpinner4" alignment="3" min="-2" pref="23" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jLabel7.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jTextField1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jTextField1.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jLabel8.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner2">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="256" minimum="64" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jSpinner2.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="updateImageSize"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jLabel4.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner3">
<Properties>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jSpinner3.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="updatePaddingX"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jLabel5.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner4">
<Properties>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jSpinner4.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="updatePaddingY"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Font">
<ResourceString PropertyName="titleX" bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jPanel3.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</TitledBorder>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel11" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel9" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jSpinner1" alignment="1" pref="78" max="32767" attributes="1"/>
<Component id="jLabel10" alignment="0" pref="78" max="32767" attributes="0"/>
<Component id="jComboBox1" alignment="1" pref="78" max="32767" attributes="0"/>
<Component id="jSpinner5" alignment="0" pref="78" max="32767" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel10" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jComboBox1" alignment="3" min="-2" pref="23" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jSpinner1" alignment="3" min="-2" pref="23" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="7" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jSpinner5" alignment="3" min="-2" pref="23" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner1">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="16" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jSpinner1.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="updateFontSize"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox1">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
@ -67,43 +309,50 @@
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jComboBox1.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jLabel6.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner1">
<Component class="javax.swing.JLabel" name="jLabel9">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="16" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jLabel9.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="updateFontSize"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Component class="javax.swing.JLabel" name="jLabel10">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jLabel10.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner2">
<Component class="javax.swing.JLabel" name="jLabel11">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="256" minimum="64" numberType="java.lang.Integer" stepSize="1" type="number"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jLabel11.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner5">
<Properties>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel2.jSpinner5.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="updateImageSize"/>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="letterSpacingUpdate"/>
</Events>
</Component>
</SubComponents>

@ -13,6 +13,10 @@ public final class AngelFontVisualPanel2 extends JPanel {
String fontName = "";
int fontSize = 16;
int imageSize = 256;
int paddingX = 0;
int paddingY = 0;
int letterSpacing = 0;
String fileName = "";
int style = Font.PLAIN;
/** Creates new form AngelFontVisualPanel2 */
@ -22,6 +26,7 @@ public final class AngelFontVisualPanel2 extends JPanel {
jComboBox1.addItem("PLAIN");
jComboBox1.addItem("ITALIC");
jComboBox1.addItem("BOLD");
}
@Override
@ -31,11 +36,17 @@ public final class AngelFontVisualPanel2 extends JPanel {
public void setFont(String name) {
this.fontName = name;
jTextField1.setText(fontName);
jLabel10.setText(fontName);
updateFont();
}
public String getFileName() {
return jTextField1.getText();
}
private void updateFont() {
jLabel3.setIcon(new ImageIcon(FontCreator.buildFont(fontName, imageSize, fontSize, style, true).getImage()));
jLabel3.setIcon(new ImageIcon(FontCreator.buildFont(fontName, getFileName(), imageSize, fontSize, style, paddingX, paddingY, letterSpacing, true).getImage()));
jLabel3.repaint();
jPanel1.repaint();
}
@ -48,14 +59,30 @@ public final class AngelFontVisualPanel2 extends JPanel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jToolBar1 = new javax.swing.JToolBar();
jComboBox1 = new javax.swing.JComboBox();
jLabel1 = new javax.swing.JLabel();
jSpinner1 = new javax.swing.JSpinner();
jPanel2 = new javax.swing.JPanel();
jLabel7 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jSpinner2 = new javax.swing.JSpinner();
jLabel4 = new javax.swing.JLabel();
jSpinner3 = new javax.swing.JSpinner();
jLabel5 = new javax.swing.JLabel();
jSpinner4 = new javax.swing.JSpinner();
jPanel3 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jSpinner1 = new javax.swing.JSpinner();
jComboBox1 = new javax.swing.JComboBox();
jLabel6 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jSpinner5 = new javax.swing.JSpinner();
org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jButton1.text")); // NOI18N
jPanel1.setBackground(new java.awt.Color(0, 0, 0));
jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.LINE_AXIS));
@ -63,52 +90,187 @@ public final class AngelFontVisualPanel2 extends JPanel {
org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jLabel3.text")); // NOI18N
jPanel1.add(jLabel3);
jToolBar1.setFloatable(false);
jToolBar1.setRollover(true);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jPanel2.border.title"))); // NOI18N
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jLabel7.text")); // NOI18N
jTextField1.setText(org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jTextField1.text")); // NOI18N
jTextField1.setToolTipText(org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jTextField1.toolTipText")); // NOI18N
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox1ActionPerformed(evt);
jTextField1ActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jLabel8.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jLabel2.text")); // NOI18N
jSpinner2.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(256), Integer.valueOf(64), null, Integer.valueOf(1)));
jSpinner2.setToolTipText(org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jSpinner2.toolTipText")); // NOI18N
jSpinner2.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
updateImageSize(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jLabel4.text")); // NOI18N
jSpinner3.setToolTipText(org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jSpinner3.toolTipText")); // NOI18N
jSpinner3.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
updatePaddingX(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jLabel5.text")); // NOI18N
jSpinner4.setToolTipText(org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jSpinner4.toolTipText")); // NOI18N
jSpinner4.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
updatePaddingY(evt);
}
});
jToolBar1.add(jComboBox1);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addComponent(jLabel5)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jSpinner3, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jSpinner2)
.addComponent(jTextField1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE))
.addComponent(jSpinner4, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel8)
.addGap(45, 45, 45))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jSpinner3, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jSpinner4, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jPanel3.border.title"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jLabel1.text")); // NOI18N
jToolBar1.add(jLabel1);
jSpinner1.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(16), Integer.valueOf(1), null, Integer.valueOf(1)));
jSpinner1.setToolTipText(org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jSpinner1.toolTipText")); // NOI18N
jSpinner1.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
updateFontSize(evt);
}
});
jToolBar1.add(jSpinner1);
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jLabel2.text")); // NOI18N
jToolBar1.add(jLabel2);
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox1.setToolTipText(org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jComboBox1.toolTipText")); // NOI18N
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox1ActionPerformed(evt);
}
});
jSpinner2.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(256), Integer.valueOf(64), null, Integer.valueOf(1)));
jSpinner2.addChangeListener(new javax.swing.event.ChangeListener() {
org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jLabel6.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel9, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jLabel9.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel10, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jLabel10.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel11, org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jLabel11.text")); // NOI18N
jSpinner5.setToolTipText(org.openide.util.NbBundle.getMessage(AngelFontVisualPanel2.class, "AngelFontVisualPanel2.jSpinner5.toolTipText")); // NOI18N
jSpinner5.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
updateImageSize(evt);
letterSpacingUpdate(evt);
}
});
jToolBar1.add(jSpinner2);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel11)
.addComponent(jLabel9)
.addComponent(jLabel1)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSpinner1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
.addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
.addComponent(jComboBox1, javax.swing.GroupLayout.Alignment.TRAILING, 0, 78, Short.MAX_VALUE)
.addComponent(jSpinner5, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE))
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(jLabel10))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel11)
.addComponent(jSpinner5, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jToolBar1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 441, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 441, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
}// </editor-fold>//GEN-END:initComponents
@ -132,14 +294,46 @@ public final class AngelFontVisualPanel2 extends JPanel {
}
updateFont();
}//GEN-LAST:event_jComboBox1ActionPerformed
private void updatePaddingX(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_updatePaddingX
paddingX = (Integer) jSpinner3.getValue();
updateFont();
}//GEN-LAST:event_updatePaddingX
private void updatePaddingY(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_updatePaddingY
paddingY = (Integer) jSpinner4.getValue();
updateFont();
}//GEN-LAST:event_updatePaddingY
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
fileName = jTextField1.getText();
}//GEN-LAST:event_jTextField1ActionPerformed
private void letterSpacingUpdate(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_letterSpacingUpdate
letterSpacing = (Integer) jSpinner5.getValue();
}//GEN-LAST:event_letterSpacingUpdate
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JSpinner jSpinner1;
private javax.swing.JSpinner jSpinner2;
private javax.swing.JToolBar jToolBar1;
private javax.swing.JSpinner jSpinner3;
private javax.swing.JSpinner jSpinner4;
private javax.swing.JSpinner jSpinner5;
private javax.swing.JTextField jTextField1;
// End of variables declaration//GEN-END:variables
}

@ -77,17 +77,23 @@ public final class AngelFontWizardIterator implements WizardDescriptor.Instantia
*/
@SuppressWarnings("unchecked")
public Set<FileObject> instantiate() throws IOException {
String name = (String) wizard.getProperty("font_name");
String fontName = (String) wizard.getProperty("font_name");
String fileName = (String) wizard.getProperty("file_name");
int fontSize = (Integer) wizard.getProperty("font_size");
int imageSize = (Integer) wizard.getProperty("image_size");
int style = (Integer) wizard.getProperty("font_style");
int paddingX = (Integer) wizard.getProperty("padding_x");
int paddingY = (Integer) wizard.getProperty("padding_y");
int letterSpacing = (Integer) wizard.getProperty("letter_spacing");
Project project = (Project) wizard.getProperty("project");
ProjectAssetManager pm = project.getLookup().lookup(ProjectAssetManager.class);
if (pm == null) {
Logger.getLogger(AngelFontWizardIterator.class.getName()).log(Level.WARNING, "No ProjectAssetManager found!");
return Collections.EMPTY_SET;
}
AngelFont font = FontCreator.buildFont(name, imageSize, fontSize, style);
AngelFont font = FontCreator.buildFont(fontName, fileName, imageSize, fontSize, style, paddingX, paddingY, letterSpacing, false);
BufferedImage fontImage = font.getImage();
ByteBuffer scratch = ByteBuffer.allocateDirect(4 * fontImage.getWidth() * fontImage.getHeight());
byte[] data = (byte[]) fontImage.getRaster().getDataElements(0, 0,
@ -95,17 +101,17 @@ public final class AngelFontWizardIterator implements WizardDescriptor.Instantia
scratch.clear();
scratch.put(data);
scratch.rewind();
name = name.replaceAll(" ", "");
fileName = fileName.replaceAll(" ", "");
FileObject imageFile;
FileObject descriptionFile;
try {
//create PNG file
imageFile = FileUtil.createData(pm.getAssetFolder(), "Interface/Fonts/" + name + ".png");
imageFile = FileUtil.createData(pm.getAssetFolder(), "Interface/Fonts/" + fileName + ".png");
OutputStream out = imageFile.getOutputStream();
ImageIO.write(fontImage, "PNG", out);
out.close();
//create fnt file
descriptionFile = FileUtil.createData(pm.getAssetFolder(), "Interface/Fonts/" + name + ".fnt");
descriptionFile = FileUtil.createData(pm.getAssetFolder(), "Interface/Fonts/" + fileName + ".fnt");
OutputStreamWriter out2 = new OutputStreamWriter(descriptionFile.getOutputStream());
out2.write(font.getDescription());
out2.close();

@ -86,5 +86,10 @@ public class AngelFontWizardPanel2 implements WizardDescriptor.Panel {
((WizardDescriptor)settings).putProperty("font_style", component.style);
((WizardDescriptor)settings).putProperty("font_size", component.fontSize);
((WizardDescriptor)settings).putProperty("image_size", component.imageSize);
((WizardDescriptor)settings).putProperty("file_name", component.getFileName());
((WizardDescriptor)settings).putProperty("padding_x", component.paddingX);
((WizardDescriptor)settings).putProperty("padding_y", component.paddingY);
((WizardDescriptor)settings).putProperty("letter_spacing", component.letterSpacing);
}
}

@ -8,3 +8,23 @@ AngelFontVisualPanel1.jLabel1.text=
AngelFontVisualPanel2.jLabel1.text=Font Size:
AngelFontVisualPanel2.jLabel2.text=Image Size:
AngelFontVisualPanel2.jLabel3.text=jLabel3
AngelFontVisualPanel2.jLabel4.text=Padding-x:
AngelFontVisualPanel2.jLabel5.text=Padding-y:
AngelFontVisualPanel1.jLabel2.text=jLabel2
AngelFontVisualPanel2.jPanel3.border.title=Font
AngelFontVisualPanel2.jButton1.text=jButton1
AngelFontVisualPanel2.jLabel6.text=Font style:
AngelFontVisualPanel2.jPanel2.border.title=Image
AngelFontVisualPanel2.jLabel7.text=file name:
AngelFontVisualPanel2.jTextField1.text=jTextField1
AngelFontVisualPanel2.jLabel8.text=.fnt / .png
AngelFontVisualPanel2.jLabel9.text=Font name:
AngelFontVisualPanel2.jLabel10.text=jLabel10
AngelFontVisualPanel2.jSpinner3.toolTipText=Defines the horizontal padding used for each letter cell
AngelFontVisualPanel2.jSpinner4.toolTipText=Defines the vertical padding used for each letter cell
AngelFontVisualPanel2.jLabel11.text=Letter spacing:
AngelFontVisualPanel2.jSpinner1.toolTipText=The size of the font
AngelFontVisualPanel2.jComboBox1.toolTipText=The style of the font
AngelFontVisualPanel2.jTextField1.toolTipText=The name of the generated files
AngelFontVisualPanel2.jSpinner2.toolTipText=The resulting png image size will be Image Size x Image Size
AngelFontVisualPanel2.jSpinner5.toolTipText=Defines the vertical padding used for each letter cell

@ -41,6 +41,10 @@ public abstract class FontCreator {
}
public static AngelFont buildFont(String fontName, int bitmapSize, int fontSize, int style, boolean debug) {
return buildFont(fontName, fontName, bitmapSize, fontSize, style, 0, 0, 0, debug);
}
public static AngelFont buildFont(String fontName, String fileName, int bitmapSize, int fontSize, int style, int paddingX, int paddingY, int letterSpacing, boolean debug) {
BufferedImage fontImage;
Font font;
@ -74,30 +78,30 @@ public abstract class FontCreator {
Rectangle2D bounds = fm.getStringBounds(temp, g);
height = fm.getDescent() + fm.getAscent();
if (yPos == 0) {
yPos = height;
yPos = height + (paddingY * 2);
}
if (xPos + bounds.getWidth() > bitmapSize) {
if (xPos + bounds.getWidth() + (paddingX * 2) > bitmapSize) {
xPos = 0;
yPos += height;
yPos += height + (paddingY * 2);
}
g.drawString(temp, xPos, yPos);
g.drawString(temp, xPos + paddingX, yPos + paddingY);
if (debug) {
g.setColor(Color.BLUE);
g.drawRect(xPos, yPos - fm.getAscent(), (int) bounds.getWidth(), height);
g.drawRect(xPos, yPos - fm.getAscent(), (int) bounds.getWidth() + (paddingX * 2), height + (paddingY * 2));
g.setColor(Color.WHITE);
}
charLocs = charLocs
+ "char id=" + i
+ " x=" + xPos
+ " y=" + (yPos - fm.getAscent())
+ " width=" + (int) bounds.getWidth()
+ " height=" + (int) bounds.getHeight()
+ " width=" + ((int) bounds.getWidth() + (paddingX * 2))
+ " height=" + ((int) bounds.getHeight() + (paddingY * 2))
+ " xoffset=0"
+ " yoffset=0"
+ " xadvance=" + ((int) bounds.getWidth() - 1) + " "
+ " xadvance=" + (((int) bounds.getWidth() + letterSpacing) - 1) + " "
+ " page=0"
+ " chnl=0\n";
xPos += bounds.getWidth();
xPos += bounds.getWidth() + (paddingX * 2);
}
charLocs = "info face=null "
+ "size=" + fontSize + " "
@ -118,7 +122,7 @@ public abstract class FontCreator {
+ "pages=1 "
+ "packed=0 "
+ "\n"
+ "page id=0 file=\"" + fontName.replaceAll(" ", "") + ".png\"\n"
+ "page id=0 file=\"" + fileName.replaceAll(" ", "") + ".png\"\n"
+ "chars count=255\n"
+ charLocs;
return new AngelFont(fontImage, charLocs);

Loading…
Cancel
Save