/* * [GenerateCharts.java] * * Summary: Generate encoding charts. * * Copyright: (c) 2013-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2013-01-31 initial version */ package com.mindprod.encodings; import com.mindprod.csv.CSVReader; import com.mindprod.fastcat.FastCat; import com.mindprod.hunkio.HunkIO; import java.io.EOFException; import java.io.File; import java.io.FileReader; import java.io.IOException; import static java.lang.System.*; /** * Generate encoding charts. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2013-01-31 initial version * @since 2013 */ public final class GenerateCharts { /** * Generate a file in e:\mindprod\encodings for each encoding * One shot. Reads all.csv, which categorises all fonts * and builds charts just for some of them. Will have to be rerun if * new encodings added in a new JDK. * * @param args command line arguments ignored. */ public static void main( String args[] ) throws IOException { FileReader fr = new FileReader( "E:/com/mindprod/encodings/all.csv" ); CSVReader r = new CSVReader( fr, ',', '\"', "#", true, true, true, false ); File dir = new File( "E:/mindprod/jgloss/encoding" ); try { while ( true ) { String encoding = r.get(); int bits = r.getInt(); String endian = r.get(); r.skipToNextLine(); if ( bits == 8 || bits == 16 ) { FastCat sb = new FastCat( 7 ); sb.append( "\n\n" ); File gf = new File( dir, encoding.toLowerCase() + ".html" ); HunkIO.writeEntireFile( gf, sb.toString() ); // will have to insert some of these lines manually. out.println( "" + encoding + "" + encoding + "" ); } } } catch ( EOFException e ) { } } // end main }