/** * Parse a single character line from the definition * * @param line The line to be parsed * @return The character definition from the line * @throws SlickException Indicates a given character is not valid in an angel code font */ private CharDef parseChar(String line) throws SlickException { CharDef def = new CharDef(); StringTokenizer tokens = new StringTokenizer(line, " ="); tokens.nextToken(); // char tokens.nextToken(); // id def.id = Short.parseShort(tokens.nextToken()); // id value if (def.id < 0) { return null; } if (def.id > MAX_CHAR) { throw new SlickException( "Invalid character '" + def.id + "': AngelCodeFont does not support characters above " + MAX_CHAR); } tokens.nextToken(); // x def.x = Short.parseShort(tokens.nextToken()); // x value tokens.nextToken(); // y def.y = Short.parseShort(tokens.nextToken()); // y value tokens.nextToken(); // width def.width = Short.parseShort(tokens.nextToken()); // width value tokens.nextToken(); // height def.height = Short.parseShort(tokens.nextToken()); // height value tokens.nextToken(); // x offset def.xoffset = Short.parseShort(tokens.nextToken()); // xoffset value tokens.nextToken(); // y offset def.yoffset = Short.parseShort(tokens.nextToken()); // yoffset value tokens.nextToken(); // xadvance def.xadvance = Short.parseShort(tokens.nextToken()); // xadvance def.init(); if (def.id != ' ') { lineHeight = Math.max(def.height + def.yoffset, lineHeight); } return def; }