/* * ShowAWTFonts.java * Examples * * Created by Stuart MacKay on Wed Sep 03 2003. * Copyright (c) 2001-2004 Flagstone Software Ltd. All rights reserved. * * This code is distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND Flagstone HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING * WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. */ package com.flagstone.transform.util.examples; import com.flagstone.transform.*; import com.flagstone.transform.util.*; import com.flagstone.transform.examples.Example; import java.io.*; import java.util.*; import java.awt.*; /* * This example shows how the FSTextConstructor class can be used to generate a * font defintion using the fonts built into the Java AWT toolkit. The example * loads the font definition and generates a movie displaying the first 2048 * characters as a block of text containing 32 rows of 64 characters - enough * to display all the characters displayed in Latin and Cyrillic fonts along * with the majority of special characters and symbols. * * To run this example, type the following on a command line: * * java com.flagstone.util.examples.ShowAWTFonts [--resultDir path] * * where * * resultDir is the directory where the Flash files generated by the example is * written to. The files will be written to the directory where the example * was run if omitted. * * The example will generate one Flash file for each of the fonts available. The * names of the font will be used as the filename with a '.swf' suffix added. * * This example is almost identical to the ShowFontFile example which displays * a block of text using a font definition loaded from a Flash file or a TrueType/ * OpenType font definition. */ public class ShowAWTFonts extends Example { private FSTextConstructor textGenerator = null; private FSMovie movie = null; public static void main(String[] args) { new ShowAWTFonts(args); } public ShowAWTFonts(String[] args) { super(args); String fontName = null; String fileOut = null; try { Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); for (int i=0; i