diff --git a/runelite-client/src/main/java/net/runelite/client/config/FontType.java b/runelite-client/src/main/java/net/runelite/client/config/FontType.java new file mode 100644 index 0000000000..8ed57bd302 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/config/FontType.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2018, Tanner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.config; + +import lombok.RequiredArgsConstructor; +import lombok.Getter; +import net.runelite.client.ui.FontManager; + +import java.awt.Font; + +@Getter +@RequiredArgsConstructor +public enum FontType +{ + REGULAR("Regular", FontManager.getRunescapeFont()), + BOLD("Bold", FontManager.getRunescapeBoldFont()), + SMALL("Small", FontManager.getRunescapeSmallFont()); + + private final String name; + private final Font font; + + @Override + public String toString() + { + return name; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java b/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java index 507c68acda..e2c1293b64 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java @@ -116,12 +116,12 @@ public interface RuneLiteConfig extends Config } @ConfigItem( - keyName = "useSmallFont", - name = "Small font in dynamic overlays", - description = "Toggles between small and regular RuneScape font for in-game overlays" + keyName = "fontType", + name = "Dynamic Overlay Font", + description = "Configures what font type is used for in-game overlays such as player name, ground items, etc." ) - default boolean useSmallFont() + default FontType fontType() { - return true; + return FontType.SMALL; } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/ui/FontManager.java b/runelite-client/src/main/java/net/runelite/client/ui/FontManager.java index 3ffb544036..b6fdac5172 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/FontManager.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/FontManager.java @@ -34,6 +34,7 @@ public class FontManager { private static final Font runescapeFont; private static final Font runescapeSmallFont; + private static final Font runescapeBoldFont; static { @@ -58,6 +59,15 @@ public class FontManager runescapeSmallFont = StyleContext.getDefaultStyleContext() .getFont(smallFont.getName(), Font.PLAIN, 16); ge.registerFont(runescapeSmallFont); + + Font boldFont = Font.createFont(Font.TRUETYPE_FONT, + FontManager.class.getResourceAsStream("runescape_bold.ttf")) + .deriveFont(Font.PLAIN, 16); + ge.registerFont(boldFont); + + runescapeBoldFont = StyleContext.getDefaultStyleContext() + .getFont(boldFont.getName(), Font.PLAIN, 16); + ge.registerFont(runescapeBoldFont); } catch (FontFormatException ex) { @@ -78,4 +88,9 @@ public class FontManager { return runescapeSmallFont; } + + public static Font getRunescapeBoldFont() + { + return runescapeBoldFont; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java index 7099aec931..5ea3c01094 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java @@ -506,11 +506,19 @@ public class OverlayRenderer extends MouseListener implements KeyListener final OverlayPosition position = overlay.getPosition(); // Set font based on configuration - subGraphics.setFont((position == OverlayPosition.DYNAMIC - || position == OverlayPosition.TOOLTIP) - && runeLiteConfig.useSmallFont() - ? FontManager.getRunescapeSmallFont() - : FontManager.getRunescapeFont()); + if (position == OverlayPosition.DYNAMIC) + { + subGraphics.setFont(runeLiteConfig.fontType().getFont()); + } + else if (position == OverlayPosition.TOOLTIP) + { + subGraphics.setFont(FontManager.getRunescapeSmallFont()); + } + else + { + subGraphics.setFont(FontManager.getRunescapeFont()); + } + subGraphics.translate(point.x, point.y); final Dimension dimension = MoreObjects.firstNonNull(overlay.render(subGraphics), new Dimension()); diff --git a/runelite-client/src/main/resources/net/runelite/client/ui/runescape_bold.ttf b/runelite-client/src/main/resources/net/runelite/client/ui/runescape_bold.ttf new file mode 100644 index 0000000000..e45ca05846 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/ui/runescape_bold.ttf differ