Changed font to Droid Sans Fallback v2.55b. (fixes #65)

Generally much cleaner than Kochi Gothic, and half the file size.  Uses an older version of the font, since many glyphs were removed in later versions (due to the glyphs being supported in other Google fonts).

Droid Sans Fallback is licensed under the Apache License, Version 2.0.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-05-15 01:33:53 -04:00
parent 8f48d9495e
commit 6c8d4ea49a
10 changed files with 27 additions and 32 deletions

BIN
res/DroidSansFallback.ttf Normal file

Binary file not shown.

Binary file not shown.

View File

@ -823,13 +823,12 @@ public class GameData {
g.setColor(Utils.COLOR_BLACK_ALPHA); g.setColor(Utils.COLOR_BLACK_ALPHA);
g.fillRect(0, 0, width, 100 * uiScale); g.fillRect(0, 0, width, 100 * uiScale);
rankingTitle.draw((width * 0.97f) - rankingTitle.getWidth(), 0); rankingTitle.draw((width * 0.97f) - rankingTitle.getWidth(), 0);
float c = width * 0.01f; float marginX = width * 0.01f, marginY = height * 0.002f;
Utils.FONT_LARGE.drawString(c, c, Utils.FONT_LARGE.drawString(marginX, marginY,
String.format("%s - %s [%s]", osu.getArtist(), osu.getTitle(), osu.version), Color.white); String.format("%s - %s [%s]", osu.getArtist(), osu.getTitle(), osu.version), Color.white);
Utils.FONT_MEDIUM.drawString(c, c + Utils.FONT_LARGE.getLineHeight() - 6, Utils.FONT_MEDIUM.drawString(marginX, marginY + Utils.FONT_LARGE.getLineHeight() - 6,
String.format("Beatmap by %s", osu.creator), Color.white); String.format("Beatmap by %s", osu.creator), Color.white);
Utils.FONT_MEDIUM.drawString( Utils.FONT_MEDIUM.drawString(marginX, marginY + Utils.FONT_LARGE.getLineHeight() + Utils.FONT_MEDIUM.getLineHeight() - 10,
c, c + Utils.FONT_LARGE.getLineHeight() + Utils.FONT_MEDIUM.getLineHeight() - 10,
String.format("Played on %s.", scoreData.getTimeString()), Color.white); String.format("Played on %s.", scoreData.getTimeString()), Color.white);
// mod icons // mod icons

View File

@ -69,7 +69,7 @@ public class Options {
public static final File SCORE_DB = new File(DATA_DIR, ".opsu_scores.db"); public static final File SCORE_DB = new File(DATA_DIR, ".opsu_scores.db");
/** Font file name. */ /** Font file name. */
public static final String FONT_NAME = "kochi-gothic.ttf"; public static final String FONT_NAME = "DroidSansFallback.ttf";
/** Version file name. */ /** Version file name. */
public static final String VERSION_FILE = "version"; public static final String VERSION_FILE = "version";

View File

@ -80,7 +80,7 @@ public class OsuGroupNode {
} }
bg.draw(x, y, bgColor); bg.draw(x, y, bgColor);
float cx = x + (bg.getWidth() * 0.05f); float cx = x + (bg.getWidth() * 0.043f);
float cy = y + (bg.getHeight() * 0.2f) - 3; float cy = y + (bg.getHeight() * 0.2f) - 3;
// draw grade // draw grade
@ -96,10 +96,10 @@ public class OsuGroupNode {
Utils.loadGlyphs(Utils.FONT_DEFAULT, null, osu.artistUnicode); Utils.loadGlyphs(Utils.FONT_DEFAULT, null, osu.artistUnicode);
} }
Utils.FONT_MEDIUM.drawString(cx, cy, osu.getTitle(), textColor); Utils.FONT_MEDIUM.drawString(cx, cy, osu.getTitle(), textColor);
Utils.FONT_DEFAULT.drawString(cx, cy + Utils.FONT_MEDIUM.getLineHeight() - 4, Utils.FONT_DEFAULT.drawString(cx, cy + Utils.FONT_MEDIUM.getLineHeight() - 2,
String.format("%s // %s", osu.getArtist(), osu.creator), textColor); String.format("%s // %s", osu.getArtist(), osu.creator), textColor);
if (expanded || osuFiles.size() == 1) if (expanded || osuFiles.size() == 1)
Utils.FONT_BOLD.drawString(cx, cy + Utils.FONT_MEDIUM.getLineHeight() + Utils.FONT_DEFAULT.getLineHeight() - 8, Utils.FONT_BOLD.drawString(cx, cy + Utils.FONT_MEDIUM.getLineHeight() + Utils.FONT_DEFAULT.getLineHeight() - 4,
osu.version, textColor); osu.version, textColor);
} }

View File

@ -193,7 +193,7 @@ public class UI {
public static void drawTab(float x, float y, String text, boolean selected, boolean isHover) { public static void drawTab(float x, float y, String text, boolean selected, boolean isHover) {
Image tabImage = GameImage.MENU_TAB.getImage(); Image tabImage = GameImage.MENU_TAB.getImage();
float tabTextX = x - (Utils.FONT_MEDIUM.getWidth(text) / 2); float tabTextX = x - (Utils.FONT_MEDIUM.getWidth(text) / 2);
float tabTextY = y - (tabImage.getHeight() / 2.5f); float tabTextY = y - (tabImage.getHeight() / 2);
Color filter, textColor; Color filter, textColor;
if (selected) { if (selected) {
filter = Color.white; filter = Color.white;

View File

@ -167,12 +167,12 @@ public class Utils {
FONT_MEDIUM = new UnicodeFont(font.deriveFont(fontBase * 3 / 2)); FONT_MEDIUM = new UnicodeFont(font.deriveFont(fontBase * 3 / 2));
FONT_SMALL = new UnicodeFont(font.deriveFont(fontBase)); FONT_SMALL = new UnicodeFont(font.deriveFont(fontBase));
ColorEffect colorEffect = new ColorEffect(); ColorEffect colorEffect = new ColorEffect();
loadFont(FONT_DEFAULT, 2, colorEffect); loadFont(FONT_DEFAULT, colorEffect);
loadFont(FONT_BOLD, 2, colorEffect); loadFont(FONT_BOLD, colorEffect);
loadFont(FONT_XLARGE, 4, colorEffect); loadFont(FONT_XLARGE, colorEffect);
loadFont(FONT_LARGE, 4, colorEffect); loadFont(FONT_LARGE, colorEffect);
loadFont(FONT_MEDIUM, 3, colorEffect); loadFont(FONT_MEDIUM, colorEffect);
loadFont(FONT_SMALL, 1, colorEffect); loadFont(FONT_SMALL, colorEffect);
} catch (Exception e) { } catch (Exception e) {
ErrorHandler.error("Failed to load fonts.", e, true); ErrorHandler.error("Failed to load fonts.", e, true);
} }
@ -340,15 +340,11 @@ public class Utils {
/** /**
* Loads a Unicode font. * Loads a Unicode font.
* @param font the font to load * @param font the font to load
* @param padding the top and bottom padding
* @param effect the font effect * @param effect the font effect
* @throws SlickException * @throws SlickException
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static void loadFont(UnicodeFont font, int padding, private static void loadFont(UnicodeFont font, Effect effect) throws SlickException {
Effect effect) throws SlickException {
font.setPaddingTop(padding);
font.setPaddingBottom(padding);
font.addAsciiGlyphs(); font.addAsciiGlyphs();
font.getEffects().add(effect); font.getEffects().add(effect);
font.loadGlyphs(); font.loadGlyphs();

View File

@ -86,7 +86,7 @@ public class DownloadNode {
buttonBaseX = width * 0.024f; buttonBaseX = width * 0.024f;
buttonBaseY = height * 0.2f; buttonBaseY = height * 0.2f;
buttonWidth = width * 0.7f; buttonWidth = width * 0.7f;
buttonHeight = Utils.FONT_MEDIUM.getLineHeight() * 2f; buttonHeight = Utils.FONT_MEDIUM.getLineHeight() * 2.1f;
buttonOffset = buttonHeight * 1.1f; buttonOffset = buttonHeight * 1.1f;
// download info // download info

View File

@ -270,25 +270,25 @@ public class MainMenu extends BasicGameState {
} }
// draw text // draw text
float marginX = width * 0.015f, marginY = height * 0.015f; float marginX = width * 0.015f, topMarginY = height * 0.01f, bottomMarginY = height * 0.015f;
g.setFont(Utils.FONT_MEDIUM); g.setFont(Utils.FONT_MEDIUM);
int lineHeight = Utils.FONT_MEDIUM.getLineHeight() * 9 / 10; float lineHeight = Utils.FONT_MEDIUM.getLineHeight() * 0.925f;
g.drawString(String.format("Loaded %d songs and %d beatmaps.", g.drawString(String.format("Loaded %d songs and %d beatmaps.",
OsuGroupList.get().getMapSetCount(), OsuGroupList.get().getMapCount()), marginX, marginY); OsuGroupList.get().getMapSetCount(), OsuGroupList.get().getMapCount()), marginX, topMarginY);
if (MusicController.isTrackLoading()) if (MusicController.isTrackLoading())
g.drawString("Track loading...", marginX, marginY + lineHeight); g.drawString("Track loading...", marginX, topMarginY + lineHeight);
else if (MusicController.trackExists()) { else if (MusicController.trackExists()) {
if (Options.useUnicodeMetadata()) // load glyphs if (Options.useUnicodeMetadata()) // load glyphs
Utils.loadGlyphs(Utils.FONT_MEDIUM, osu.titleUnicode, osu.artistUnicode); Utils.loadGlyphs(Utils.FONT_MEDIUM, osu.titleUnicode, osu.artistUnicode);
g.drawString((MusicController.isPlaying()) ? "Now Playing:" : "Paused:", marginX, marginY + lineHeight); g.drawString((MusicController.isPlaying()) ? "Now Playing:" : "Paused:", marginX, topMarginY + lineHeight);
g.drawString(String.format("%s: %s", osu.getArtist(), osu.getTitle()), marginX + 25, marginY + (lineHeight * 2)); g.drawString(String.format("%s: %s", osu.getArtist(), osu.getTitle()), marginX + 25, topMarginY + (lineHeight * 2));
} }
g.drawString(String.format("opsu! has been running for %s.", g.drawString(String.format("opsu! has been running for %s.",
Utils.getTimeString((int) (System.currentTimeMillis() - osuStartTime) / 1000)), Utils.getTimeString((int) (System.currentTimeMillis() - osuStartTime) / 1000)),
marginX, height - marginY - (lineHeight * 2)); marginX, height - bottomMarginY - (lineHeight * 2));
g.drawString(String.format("It is currently %s.", g.drawString(String.format("It is currently %s.",
new SimpleDateFormat("h:mm a").format(new Date())), new SimpleDateFormat("h:mm a").format(new Date())),
marginX, height - marginY - lineHeight); marginX, height - bottomMarginY - lineHeight);
UI.draw(g); UI.draw(g);
} }

View File

@ -344,9 +344,9 @@ public class SongMenu extends BasicGameState {
} }
} }
marginX += 5; marginX += 5;
float headerTextY = marginY; float headerTextY = marginY * 0.2f;
Utils.FONT_LARGE.drawString(marginX + iconWidth * 1.05f, headerTextY, songInfo[0], Color.white); Utils.FONT_LARGE.drawString(marginX + iconWidth * 1.05f, headerTextY, songInfo[0], Color.white);
headerTextY += Utils.FONT_LARGE.getLineHeight() - 8; headerTextY += Utils.FONT_LARGE.getLineHeight() - 4;
Utils.FONT_DEFAULT.drawString(marginX + iconWidth * 1.05f, headerTextY, songInfo[1], Color.white); Utils.FONT_DEFAULT.drawString(marginX + iconWidth * 1.05f, headerTextY, songInfo[1], Color.white);
headerTextY += Utils.FONT_DEFAULT.getLineHeight() - 2; headerTextY += Utils.FONT_DEFAULT.getLineHeight() - 2;
float speedModifier = GameMod.getSpeedMultiplier(); float speedModifier = GameMod.getSpeedMultiplier();