Class VerifyGlyphExists

java.lang.Object
VerifyGlyphExists

public class VerifyGlyphExists extends Object
Simple command-line program to test whether a given font has a glyph available for a given Unicode codepoint, expressed as an integer.
 java VerifyGlyphExists 945 /path/to/fontfile
 

If the glyph is available, output will look something like "FOUND α for java.awt.Font[family=Kochi Gothic,name=Kochi Gothic, style=plain,size=12] from /usr/share/fonts/truetype/kochi/kochi-gothic.ttf"; if not available, will look something like "NO GLYPH α for java.awt.Font[family=Lohit Bengali,name=Lohit Bengali,style=plain,size=12] from /usr/share/fonts/truetype/ttf-bengali-fonts/lohit_bn.ttf".

Test for the glyph relies on java.awt.Font.canDisplay(codepoint).

Arguments: valid arguments are either code point and font-file path, or code point and font-list path. Font-list must be a text file with one line per font-file path. When providing a font list, the program will loop over all font files listed in the font-list, and check each one for support of the glyph.

  • Constructor Details

    • VerifyGlyphExists

      public VerifyGlyphExists()
  • Method Details

    • main

      public static void main(String[] args)
    • readLines

      private static List<String> readLines(File file)
    • testForGlyph

      private static void testForGlyph(int codePoint, File file)
    • loadFont

      private static Font loadFont(String fontPath) throws IOException
      Throws:
      IOException
    • error

      private static void error(String msg)