Examples of UnicodeFont


Examples of com.badlogic.gdx.tools.hiero.unicodefont.UnicodeFont

  void updateFont () {
    updateFont(false);
  }

  private void updateFont (boolean ignoreFileText) {
    UnicodeFont unicodeFont;

    int fontSize = ((Integer)fontSizeSpinner.getValue()).intValue();

    File file = new File(fontFileText.getText());
    if (!ignoreFileText && file.exists() && file.isFile()) {
      // Load from file.
      fontFileRadio.setSelected(true);
      fontList.setEnabled(false);
      systemFontRadio.setEnabled(false);
      try {
        unicodeFont = new UnicodeFont(fontFileText.getText(), fontSize, boldCheckBox.isSelected(),
          italicCheckBox.isSelected());
      } catch (Throwable ex) {
        ex.printStackTrace();
        updateFont(true);
        return;
      }
    } else {
      // Load from java.awt.Font (kerning not available!).
      fontList.setEnabled(true);
      systemFontRadio.setEnabled(true);
      systemFontRadio.setSelected(true);
      unicodeFont = new UnicodeFont(Font.decode((String)fontList.getSelectedValue()), fontSize, boldCheckBox.isSelected(),
        italicCheckBox.isSelected());
    }
    unicodeFont.setPaddingTop(((Integer)padTopSpinner.getValue()).intValue());
    unicodeFont.setPaddingRight(((Integer)padRightSpinner.getValue()).intValue());
    unicodeFont.setPaddingBottom(((Integer)padBottomSpinner.getValue()).intValue());
    unicodeFont.setPaddingLeft(((Integer)padLeftSpinner.getValue()).intValue());
    unicodeFont.setPaddingAdvanceX(((Integer)padAdvanceXSpinner.getValue()).intValue());
    unicodeFont.setPaddingAdvanceY(((Integer)padAdvanceYSpinner.getValue()).intValue());
    unicodeFont.setGlyphPageWidth(((Integer)glyphPageWidthCombo.getSelectedItem()).intValue());
    unicodeFont.setGlyphPageHeight(((Integer)glyphPageHeightCombo.getSelectedItem()).intValue());
    unicodeFont.setNativeRendering(nativeRadio.isSelected());

    for (Iterator iter = effectPanels.iterator(); iter.hasNext();) {
      EffectPanel panel = (EffectPanel)iter.next();
      unicodeFont.getEffects().add(panel.getEffect());
    }

    int size = sampleTextPane.getFont().getSize();
    if (size < 14) size = 14;
    sampleTextPane.setFont(unicodeFont.getFont().deriveFont((float)size));

    this.newUnicodeFont = unicodeFont;
  }
View Full Code Here

Examples of com.badlogic.gdx.tools.hiero.unicodefont.UnicodeFont

  void updateFont () {
    updateFont(false);
  }

  private void updateFont (boolean ignoreFileText) {
    UnicodeFont unicodeFont;

    int fontSize = ((Integer)fontSizeSpinner.getValue()).intValue();

    File file = new File(fontFileText.getText());
    if (!ignoreFileText && file.exists() && file.isFile()) {
      // Load from file.
      fontFileRadio.setSelected(true);
      fontList.setEnabled(false);
      systemFontRadio.setEnabled(false);
      try {
        unicodeFont = new UnicodeFont(fontFileText.getText(), fontSize, boldCheckBox.isSelected(),
          italicCheckBox.isSelected());
      } catch (Throwable ex) {
        ex.printStackTrace();
        updateFont(true);
        return;
      }
    } else {
      // Load from java.awt.Font (kerning not available!).
      fontList.setEnabled(true);
      systemFontRadio.setEnabled(true);
      systemFontRadio.setSelected(true);
      unicodeFont = new UnicodeFont(Font.decode((String)fontList.getSelectedValue()), fontSize, boldCheckBox.isSelected(),
        italicCheckBox.isSelected());
    }
    unicodeFont.setPaddingTop(((Integer)padTopSpinner.getValue()).intValue());
    unicodeFont.setPaddingRight(((Integer)padRightSpinner.getValue()).intValue());
    unicodeFont.setPaddingBottom(((Integer)padBottomSpinner.getValue()).intValue());
    unicodeFont.setPaddingLeft(((Integer)padLeftSpinner.getValue()).intValue());
    unicodeFont.setPaddingAdvanceX(((Integer)padAdvanceXSpinner.getValue()).intValue());
    unicodeFont.setPaddingAdvanceY(((Integer)padAdvanceYSpinner.getValue()).intValue());
    unicodeFont.setGlyphPageWidth(((Integer)glyphPageWidthCombo.getSelectedItem()).intValue());
    unicodeFont.setGlyphPageHeight(((Integer)glyphPageHeightCombo.getSelectedItem()).intValue());
    unicodeFont.setNativeRendering(nativeRadio.isSelected());

    for (Iterator iter = effectPanels.iterator(); iter.hasNext();) {
      EffectPanel panel = (EffectPanel)iter.next();
      unicodeFont.getEffects().add(panel.getEffect());
    }

    int size = sampleTextPane.getFont().getSize();
    if (size < 14) size = 14;
    sampleTextPane.setFont(unicodeFont.getFont().deriveFont((float)size));

    this.newUnicodeFont = unicodeFont;
  }
View Full Code Here

Examples of com.badlogic.gdx.tools.hiero.unicodefont.UnicodeFont

  void updateFont () {
    updateFont(false);
  }

  private void updateFont (boolean ignoreFileText) {
    UnicodeFont unicodeFont;

    int fontSize = ((Integer)fontSizeSpinner.getValue()).intValue();

    File file = new File(fontFileText.getText());
    if (!ignoreFileText && file.exists() && file.isFile()) {
      // Load from file.
      fontFileRadio.setSelected(true);
      fontList.setEnabled(false);
      systemFontRadio.setEnabled(false);
      try {
        unicodeFont = new UnicodeFont(fontFileText.getText(), fontSize, boldCheckBox.isSelected(),
          italicCheckBox.isSelected());
      } catch (Throwable ex) {
        ex.printStackTrace();
        updateFont(true);
        return;
      }
    } else {
      // Load from java.awt.Font (kerning not available!).
      fontList.setEnabled(true);
      systemFontRadio.setEnabled(true);
      systemFontRadio.setSelected(true);
      unicodeFont = new UnicodeFont(Font.decode((String)fontList.getSelectedValue()), fontSize, boldCheckBox.isSelected(),
        italicCheckBox.isSelected());
    }
    unicodeFont.setPaddingTop(((Integer)padTopSpinner.getValue()).intValue());
    unicodeFont.setPaddingRight(((Integer)padRightSpinner.getValue()).intValue());
    unicodeFont.setPaddingBottom(((Integer)padBottomSpinner.getValue()).intValue());
    unicodeFont.setPaddingLeft(((Integer)padLeftSpinner.getValue()).intValue());
    unicodeFont.setPaddingAdvanceX(((Integer)padAdvanceXSpinner.getValue()).intValue());
    unicodeFont.setPaddingAdvanceY(((Integer)padAdvanceYSpinner.getValue()).intValue());
    unicodeFont.setGlyphPageWidth(((Integer)glyphPageWidthCombo.getSelectedItem()).intValue());
    unicodeFont.setGlyphPageHeight(((Integer)glyphPageHeightCombo.getSelectedItem()).intValue());
    unicodeFont.setNativeRendering(nativeRadio.isSelected());

    for (Iterator iter = effectPanels.iterator(); iter.hasNext();) {
      EffectPanel panel = (EffectPanel)iter.next();
      unicodeFont.getEffects().add(panel.getEffect());
    }

    int size = sampleTextPane.getFont().getSize();
    if (size < 14) size = 14;
    sampleTextPane.setFont(unicodeFont.getFont().deriveFont((float)size));

    this.newUnicodeFont = unicodeFont;
  }
View Full Code Here

Examples of org.newdawn.slick.UnicodeFont

    }

    @SuppressWarnings("unchecked")
    private static void setUpFonts() {
        java.awt.Font awtFont = new java.awt.Font("Times New Roman", java.awt.Font.BOLD, 18);
        font = new UnicodeFont(awtFont);
        font.getEffects().add(new ColorEffect(java.awt.Color.white));
        font.addAsciiGlyphs();
        try {
            font.loadGlyphs();
        } catch (SlickException e) {
View Full Code Here

Examples of org.newdawn.slick.UnicodeFont

    }

    @SuppressWarnings("unchecked")
    private static void setUpFonts() {
        java.awt.Font awtFont = new java.awt.Font("Helvetica", java.awt.Font.BOLD, 18);
        font = new UnicodeFont(awtFont);
        font.getEffects().add(new ColorEffect(java.awt.Color.white));
        font.addAsciiGlyphs();
        try {
            font.loadGlyphs();
        } catch (SlickException e) {
View Full Code Here

Examples of org.newdawn.slick.UnicodeFont

   * @throws SlickException
   */
 
  static UnicodeFont extractFont(int size, int rule)
  {
    UnicodeFont f = searchFont(size, rule);
    if (f == null)
    {
      f = setFont(size, rule)
      return f;
    }
View Full Code Here

Examples of org.newdawn.slick.UnicodeFont

   * @throws SlickException
   */
  @SuppressWarnings("unchecked") //due to the unfixable getEffects() warnings
    private static UnicodeFont setFont(int size, int rule)
    {
    UnicodeFont f = null;
    try
    {
      f = new UnicodeFont("res/thin_pixel-7.ttf", size, false, false);
      f.getEffects().add(new ColorEffect());
        if (rule == 2) f.getEffects().add(new OutlineEffect(size/50, java.awt.Color.black));
        else if (rule == 1) f.getEffects().add(new ShadowEffect(java.awt.Color.gray, size/90, size/90, 0.52f));
      f.addAsciiGlyphs();
      f.setPaddingTop(f.getAscent()/2);
      f.loadGlyphs();
    } catch (SlickException e) {}
    font_index.put(size+rule+"", f);
    return f;
  }
View Full Code Here

Examples of org.newdawn.slick.UnicodeFont

   * @throws SlickException
   */
 
    public static void drawString(int size, int x, int y, String str, Color col, int rule)
    {
      UnicodeFont f = extractFont(size, rule);
      f.drawString(x, y, str, col);   
    }
View Full Code Here

Examples of org.newdawn.slick.UnicodeFont

     * @throws SlickException
     */
   
    public static int extractLength(String str, int size)
    {
      UnicodeFont f = Text.extractFont(size, 0);
      return (int) (Game.getAppX()/2-(f.getWidth(str)/2));
    }
View Full Code Here

Examples of org.newdawn.slick.UnicodeFont

     * @throws SlickException
     */
   
    public static int extractTrueLength(String str, int size)
    {
      UnicodeFont f = Text.extractFont(size, 0);
      return f.getWidth(str);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.