Creating a Truetype Font file with javafx

First Solution:

You can use the java.awt.Font, it is a Java class used to manage and create Fonts, you can use its Font(String name, int style, int size) constructor to create your custom Font:

Font(String name, int style, int size):

Creates a new Font from the specified name, style and point size. The font name can be a font face name or a font family name. It is used together with the style to find an appropriate font face. When a font family name is specified, the style argument is used to select the most appropriate face from the family. When a font face name is specified, the face's style and the style argument are merged to locate the best matching font from the same family.

For example if face name "Arial Bold" is specified with style Font.ITALIC, the font system looks for a face in the "Arial" family that is bold and italic, and may associate the font instance with the physical font face "Arial Bold Italic". The style argument is merged with the specified face's style, not added or subtracted. This means, specifying a bold face and a bold style does not double-embolden the font, and specifying a bold face and a plain style does not lighten the font.

Parameters:

name - the font name. This can be a font face name or a font family name, and may represent either a logical font or a physical font found in this GraphicsEnvironment. The family names for logical fonts are: Dialog, DialogInput, Monospaced, Serif, or SansSerif. Pre-defined String constants exist for all of these names, for example, DIALOG. If name is null, the logical font name of the new Font as returned by getName() is set to the name "Default".

style - the style constant for the Font The style argument is an integer bitmask that may be PLAIN, or a bitwise union of BOLD and/or ITALIC (for example, ITALIC or BOLD|ITALIC). If the style argument does not conform to one of the expected integer bitmasks then the style is set to PLAIN.

size - the point size of the Fon

And as you can see it allows you to create new Fonts depending on existing fonts, you can also change the style and the size.

This is a Tutorial that you can follow.


Second Solution:

As stated in comments, you can also use the Fontastic Library which seems to be a great tool for creating new Fonts, It allows you to make fonts based on data, sensors, live feeds, or any other algorithm, or manipulate existing fonts to create your own version.

These are the basic steps needed to show you how it works. For a full reference see the Documentation.

How to create a new Fontastic object:

Fontastic f = new Fontastic(this, "ExampleFont");  // Create a new Fontastic object

How to set further font properties:

f.setAuthor("Andreas Koller"); 
           

How to create a glyph for the character A with a random shape of four points:

PVector[] points = new PVector[4];              // Define a PVector array containing the points of the shape
points[0] = new PVector(0, 0);                  // Start at bottom left
points[1] = new PVector(random(512), 0);        // The normal width is 512, the normal height 1024
points[2] = new PVector(random(512), random(1024)); // y coordinates are from bottom to top!
points[3] = new PVector(0, random(1024));

f.addGlyph('A').addContour(points);

         

How to generate the TrueType font file:

f.buildFont();  

                            
                                            

How to clean up afterwards:

f.cleanup();

              

You can see their examples.


Conclusion:

But in the two cases you will not be able to create Fonts from handwritten scanned images, Fantastic won't allow you to create a Font from images but it uses vector graphics to create Fonts, so in this case the solution would be :

  1. To use another tool to convert your images to vectors (Vector Magic, Inkscape, myScriptFont.com)

  2. Then create your Font using the generated vectors.


I have used this library: fontastic font maker

And that is how it works:

How to create a new Fontastic object:

Fontastic f = new Fontastic(this, "ExampleFont");  // Create a new Fontastic object

How to set further font properties:

f.setAuthor("Andreas Koller");                  // Set author name - will be saved in TTF file too

How to create a glyph for the character A with a random shape of four points(so here would be the points(or normalized points), which you have gathered before from user):

PVector[] points = new PVector[4];              // Define a PVector array containing the points of the shape
points[0] = new PVector(0, 0);                  // Start at bottom left
points[1] = new PVector(random(512), 0);        // The normal width is 512, the normal height 1024
points[2] = new PVector(random(512), random(1024)); // y coordinates are from bottom to top!
points[3] = new PVector(0, random(1024));

f.addGlyph('A').addContour(points);             // Assign contour to character A

How to generate the TrueType font file:

f.buildFont();                                  // Build the font resulting in .ttf and .woff files
                                                // and a HTML template to preview the WOFF