0

I would like to create a font file (like .ttfv or etc) by using java, how can I do it.
If java cannot create or edit font file, could you tell me which program language can do it?
I would like do it by programming without exists software.
I really need it. Thank you.

2
Contributors
2
Replies
6
Views
4 Years
Discussion Span
Last Post by april88t
0
public static Font loadFont(String fontFileName)
    {
        BaseFont base = null;

        try
        {
            base = BaseFont.createFont(Resource.class.getResource(fontFileName + "_font.ttf").toString(), BaseFont.WINANSI, true);
        }
        catch (DocumentException | IOException e)
        {
            e.printStackTrace();
        }

        Font font = new Font(base, Font.BOLD, 15);
        return font;
    }
0

Structure of the program is:
src (folder)

core (package)
        //all (but one) classes used for program
    resources (package)
        class Resources (used to load resources into the "core" classes)
        wingding_font.ttf

This is the snippet of the code which isn't working:

p = new Phrase("some random text");
p.setFont(Resource.loadFont("wingding"));
pa = new Paragraph(p);
pa.setFont(Resource.loadFont("wingding"));
document.add(pa);

cr : Click Here

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.