- remove spaces from font names

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7112 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 14 years ago
parent 2617a973d5
commit 64f3a1005d
  1. 40
      sdk/jme3-angelfont/src/com/jme3/gde/angelfont/AngelFontVisualPanel1.form
  2. 23
      sdk/jme3-angelfont/src/com/jme3/gde/angelfont/AngelFontVisualPanel1.java
  3. 2
      sdk/jme3-angelfont/src/com/jme3/gde/angelfont/AngelFontWizardIterator.java
  4. 10
      sdk/jme3-angelfont/src/com/jme3/gde/angelfont/FontCreator.java

@ -19,14 +19,14 @@
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane1" min="-2" pref="154" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" pref="236" max="32767" attributes="0"/>
<Component id="jPanel1" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="300" max="32767" attributes="0"/>
<Component id="jLabel1" alignment="0" pref="300" max="32767" attributes="0"/>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
@ -56,12 +56,40 @@
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel1">
<Container class="javax.swing.JPanel" name="jPanel1">
<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.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="0" type="rgb"/>
</Property>
</Properties>
</Component>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" alignment="0" pref="236" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" alignment="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="0" type="rgb"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/angelfont/Bundle.properties" key="AngelFontVisualPanel1.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

@ -39,6 +39,7 @@ public final class AngelFontVisualPanel1 extends JPanel {
jScrollPane1 = new javax.swing.JScrollPane();
jList1 = new javax.swing.JList();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jList1.setModel(new javax.swing.AbstractListModel() {
@ -53,8 +54,23 @@ public final class AngelFontVisualPanel1 extends JPanel {
});
jScrollPane1.setViewportView(jList1);
jPanel1.setBackground(new java.awt.Color(0, 0, 0));
jLabel1.setBackground(new java.awt.Color(0, 0, 0));
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
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)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -62,22 +78,23 @@ public final class AngelFontVisualPanel1 extends JPanel {
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
private void updateFont(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_updateFont
jLabel1.setIcon(new ImageIcon(FontCreator.buildFont((String) jList1.getSelectedValue())));
jLabel1.setIcon(new ImageIcon(FontCreator.buildFont((String) jList1.getSelectedValue(), 256)));
selectedFont = (String) jList1.getSelectedValue();
}//GEN-LAST:event_updateFont
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JList jList1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}

@ -95,7 +95,7 @@ public final class AngelFontWizardIterator implements WizardDescriptor.Instantia
}
outputFile = FileUtil.toFile(pm.getAssetFolder().getFileObject("Interface/Fonts"));
if (!outputFile.getName().endsWith(".png")) {
outputFile = new File(outputFile.getAbsoluteFile() + File.separator + name + ".png");
outputFile = new File(outputFile.getAbsoluteFile() + File.separator + name.replaceAll(" ", "") + ".png");
}
// write png file
ImageIO.write(fontImage, "PNG", outputFile);

@ -25,14 +25,17 @@ public abstract class FontCreator {
}
public static BufferedImage buildFont(String fontName) {
return buildFont(fontName, 63);
return buildFont(fontName, 512);
}
public static BufferedImage buildFont(String fontName, int offset) {
public static BufferedImage buildFont(String fontName, int bitmapSize) {
return buildFont(fontName, bitmapSize, 63);
}
public static BufferedImage buildFont(String fontName, int bitmapSize, int offset) {
BufferedImage fontImage;
Font font;
int bitmapSize = 512; // set the size for the bitmap texture
boolean sizeFound = false;
boolean directionSet = false;
int delta = 0;
@ -134,5 +137,4 @@ public abstract class FontCreator {
// System.out.println(charLocs);
return fontImage;
}
}

Loading…
Cancel
Save