Package org.newdawn.slick

Examples of org.newdawn.slick.UnicodeFont


    if (element.hasAttribute("fontSize")) {
      fontSize = parseIntAttribute(element, "fontSize");
    }

    Log.debug(formatLoadMsg("Unicode font", key, ttfFile));
    UnicodeFont unicodeFont = new UnicodeFont(baseDir + ttfFile, fontSize,
        false, false);
    unicodeFont.getEffects().add(new ColorEffect());
    unicodeFont.addAsciiGlyphs();
    unicodeFont.loadGlyphs();
    unicodeFont.setDisplayListCaching(true);
    ResourceManager.addFont(key, unicodeFont);
  }
View Full Code Here


    private Police() throws SlickException {
        polices = new ArrayList<>();
        // Police normale
        Font font = new Font("Tahoma", Font.BOLD, 18);
        UnicodeFont police = new UnicodeFont(font, font.getSize(), font.isBold(), font.isItalic());
        //police.getEffects().add(new ColorEffect(Color.BLACK));
        //police.getEffects().add(new ShadowEffect(Color.WHITE, 1, 1, 1));
        police.getEffects().add(new ColorEffect(Color.WHITE));
        police.getEffects().add(new OutlineEffect(1, Color.BLACK));
        police.addAsciiGlyphs();
        police.loadGlyphs();
        polices.add(police);
    }
View Full Code Here

  }
 
  @SuppressWarnings("unchecked")
  public UnicodeFont UIFont() {
    if (sUIFont != null) return sUIFont;
    sUIFont = new UnicodeFont(new Font("Arial", 0, 14));
    try {
      sUIFont.getEffects().add(new ColorEffect(Color.white));
      sUIFont.addAsciiGlyphs();
      sUIFont.loadGlyphs();
    } catch (Exception e) {
View Full Code Here

  @SuppressWarnings("unchecked")
  private static void loadFont(String name, Color color, int size)
      throws SlickException {
    String key = getKey(name, color, size);
    UnicodeFont font = new UnicodeFont(name, size, false, false);
    font.addAsciiGlyphs();
    font.getEffects().add(new ColorEffect(color));
    font.loadGlyphs();
    cache.put(key, font);
  }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  private void initFonts() {
    try {
      sFont = new UnicodeFont("lib/sundaycomicsbb_reg.ttf", 14, false, false);
      sFont.getEffects().add(new ColorEffect(java.awt.Color.white));
      sFont.addAsciiGlyphs();
      sFont.loadGlyphs();
     
      sFont2 = new UnicodeFont("lib/sundaycomicsbb_reg.ttf", 24, false, false);
      sFont2.getEffects().add(new ColorEffect(java.awt.Color.white));
      sFont2.addAsciiGlyphs();
      sFont2.loadGlyphs();
    } catch (Exception e) {
      System.err.println("Failed to load font");
View Full Code Here

  private 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 (Exception 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());

    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

   */
  public void init(GameContainer container) throws SlickException {
    container.setShowFPS(false);

    // unicodeFont = new UnicodeFont(Font.decode("Arial Unicode MS"), 25, false, false);
    unicodeFont = new UnicodeFont("testdata/Lato-Thin.ttf", 48, false, false);
//    unicodeFont.setPaddingBottom(10);
//    unicodeFont.setPaddingRight(10);
//    unicodeFont.setPaddingAdvanceX(-10);
//    unicodeFont.getEffects().add(new ShadowEffect(java.awt.Color.black, 5, 5, 0.5f));
    unicodeFont.getEffects().add(new ColorEffect(java.awt.Color.white));
View Full Code Here

TOP

Related Classes of org.newdawn.slick.UnicodeFont

Copyright © 2018 www.massapicom. 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.