Java 类com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter 实例源码

项目:Catan    文件:ChatMessage.java   
public ChatMessage(String sender, String message) {
        super(skin);
//        debugAll();
        FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/DroidSans.ttf"));
        FreeTypeFontParameter parameter = new FreeTypeFontParameter();
        parameter.size = 17;
        parameter.minFilter = Texture.TextureFilter.Linear;
        parameter.magFilter = Texture.TextureFilter.Linear;
        final Label.LabelStyle labelStyle = skin.get("chat-sender", Label.LabelStyle.class);
        labelStyle.font = generator.generateFont(parameter);
        this.sender = new Label(sender, labelStyle);
        this.message = new Label(message, skin.get("chat-message", Label.LabelStyle.class));
        this.message.setWrap(true);
        add(this.sender).fillX().expandX();
        row();
        add(this.message).fillX().expandX();

        generator.dispose(); // don't forget to dispose to avoid memory leaks!
    }
项目:Polymorph    文件:GameScreen.java   
private void initUtils() {
    //init camera & viewport
    camera = new OrthographicCamera();
    viewport = new StretchViewport(Polymorph.WORLD_WIDTH, Polymorph.WORLD_HEIGHT, camera);
    viewport.apply(true);
    camera.update();

    //init sprite batch
    batch = new SpriteBatch();
    batch.setProjectionMatrix(camera.combined);

    //init font
    FreeTypeFontGenerator fontGenerator = polymorph.getAssetManager().get(Polymorph.FONT_BOLD_PATH, FreeTypeFontGenerator.class);
    FreeTypeFontParameter fontSettings = new FreeTypeFontParameter();
    fontSettings.size = 80;
    fontSettings.minFilter = TextureFilter.Linear;
    fontSettings.magFilter = TextureFilter.Linear;
    font = fontGenerator.generateFont(fontSettings);
}
项目:Longest-Century    文件:Launcher.java   
public void create() {
    batch = new SpriteBatch();
    font = new BitmapFont();

    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("gfx/fonts/roboto-regular.ttf"));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 16;
    font = generator.generateFont(parameter); // font size 16 pixels
    generator.dispose();

    music = Gdx.audio.newMusic(Gdx.files.internal("sounds/main.ogg"));
    music.setLooping(true);
    music.play();

    this.setScreen(new MenuScreen(this));
}
项目:joe    文件:HUD.java   
private void createInfoLabel() {
    infoBackground = new Image();
    TextureRegionDrawable image =
            new TextureRegionDrawable(AssetManager.getInstance().getTextureRegion("default"));
    infoBackground.setDrawable(image.tint(new Color(0, 0, 0, 0.6f)));
    infoBackground.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getWidth() / 20);
    stage.addActor(infoBackground);

    infoLabel = new Label("", skin);
    FreeTypeFontParameter fontParameter = new FreeTypeFontParameter();
    fontParameter.size = Gdx.graphics.getWidth() / 30;
    LabelStyle style = new LabelStyle();
    style.font = fontGenerator.generateFont(fontParameter);
    style.fontColor = Color.WHITE;
    infoLabel.setStyle(style);
    infoLabel.setWidth(Gdx.graphics.getWidth());
    stage.addActor(infoLabel);
}
项目:OdysseeDesMaths    文件:MenuPrincipal.java   
public MenuPrincipal(OdysseeDesMaths jeu) {
    this.jeu = jeu;

    this.currentState = State.NORMAL;
    this.viewport = new StretchViewport(WIDTH, HEIGHT);
    this.stage = new Stage(viewport);
    this.tableau = new Table();
    this.skin = new Skin();
    this.skin.addRegions(Assets.getManager().get(Assets.UI_MAIN, TextureAtlas.class));
    this.skin.addRegions(Assets.getManager().get(Assets.UI_ORANGE, TextureAtlas.class));
    this.skin.add("background", Assets.getManager().get(Assets.MAIN_MENU_BACKGROUND, Texture.class));

    //propriétés relatives à la police
    this.ftfp = new FreeTypeFontParameter();
    this.menuFont = new BitmapFont();
    this.fontButton = new BitmapFont();

    this.playButtonStyle = new TextButtonStyle();
    this.gameTitleStyle = new LabelStyle();
    this.audioButtons = new AudioButtons();

    this.createUI();
}
项目:rts-engine    文件:GridMapRenderer.java   
public GridMapRenderer() {

        // load font from a .ttf file
        try {
            FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("data/font/jgfont.ttf"));
            FreeTypeFontParameter fp = new FreeTypeFontParameter();
            fp.size = 9;
            font9 = generator.generateFont(fp);
            generator.dispose();

            shapeRenderer = RTSGame.game.cameraShapeRenderer;
            fontBatch = new SpriteBatch();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
项目:rts-engine    文件:QuadTreeRenderer.java   
public QuadTreeRenderer() {

        // load font from a .ttf file
        try {
            FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("data/font/jgfont.ttf"));
            FreeTypeFontParameter fp = new FreeTypeFontParameter();
            fp.size = 9;
            font9 = generator.generateFont(fp);
            generator.dispose();

            shapeRenderer = RTSGame.game.cameraShapeRenderer;
            fontBatch = new SpriteBatch();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
项目:libgdxcn    文件:FreeTypeTest.java   
@Override
public void create () {
    boolean flip = false;
    batch = new SpriteBatch();
    if (flip) {
        OrthographicCamera cam = new OrthographicCamera();
        cam.setToOrtho(flip);
        cam.update();
        batch.setProjectionMatrix(cam.combined);
    }
    font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), flip);
    FileHandle fontFile = Gdx.files.internal("data/arial.ttf");

    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);

    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 15;
    parameter.flip = flip;
    parameter.genMipMaps = true;

    FreeTypeBitmapFontData fontData = generator.generateData(parameter);
    ftFont = generator.generateFont(parameter);
    generator.dispose();
}
项目:libgdxcn    文件:FreeTypeDisposeTest.java   
public void render () {
    if (Gdx.input.justTouched()) {
        for (int i = 0; i < 10; i++) {
            if (font != null) {
                font.dispose();
            }
            FileHandle fontFile = Gdx.files.internal("data/arial.ttf");
            FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);

            FreeTypeFontParameter parameter = new FreeTypeFontParameter();
            parameter.size = 15;

            font = generator.generateFont(parameter);
            generator.dispose();
        }
        for (int i = 0; i < 10; i++)
            System.gc();
        Gdx.app.log("FreeTypeDisposeTest", "generated 10 fonts");
        Gdx.app.log("FreeTypeDisposeTest", Gdx.app.getJavaHeap() + ", " + Gdx.app.getNativeHeap());
    }
}
项目:chainball    文件:Assets.java   
public static void loadFonts(){
    FreeTypeFontGenerator font_gen = new FreeTypeFontGenerator(Gdx.files.internal("font.ttf"));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 100;
    font100 = font_gen.generateFont(parameter);
    font100.getRegion().getTexture().setFilter(TextureFilter.Linear,TextureFilter.Linear);
    font100.setColor(Color.BLACK);  
    font100.setScale(1, -1);

    parameter.size = 75;
    font75 = font_gen.generateFont(parameter);
    font75.getRegion().getTexture().setFilter(TextureFilter.Linear,TextureFilter.Linear);
    font75.setColor(Color.BLACK);   
    font75.setScale(1, -1);

    parameter.size = 250;   
    font250 = font_gen.generateFont(parameter);
    font250.getRegion().getTexture().setFilter(TextureFilter.Linear,TextureFilter.Linear);
    font250.setColor(Color.BLACK);  
    font250.setScale(1, -1);

    font_gen.dispose();
}
项目:skinpacker    文件:Ttf2FntGenerator.java   
/**
 * Convenience method for generating a font, and then writing the fnt and
 * png files. Writing a generated font to files allows the possibility of
 * only generating the fonts when they are missing, otherwise loading from a
 * previously generated file.
 * 
 * @param fontFile
 * @param fontSize
 * @param destiny
 */
private void generateFiles(String fontName, FileHandle fontFile,
        int fontSize, int pageWidth, int pageHeight, FileHandle destiny) {
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);

    PixmapPacker packer = new PixmapPacker(pageWidth, pageHeight,
            Pixmap.Format.RGBA8888, 2, false);
    FreeTypeFontParameter param = new FreeTypeFontParameter();
    param.packer = packer;
    param.characters = FreeTypeFontGenerator.DEFAULT_CHARS;
    param.size = fontSize;
    param.flip = false;

    FreeTypeFontGenerator.FreeTypeBitmapFontData fontData = generator
            .generateData(param);

    saveFontToFile(fontData, fontSize, fontName, packer, destiny);
    generator.dispose();
    packer.dispose();
}
项目:HAW-SE2-projecthorse    文件:SplashScreen.java   
/**
 * Erzeugt den LadeButtonText.
 */
private void createButton() {
    Drawable drawable = new TextureRegionDrawable((new TextureRegion(new Texture(
            Gdx.files.internal("splashscreen/buttonBackground.png")))));
    FreeTypeFontGenerator gen = new FreeTypeFontGenerator(
            Gdx.files.internal("fonts/textfont/Grundschrift-Bold.ttf"));
    FreeTypeFontParameter frontPara = new FreeTypeFontParameter();
    frontPara.size = 40;

    BitmapFont b = gen.generateFont(frontPara);
    gen.dispose();
    ImageTextButtonStyle imageButtonStyle = new ImageTextButton.ImageTextButtonStyle();
    imageButtonStyle.down = drawable;
    imageButtonStyle.up = drawable;
    imageButtonStyle.font = b;

    imageButtonStyle.fontColor = Color.valueOf("877E6A");

    textContent = new ImageTextButton("Lade... : ", imageButtonStyle);

}
项目:seventh    文件:GdxCanvas.java   
/**
 * Retrieve the desired font and size (may load the font
 * if not cached).
 * 
 * @param alias
 * @param size
 * @return the font
 */
private BitmapFont getFont(String alias, int size) {
    BitmapFont font = null;

    String mask = alias + ":" + size;
    if(this.fonts.containsKey(mask)) {
        font = this.fonts.get(mask);
    }
    else if(this.generators.containsKey(alias)) {
        FreeTypeFontParameter params = new FreeTypeFontParameter();
        params.size = size;
        params.characters = FreeTypeFontGenerator.DEFAULT_CHARS;
        params.flip = true;
        params.magFilter = TextureFilter.Linear;
        params.minFilter = TextureFilter.Linear;

        font = this.generators.get(alias).generateFont(params);
        this.fonts.put(mask, font);
    }

    return font;
}
项目:Noeron    文件:Game.java   
@Override
public void show() {
    camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.setToOrtho(false);
    camera.position.x = Gdx.graphics.getWidth() / 2;
    camera.position.y = Gdx.graphics.getHeight() / 2;

    //Get the font.
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("mainmenu/new/kenvector_future.ttf"));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 15;
    font = generator.generateFont(parameter);
    generator.dispose();


    System.gc(); //We no longer need the Main Menu stuff, we should clean it up.
}
项目:mini2Dx    文件:TextBoxStyleRule.java   
@Override
public void prepareAssets(UiTheme theme, FileHandleResolver fileHandleResolver, AssetManager assetManager) {
    if (theme.isHeadless()) {
        return; 
    }

    normalNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(normal)), getPaddingLeft(),
            getPaddingRight(), getPaddingTop(), getPaddingBottom());
    hoverNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(hover)), getPaddingLeft(),
            getPaddingRight(), getPaddingTop(), getPaddingBottom());
    actionNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(action)), getPaddingLeft(),
            getPaddingRight(), getPaddingTop(), getPaddingBottom());
    disabledNinePatch = new NinePatch(new TextureRegion(theme.getTextureAtlas().findRegion(disabled)), getPaddingLeft(),
            getPaddingRight(), getPaddingTop(), getPaddingBottom());
    color = ColorUtils.rgbToColor(textColor);

    UiFont themeFont = theme.getFont(font);
    FreeTypeFontParameter fontParameter = new  FreeTypeFontParameter();
    fontParameter.size = fontSize;
    fontParameter.flip = true;
    if(themeFont.getBorderWidth() > 0) {
        fontParameter.borderWidth = themeFont.getBorderWidth();
        fontParameter.borderColor = themeFont.getFontBorderColor();
    }
    bitmapFont = themeFont.generateFont(fontParameter);
}
项目:mini2Dx    文件:LabelStyleRule.java   
@Override
public void prepareAssets(UiTheme theme, FileHandleResolver fileHandleResolver, AssetManager assetManager) {
    if (theme.isHeadless()) {
        return; 
    }

    super.prepareAssets(theme, fileHandleResolver, assetManager);
    if(textColor != null) {
        color = ColorUtils.rgbToColor(textColor);
    }

    UiFont themeFont = theme.getFont(font);
    FreeTypeFontParameter fontParameter = new  FreeTypeFontParameter();
    fontParameter.size = fontSize;
    fontParameter.flip = true;
    if(themeFont.getBorderWidth() > 0) {
        fontParameter.borderWidth = themeFont.getBorderWidth();
        fontParameter.borderColor = themeFont.getFontBorderColor();
    }
    bitmapFont = themeFont.generateFont(fontParameter);
}
项目:mini2Dx    文件:UiFont.java   
private String getFontParameterKey(FreeTypeFontParameter parameter) {
    StringBuilder result = new StringBuilder();
    result.append(parameter.characters);
    result.append(parameter.borderGamma);
    result.append(parameter.borderStraight);
    result.append(parameter.borderWidth);
    result.append(parameter.flip);
    result.append(parameter.gamma);
    result.append(parameter.genMipMaps);
    result.append(parameter.incremental);
    result.append(parameter.kerning);
    result.append(parameter.mono);
    result.append(parameter.renderCount);
    result.append(parameter.shadowOffsetX);
    result.append(parameter.shadowOffsetY);
    result.append(parameter.size);
    result.append(parameter.spaceX);
    result.append(parameter.spaceY);
    result.append(parameter.borderColor == null ? "null" : parameter.borderColor.toFloatBits());
    result.append(parameter.color == null ? "null" : parameter.color.toFloatBits());
    result.append(parameter.magFilter == null ? "null" : parameter.magFilter.getGLEnum());
    result.append(parameter.minFilter == null ? "null" : parameter.minFilter.getGLEnum());
    result.append(parameter.packer == null ? "null" : parameter.packer.hashCode());
    result.append(parameter.shadowColor == null ? "null" : parameter.shadowColor.toFloatBits());
    return result.toString();
}
项目:Catan    文件:TradeWindow.java   
private BitmapFont getFont() {
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/DroidSans.ttf"));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 20;
    BitmapFont font = generator.generateFont(parameter);
    generator.dispose();
    return font;
}
项目:Polymorph    文件:MainMenu.java   
private BitmapFont generateFont(int size, boolean bold) {
    AssetManager assetManager = polymorph.getAssetManager();
    FreeTypeFontGenerator fontGenerator = bold ? assetManager.get(Polymorph.FONT_BOLD_PATH, FreeTypeFontGenerator.class)
                                               : assetManager.get(Polymorph.FONT_NORMAL_PATH, FreeTypeFontGenerator.class);

    FreeTypeFontParameter fontSettings = new FreeTypeFontParameter();
    fontSettings.size = size;
    fontSettings.minFilter = Texture.TextureFilter.Linear;
    fontSettings.magFilter = Texture.TextureFilter.Linear;

    return fontGenerator.generateFont(fontSettings);
}
项目:Dungeon    文件:Hud.java   
public Hud() {
    gen             = new FreeTypeFontGenerator (Gdx.files.internal("pixelmix_bold.ttf"));
    par             = new FreeTypeFontParameter ();

    par.size        = 31;
    par.color       = Color.BLACK;
    par.borderColor = Color.WHITE;
    par.borderWidth = 1.2f;

    pm_b            = gen.generateFont  (par);

    coin            = new Texture       ("coin_small.png");
}
项目:JavityEngine    文件:SmartFontGenerator.java   
/**
 * Convenience method for generating a font, and then writing the fnt and
 * png files. Writing a generated font to files allows the possibility of
 * only generating the fonts when they are missing, otherwise loading from a
 * previously generated file.
 * 
 * @param fontFile
 * @param fontSize
 */
private BitmapFont generateFontWriteFiles(String fontName, FileHandle fontFile, int fontSize, int pageWidth,
        int pageHeight) {
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);

    PixmapPacker packer = new PixmapPacker(pageWidth, pageHeight, Pixmap.Format.RGBA8888, 2, false);

    FreeTypeFontParameter freeTypeFontParameter = new FreeTypeFontParameter();
    freeTypeFontParameter.size = fontSize;
    freeTypeFontParameter.packer = packer;

    FreeTypeFontGenerator.FreeTypeBitmapFontData fontData = generator.generateData(freeTypeFontParameter);
    Array<PixmapPacker.Page> pages = packer.getPages();
    Array<TextureRegion> texRegions = new Array<TextureRegion>();
    for (int i = 0; i < pages.size; i++) {
        PixmapPacker.Page p = pages.get(i);
        Texture tex = new Texture(
                new PixmapTextureData(p.getPixmap(), p.getPixmap().getFormat(), false, false, true)) {
            @Override
            public void dispose() {
                super.dispose();
                getTextureData().consumePixmap().dispose();
            }
        };
        tex.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
        texRegions.add(new TextureRegion(tex));
    }

    BitmapFont font = new BitmapFont(fontData, texRegions, false);
    saveFontToFile(font, fontSize, fontName, packer);
    generator.dispose();
    packer.dispose();
    return font;
}
项目:jrpg-engine    文件:FontSet.java   
private BitmapFont createFontFromTTF(final FileHandle ttf, final int size, final boolean isMono) {
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(ttf);
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = size;
    parameter.mono = isMono;
    BitmapFont font = generator.generateFont(parameter);
    font.getData().markupEnabled = true;
    generator.dispose();

    return font;
}
项目:ZombieInvadersVR    文件:FontUtils.java   
public static BitmapFont loadFont(String url, int size, Color color){
    BitmapFont font;
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal(url));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = size;
    if(color != null) parameter.color = color;
    font = generator.generateFont(parameter);
    generator.dispose();
    return font;
}
项目:joe    文件:HUD.java   
private void createProgressLabel() {
    progressLabel = new Label("", skin);

    FreeTypeFontParameter fontParameter = new FreeTypeFontParameter();
    fontParameter.size = Gdx.graphics.getWidth() / 30;
    LabelStyle style = new LabelStyle();
    style.font = fontGenerator.generateFont(fontParameter);
    style.fontColor = Color.WHITE;
    progressLabel.setStyle(style);

    stage.addActor(progressLabel);
}
项目:joe    文件:MainMenu.java   
private void createLoadingLabel() {
    int height = (int)(Gdx.graphics.getWidth() * 0.1f);
    FreeTypeFontParameter fontParam = new FreeTypeFontParameter();
    fontParam.size = height;
    Label.LabelStyle style = new Label.LabelStyle();
    style.font = fontGenerator.generateFont(fontParam);
    style.fontColor = ColorScheme.getInstance().getBackgroundColor();
    loadingLabel = new Label("LOADING", skin);
    loadingLabel.setStyle(style);
    loadingLabel.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    loadingLabel.setAlignment(Align.center);
    loadingLabel.setPosition(0, 0);
    loadingLabel.setVisible(false);
    stage.addActor(loadingLabel);
}
项目:pixelhorrorjam2016    文件:MainMenu.java   
@Override
public void show() {
    _camera = new OrthographicCamera(MAIN_MENU_WIDTH, MAIN_MENU_HEIGHT);
    _camera.translate(MAIN_MENU_WIDTH / 2, MAIN_MENU_HEIGHT / 2);
    _viewport = new StretchViewport(MAIN_MENU_WIDTH, MAIN_MENU_HEIGHT, _camera);

    _batch = new SpriteBatch();
    _shapeRenderer = new ShapeRenderer();

    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("font/raleway/Raleway-Medium.ttf"));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 64;
    parameter.borderColor = Color.GRAY;
    parameter.borderWidth = 2;

    _titleFont = generator.generateFont(parameter);
    _titleFont.setColor(Color.WHITE);

    parameter.borderWidth = 1;
    parameter.size = 20;
    _font = generator.generateFont(parameter);
    _font.setColor(Color.WHITE);
    parameter.size = 8;
    _tinyfont = generator.generateFont(parameter);
    _tinyfont.setColor(Color.WHITE);

    _background = new Sprite(new Texture("MainMenuBackground.png"));
    _background.setSize(MAIN_MENU_WIDTH, MAIN_MENU_HEIGHT);
    _background.setPosition(0, 0);

    _snowAnimation = new SnowAnimation(50, 4, MAIN_MENU_WIDTH, MAIN_MENU_HEIGHT);

    _fade = 1.5f;
    _fadeIn = true;

    Gdx.input.setInputProcessor(this);
}
项目:OmiClub    文件:FontsHandler.java   
private static FreeTypeFontParameter getDefaultFontParameter(){
    loadFonts();
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    float color = (float) 210/255f;
    parameter.color = new Color(color, color, color, 1f);
    parameter.borderColor = Color.BLACK;
    parameter.borderWidth = 3;
    return parameter;
}
项目:beatoraja    文件:KeyConfiguration.java   
public void create() {
    this.setSkin(new MusicDecideSkin(Resolution.HD, getMainController().getConfig().getResolution()));
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(
            Gdx.files.internal("skin/default/VL-Gothic-Regular.ttf"));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = (int) (20 * getSkin().getScaleY());
    titlefont = generator.generateFont(parameter);
    shape = new ShapeRenderer();

    input = getMainController().getInputProcessor();
    keyboard = input.getKeyBoardInputProcesseor();
    controllers = input.getBMInputProcessor();
    midiinput = input.getMidiInputProcessor();
    setMode(0);
}
项目:beatoraja    文件:PracticeConfiguration.java   
public void create(BMSModel model) {
    property.judgerank = model.getJudgerank();
    property.endtime = model.getLastTime() + 1000;
    Path p = Paths.get("practice/" + model.getSHA256() + ".json");
    if (Files.exists(p)) {
        Json json = new Json();
        try {
            property = json.fromJson(PracticeProperty.class, new FileReader(p.toFile()));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    if(property.gaugecategory == null) {
        property.gaugecategory = BMSPlayerRule.getBMSPlayerRule(model.getMode()).gauge;
    }
    this.model = model;
    if(property.total == 0) {
        property.total = model.getTotal();
    }
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(
            Gdx.files.internal("skin/default/VL-Gothic-Regular.ttf"));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 18;
    titlefont = generator.generateFont(parameter);
    graph.setDestination(0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, new int[0]);
}
项目:SPACEJUNK    文件:GraphicsManager.java   
/**
 * Adds a TTF font to the manager. Fonts are unaffected by loadAssetsFor(...)
 * 
 * @param name The name of the font
 * @param file The file of the font
 * @param size The size of the font
 * @return
 */
public GraphicsManager addTTFFont(String name, String file, int size) {
    FreeTypeFontGenerator gen = new FreeTypeFontGenerator(Gdx.files.internal(file));

    FreeTypeFontParameter params = new FreeTypeFontParameter();
    params.size = size;

    BitmapFont font = gen.generateFont(params);
    fonts.put(name, font);

    return this;
}
项目:METRO    文件:METRO.java   
/**
 * Load the font {@code GatsbyFLF-Bold} in size 21.
 * 
 * @return The loaded font.
 */
private BitmapFont loadFonts()
{
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/GatsbyFLF-Bold.ttf"));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.magFilter = TextureFilter.Linear;
    parameter.size = 21;
    parameter.flip = true;
    BitmapFont font = generator.generateFont(parameter); // font size 20 pixels
    generator.dispose();

    return font;
}
项目:freeze-fire-tag    文件:FreezeFireTag.java   
@Override
public void create()
{
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("font/second.ttf"));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 2;
    font = generator.generateFont(parameter); // font size 12 pixels
    generator.dispose();

    gameScreen = new GameScreen(this);
    menuScreen = new MenuScreen(this, gameScreen.stage.getBatch());
    setScreen(menuScreen);
}
项目:Roguelike    文件:AssetManager.java   
public static BitmapFont loadFont( String name, int size, Color colour, int borderWidth, Color borderColour, boolean shadow )
{
    String key = name + size + colour.toString() + borderWidth + borderColour.toString();

    if ( loadedFonts.containsKey( key ) ) { return loadedFonts.get( key ); }

    FreeTypeFontGenerator fgenerator = new FreeTypeFontGenerator( Gdx.files.internal( name ) );
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = size;
    parameter.borderWidth = borderWidth;
    parameter.kerning = true;
    parameter.borderColor = borderColour;
    parameter.borderStraight = true;
    parameter.color = colour;

    if ( shadow )
    {
        parameter.shadowOffsetX = -1;
        parameter.shadowOffsetY = 1;
    }

    BitmapFont font = fgenerator.generateFont( parameter );
    font.getData().markupEnabled = true;
    fgenerator.dispose(); // don't forget to dispose to avoid memory leaks!

    loadedFonts.put( key, font );

    return font;
}
项目:SpaceProject    文件:MainMenuScreen.java   
public MainMenuScreen(SpaceProject spaceProject) {
    this.game = spaceProject;

    // graphics
    shape = new ShapeRenderer();
    batch = new SpriteBatch();

    switchScreen = false;
    time = 1;

    length = 15;
    branchAngle = 33;
    tiltAngle = 0;
    startAngle = 90;
    iterations = 7;

    // font
    generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/ComfortaaBold.ttf"));
    parameter = new FreeTypeFontParameter();
    parameter.size = 60;
    fontComfortaaBold = generator.generateFont(parameter);

    parameter.size = 30;
    fontComfortaaBold1 = generator.generateFont(parameter);
    generator.dispose();

}
项目:Virtual-Evil    文件:FontManager.java   
private BitmapFont generateFont(String fontName, int fontSize) {
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal(PATH + fontName + FORMAT));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = fontSize;
    parameter.color = com.badlogic.gdx.graphics.Color.GREEN;
    parameter.characters = FreeTypeFontGenerator.DEFAULT_CHARS;
    BitmapFont product = generator.generateFont(parameter);
    generator.dispose();
    return product;
}
项目:killingspree    文件:KillingSpree.java   
@Override
    public void create () {
        generator = new FreeTypeFontGenerator
                (Gdx.files.internal("fonts/splash.ttf"));
        parameter = new FreeTypeFontParameter();

        AssetLoader.instance.loadAll();
        currentScreen = new SplashScreen(this);
        Gdx.audio.getClass();
//      GameScreen gameScreen = new GameScreen(this);
//        gameScreen.startServer();
//        gameScreen.loadLevel("maps/retro-small.tmx", "localhost");
//        currentScreen = gameScreen;
    }
项目:killingspree    文件:HUDRenderer.java   
public HUDRenderer() {
    bomb = new Sprite(AssetLoader.instance.
            getTexture("sprites/bomb.png"));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 7;
    font = new FreeTypeFontGenerator
            (Gdx.files.internal("fonts/game.ttf")).generateFont(parameter);
}
项目:utilsLibGDX    文件:Text.java   
public Text(float XX, float YY, int size, String text, String font_path){
    x = XX;
    y = YY;
    this.font_path = font_path;
    gen = new FreeTypeFontGenerator(Gdx.files.internal(font_path));
    par = new FreeTypeFontParameter();
    par.size = size;
    font = gen.generateFont(par);
    glyphLayout = new GlyphLayout(font, text);
    this.text = text;
}
项目:gdx-styledtext    文件:GdxFontGenerator.java   
public GdxFontInfo[] load(FileHandle fontFile, TextStyle style, int[] sizes) throws IOException {
    if (!fontFile.exists()) {
        throw new FileNotFoundException(fontFile.toString());
    }

    GdxFontInfo[] result = new GdxFontInfo[sizes.length];

    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);
    try {
        for (int n = 0; n < sizes.length; n++) {
            final FreeTypeFontParameter params = new FreeTypeFontParameter();
            params.flip = (ydir == YDir.DOWN);
            params.size = sizes[n];

            if (!GdxFontUtil.isColorizable(style)) {
                params.color = GdxFontUtil.argb8888ToColor(style.getColor());
            }

            params.borderColor = GdxFontUtil.argb8888ToColor(style.getOutlineColor());
            params.borderWidth = style.getOutlineSize();

            params.shadowColor = GdxFontUtil.argb8888ToColor(style.getShadowColor());
            params.shadowOffsetX = Math.round(style.getShadowDx());
            params.shadowOffsetY = Math.round(style.getShadowDy());

            BitmapFont bmFont = generator.generateFont(params);
            bmFont.setUseIntegerPositions(true);

            UnderlineMetrics underlineMetrics = GdxFontUtil.deriveUnderlineMetrics(generator, sizes[n]);

            result[n] = new GdxFontInfo(style, bmFont, sizes[n], underlineMetrics);
        }
    } finally {
        generator.dispose();
    }

    return result;
}
项目:gdx-smart-font    文件:SmartFontGenerator.java   
/** Convenience method for generating a font, and then writing the fnt and png files.
 * Writing a generated font to files allows the possibility of only generating the fonts when they are missing, otherwise
 * loading from a previously generated file.
 * @param fontFile
 * @param fontSize
 */
private BitmapFont generateFontWriteFiles(String fontName, FileHandle fontFile, int fontSize, int pageWidth, int pageHeight) {
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);

    PixmapPacker packer = new PixmapPacker(pageWidth, pageHeight, Pixmap.Format.RGBA8888, 2, false);
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = fontSize;
    parameter.characters = FreeTypeFontGenerator.DEFAULT_CHARS;
    parameter.flip = false;
    parameter.packer = packer;
    FreeTypeFontGenerator.FreeTypeBitmapFontData fontData = generator.generateData(parameter);
    Array<PixmapPacker.Page> pages = packer.getPages();
    Array<TextureRegion> texRegions = new Array<>();
    for (int i = 0; i < pages.size; i++) {
        PixmapPacker.Page p = pages.get(i);
        Texture tex = new Texture(
                new PixmapTextureData(p.getPixmap(), p.getPixmap().getFormat(), false, false, true)) {
            @Override
            public void dispose() {
                super.dispose();
                getTextureData().consumePixmap().dispose();
            }
        };
        tex.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
        texRegions.add(new TextureRegion(tex));
    }
    BitmapFont font = new BitmapFont((BitmapFont.BitmapFontData) fontData, texRegions, false);
    saveFontToFile(font, fontSize, fontName, packer);
    generator.dispose();
    packer.dispose();
    return font;
}