package readers.fonts; import java.awt.image.BufferedImage; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.List; import java.awt.Color; public class Font { Glyph[] data = new Glyph[10]; final static int TRANSPARENT = new Color(0,0,0,0).getRGB(); final public static Font FONT_DDR_DIFF = LoadFont("ddr_diff"); final public static Font FONT_DDR_EXCOMBO = LoadFont("ddr_excombo"); final public static Font FONT_DDR_NOTECOUNT = LoadFont("ddr_noteCount"); final public static Font FONT_DDR_SCORE = LoadFont("ddr_score"); final public static Font FONT_ITG_DIFF = LoadFont("itg_diff"); final public static Font FONT_ITG_EX = LoadFont("itg_ex"); final public static Font FONT_ITG_NOTECOUNT = LoadFont("itg_noteCount"); final public static Font FONT_ITG_PCT = LoadFont("itg_pct"); final public static Font FONT_LOVELIVE_NOTECOUNT = LoadFont("lovelive_noteCount"); final public static Font FONT_LOVELIVE_PCT = LoadFont("lovelive_pct"); final public static Font FONT_LOVELIVE_SCORE = LoadFont("lovelive_score"); final public static Font FONT_POPN_COMBO = LoadFont("popn_combo"); final public static Font FONT_POPN_NOTECOUNT = LoadFont("popn_noteCount"); final public static Font FONT_POPN_SCORE = LoadFont("popn_score"); final public static Font FONT_SDVX_EXSCORE = LoadFont("sdvx_EXScore"); final public static Font FONT_SDVX_LITTLESCORE = LoadFont("sdvx_littleScore"); final public static Font FONT_SDVX_NOTECOUNT = LoadFont("sdvx_noteCount"); final public static Font FONT_SDVX_BIGSCORE = LoadFont("sdvx_largeScore"); public static Font LoadFont(String fontName) { Path f = Paths.get("readers","fonts",fontName); if (Files.exists(f)) { Font font = new Font(); try { List data = Files.readAllLines(f); for (int i=0;iendY) { endY=Y; } } } g.height=endY-startY; g.data = new boolean[g.width*g.height]; for (int X=0;X=0&&index glyphs) { return convertGlyphs(glyphs,false); } public String convertGlyphs(List glyphs,boolean debug) { StringBuilder sb = new StringBuilder(); for (int i=0;i=0&&a_x=0&&a_y2) { score-=(g_b.width-g_a.width)*g_b.height; } else if (g_b.height-g_a.height>2) { score-=(g_b.height-g_a.height)*g_b.width; } if (score>bestScore) { bestScore=score; bestGlyph=j; if (debug) { System.out.println("Glyph "+j+" has a score of "+bestScore+"."); } } else { if (debug) { System.out.println(" Glyph "+j+" has a score of "+score+"."); } } } sb.append(bestGlyph); } if (debug) { System.out.println(sb.toString()+"\n========"); } return sb.toString(); } }