Create a new font/glyph in java2D

How to create my specific glyph to use in ma game in java2D?
hi would like to generate the string in my style just using the standard java

how to create my own font?


Graphics2D dbg .... 
...
...

Font font = new Font("MyFontWithmySpeficiGlyph", Font.PLAIN, 20); //how to return my font with my glyph
dbg.setFont(font);

String myString = "string that use my glyph "
dbg.drawString(myString , x, y);
 

There are many Truetype Font Editors out there.

These for a start

yer ok i create the .ttf but
1- how I import in my application
2- how i distribute to other pc?

i have to istall the font and the the game run?

You can put it into a folder in your project, and load it from there. Then you can load it just like loading a system font.

Check this out: http://www.java2s.com/Code/Java/2D-Graphics-GUI/Loadfontfromttffile.htm
Google search: Java load font

thanks man
was very easy

String fName = “/fonts/” + name;
try {
InputStream is = DemoFonts.class.getResourceAsStream(fName);
font = Font.createFont(Font.TRUETYPE_FONT, is);
} catch (Exception ex) {
ex.printStackTrace();
System.err.println(fName + " not loaded. Using serif font.");
font = new Font(“serif”, Font.PLAIN, 24);
}
return font;

Yeah, well, it has been made into a sort of font-loading class. But you seem to have understood how it works :slight_smile: