Skip to content
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/net/chocolapod/lwjgfont/cli
src
.gitignore
LICENSE.txt
README.md
pom.xml

README.md

Lightweight Java Game Font library

The Lightweight Java Game Font library (LWJGFont) is a solution for use any true type fonts on LWJGL. LWJGFont makes images which any characters of the true type font was drawn on, and packages into jar which contains these images and classes to use the characters with LWJGL.

How to use

Generate jar file to use any font on LWJGL

First of all, pre-compile your font file to use as texture on LWJGL.

$ mvn clean package  
$ java -jar target/lwjgfont-1.0.jar -x  
$ java -jar target/lwjgfont-1.0.jar sample/migu-1p-regular.ttf:35  

So myfont-1.0-SNAPSHOT.jar and myfont-1.0-SNAPSHOT.pom.xml will be generated on current directory.
This jar file contains subclass off net.chocolapod.lwjgfont.LWJGFont to use the specified font: migu-1p-regular.ttf (its size is 35.)

Install generated jar to local repository

$ mvn install:install-file -Dfile=myfont-1.0-SNAPSHOT.jar -DpomFile=myfont-1.0-SNAPSHOT.pom.xml \  
   -DgroupId=net.chocolapod.lwjgfont -DartifactId=myfont -Dversion=1.0-SNAPSHOT -Dpackaging=jar

Draw any string on your LWJGL game project.

Add the dependencies of the generated jar and LWJGFont into pom.xml.

<dependency>
    <groupId>net.chocolapod.lwjgfont</groupId>
    <artifactId>myfont</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

Now, draw a string on Java.

//  Load the font with LWJGFont.
LWJGFont    font = new Migu1pRegularH35Font();

//  Draw a string on the specified location.
font.drawString("いろはにほへと ちりぬるを", 100, 50, 0);

All generated classes by LWJGFont are subclass of LWJGFont.
LWJGFont has many utility methods to render strings on LWJGL.

These classes are included in net.chocolapod.lwjgfont package.

License

This software is released under the MIT License,
see LICENSE.txt or http://lwjgfont.chocolapod.net/LICENSE.txt

I am deeply grateful to

You can’t perform that action at this time.