fontsWithGlyphsGrid.frink

Download or view fontsWithGlyphsGrid.frink in plain text format

/** Locates all of the fonts that have all of the specified glyphs in the
    strings specified on the command-line. */


glyphs = "\u{12029}"   // CUNEIFORM SIGN ALAN

use GraphicsGrid.frink

// Read command-line arguments if they exist instead
if length[ARGS] > 0
    glyphs = join[" ", ARGS]

ge = callJava["java.awt.GraphicsEnvironment", "getLocalGraphicsEnvironment"]
fonts = ge.getAllFonts[]

grid = new GraphicsGrid[]

FONT:
for f = fonts
{
   for c = chars[glyphs]
      if ! f.canDisplay[c]
         next FONT

   g = new graphics
   g.font[f.getFontName[],1]
   g.text[glyphs,0,0]
      
   g.font["SansSerif",1/5]      
   splitName = f.getFontName[]
   splitName =~ %s/\./.\n/g
   splitName =~ %s/\s+/\n/g
   g.color[0.2, 0.2, 0.2]
   g.caption[splitName]
   grid.add[g]      
}

grid.layout[].show[]


Download or view fontsWithGlyphsGrid.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen, eliasen@mindspring.com