Package transientlibs.preui.agents.factories

Source Code of transientlibs.preui.agents.factories.FontProvider

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package transientlibs.preui.agents.factories;

import transientlibs.slick2d.util.Log;
import transientlibs.bindedobjects.core.GDXFonts;
import transientlibs.preui.objects.gui.elements.TransientGDXFont;
import transientlibs.processors.misc.Detonator;
import transientlibs.preui.objects.gui.interfaces.IFont;

/**
*
** @author kibertoad
*/
public class FontProvider {

    private IFont defaultFont;
    private IFont Djvu_16_Bold_Outline;

    public IFont getDjvu_16_Bold_Outline() {
        return Djvu_16_Bold_Outline;
    }

    public IFont getDjvu_16() {
        return Djvu_16;
    }

    public IFont getDjvu_Sans_24() {
        return Djvu_Sans_24;
    }

    public IFont getDroid_Sans_24_Outline() {
        return Droid_Sans_24_Outline;
    }

    public IFont getDroid_Sans_16_No_Outline() {
        return Droid_Sans_16_No_Outline;
    }

    public IFont getDroid_Sans_20_Outline() {
        return Droid_Sans_20_Outline;
    }

    public IFont getLiberation_Sans_64_Outline() {
        return Liberation_Sans_64_Outline;
    }
    private IFont Djvu_16;
    private IFont Djvu_Sans_24;
    private IFont Droid_Sans_24_Outline;
    private IFont Droid_Sans_16_No_Outline;
    private IFont Droid_Sans_20_Outline;
    private IFont Liberation_Sans_64_Outline;

    public IFont produceFontCopy(IFont font) {
        if (Detonator.INSTANCE.useGDXImages == true) {
            return new TransientGDXFont(font.getFontInfo());
        } else {
            return font;
        }
    }

    public IFont getDefaultFont() {
        //Log.info("return default font: "+defaultFont.getName());
       
        return produceFontCopy(defaultFont);
    }

    public void setDefaultFonts() {

        defaultFont = getFont("droid_20_sans");
        Djvu_16 = getFont("djvu_16_sans_bold");
        Djvu_Sans_24 = getFont("djvu_24_sans");
        Droid_Sans_16_No_Outline = getFont("djvu_16_sans_bold");
        Droid_Sans_24_Outline = getFont("droid_24_sans");
        Droid_Sans_20_Outline = getFont("droid_20_sans");
        Djvu_16_Bold_Outline = getFont("djvu_16_sans_bold");
        Liberation_Sans_64_Outline = getFont("liberation_64_sans");
    }

    public IFont getFont(String byCode) {
        return produceFontCopy(GDXFonts.getFontByCode(byCode).font);
    }

    public IFont getFont(int byID) {

        if (byID != -1) {
            //Log.info("Got GDX font: " + byID);
            return produceFontCopy(GDXFonts.getFontByID(byID).font);
        } else {
            return null;
        }
    }
}
TOP

Related Classes of transientlibs.preui.agents.factories.FontProvider

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.