/** * 获取ttf font ps name * * @return */ public String getFontPSName() { return getFontPropertie(POSTSCRIPT_NAME); }
public FreeBitmapFont setStrokeColor(Color color) { paint.setStrokeColor(color); return this; }
public FreeBitmapFont setStrokeWidth(int width) { paint.setStrokeWidth(width); return this; }
public FreeBitmapFont(VGame game, FreePaint paint) { super(new BitmapFontData(), new TextureRegion(), false); pageWidth=paint.getPageWidth(); updataSize(paint.getTextSize()); this.game = game; this.listener = game.var3dListener; this.paint = paint; setIsEmoji(paint.isEmoji()); }
public void setDefaultFont(FreePaint paint){ this.paint=paint; setDefaultFontSize(paint.getTextSize()); }
@Override public void init() { // openAutoScreenshots(5,StageTest.class);//开启自动截图 setResources(R.class);//不设置这一句无法使用R.strings.xxxxx的形式使用多语言,但可以使用其他在assets里的资源 // openProtect("image");//加密image文件夹资源 // unProtect("image"); //showFps();//显示fps setFont("test", new FreeBitmapFont(this, new FreePaint(R.font.DroidSans)));//添加自定义字体(可由用户自己提供 ttf) /**对于 ios 版本,需要在 Info.plist.xml文件里定义 ttf 的路径,可定义多个 ttf 文件,例如 <key>UIAppFonts</key> <array> <string>font/mainfont.ttf</string> <string>font/DroidSans.ttf</string> </array> */ setStage(StageMain.class);//设置入口界面 } }
public Game(VListener varListener) { super(varListener); setSize(800, 480);//设置全局参照分辨率 setDefaultFont(new FreePaint(28).setIsEmoji());//设置默认字号28,并开启支持 emoji // (是否完全支持emoji 视运行平台而定,目前测试的结果是 windows10,ios,android 都支持的) setLanguage(Languages.zh);//设置语言(仅对Desktop版有效,本地版根据系统自动设置语言) }
private static String append(String text, TextButtonStyle style) { return ((FreeBitmapFont) style.font).appendTextPro(text); }
public FreeBitmapFont setBold(boolean istrue) { paint.setFakeBoldText(istrue); return this; }
public FreeBitmapFont setUnderline(boolean istrue) { paint.setUnderlineText(istrue); return this; }
public FreeBitmapFont setStrikeThru(boolean istrue) { paint.setStrikeThruText(istrue); return this; }
public FreeBitmapFont setTextColor(Color color) { paint.setColor(color); return this; }
public FreeBitmapFont setSize(int size) { paint.setTextSize(size); return this; }
public FreeBitmapFont(VGame game) { this(game, new FreePaint()); }
/** * 创建或新增字符(动态创建,可动态增加字符,但内存占用更多,不能与createText()方法共存) */ public FreeBitmapFont appendText(String characters) { if (characters == null || characters.length() == 0) return this; create(characters, false); return this; }
public FreeBitmapFont addEmojiPath(final String emojiKey, String imgPath, int size) { emojiSet.put(emojiKey, new EmojiDate(imgPath, size)); return this; }
public void updataSize(int newSize) { data = getData(); size = Math.max(newSize, size); data.down = -size; data.ascent = -size; data.capHeight = size; data.lineHeight = size; }
public void dispose() { end(); super.dispose(); } }
private static String append(String text, TextFieldStyle style) { if (text.equals("")) return ""; String newText=((FreeBitmapFont) style.font).appendTextPro(text); return newText; }