Package org.mt4j.components.visibleComponents.font

Examples of org.mt4j.components.visibleComponents.font.BitmapFontCharacter


    int originalFontSize = fontSize; //important for font cache
   
    PImage dummy = new PImage(1,1);
//    /*
    //Manually add a newLine character to the font
    BitmapFontCharacter newLine = new BitmapFontCharacter(dummy, pa, "\n", 0, 0, 0);
    newLine.setPickable(false);                   
    newLine.setVisible(false);
    newLine.setNoFill(true);
    newLine.setNoStroke(true);
    newLine.setName("newline");
    bitMapCharacters.add(newLine);
   
    //Manually add a SPACE character to the font
//    int spaceAdvancex = defaultHorizontalAdvX;
//    int spaceAdvancex = fm.charWidth(' ');
    //TODO hack, we use the dash character's width for the space width, because dont know how to get it
//    int spaceIndex = p5Font.index('-');
//    int spaceAdvancex = p5Font.width[spaceIndex];
//    int spaceAdvancex = p5Font.getGlyph('-').width;
    int spaceAdvancex = Math.round(((float) p5Font.width('i') * (float) fontSize));
//    int spaceAdvancex = Math.round(pa.textWidth(' '));
//    int spaceAdvancex = Math.round(p5Font.width(' ') * p5Font.size);
    BitmapFontCharacter space = new BitmapFontCharacter(dummy, pa, " ", 0, 0, spaceAdvancex);
    space.setPickable(false);                   
    space.setVisible(false);
    space.setNoFill(true);
    space.setNoStroke(true);
    space.setName("space");
    bitMapCharacters.add(space);
   
    //Manually add a TAB character to the font
    int defaultTabWidth = spaceAdvancex*4;
    BitmapFontCharacter tab = new BitmapFontCharacter(dummy, pa, "\t", 0, 0, defaultTabWidth);
    try {
      int tabWidth = 4 * space.getHorizontalDist();
      tab.setHorizontalDist(tabWidth);
    } catch (Exception e) {
      tab.setHorizontalDist(defaultTabWidth);
    }
    tab.setPickable(false);
    tab.setName("tab");
    tab.setVisible(false);
    tab.setNoFill(true);
    tab.setNoStroke(true);
    bitMapCharacters.add(tab);
//    */
   
    //TODO bitmap font size seems different to same size vector font, we must have check descent -> textarea -> res*em*etc
    //TODO eureka font -  numbers baseline wrong?
View Full Code Here


//          copy.save(MT4jSettings.DEFAULT_IMAGES_PATH + "i.png");
//        }
       
        //Create bitmap font character
        String StringChar = new Character(c).toString();
        BitmapFontCharacter character = new BitmapFontCharacter(charImage, pa, StringChar, leftExtend, topOffset, widthDisplacement);
        character.setName(StringChar);
        character.setFillColor(new MTColor(fillColor));
        if (MT4jSettings.getInstance().isOpenGlMode()){
          character.generateAndUseDisplayLists();
        }
        bitMapCharacters.add(character);
        //logger.debug("Char: " + c + " charWidth: " + charWidth +  " leftExtend: " + leftExtend + " widthDisplacement: " + widthDisplacement + " imageHeight: " + charImage.height + " charHeight: " + charHeight +  " topExtent: " + topExtend);
      }else{
        logger.warn("Couldnt create bitmap character : " + c + " -> not found!");
View Full Code Here

      BitmapFont font = (BitmapFont)this.getFont();
      IFontCharacter[] characters = font.getCharacters();
      for (int i = 0; i < characters.length; i++) {
        IFontCharacter fontCharacter = characters[i];
        if (fontCharacter instanceof BitmapFontCharacter) {
          BitmapFontCharacter bChar = (BitmapFontCharacter) fontCharacter;
          bChar.setTextureFiltered(scalable);
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.mt4j.components.visibleComponents.font.BitmapFontCharacter

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.