ui: add infobox font config

Co-authored-by: Vanilj <robindavidsson@outlook.com>
This commit is contained in:
Adam
2022-01-07 18:32:49 -05:00
parent 4330d9f939
commit 791912a7c0
3 changed files with 19 additions and 2 deletions

View File

@@ -332,11 +332,23 @@ public interface RuneLiteConfig extends Config
return FontType.REGULAR;
}
@ConfigItem(
keyName = "infoboxFontType",
name = "Infobox Font",
description = "Configures what font type is used for infoboxes.",
position = 33,
section = overlaySettings
)
default FontType infoboxFontType()
{
return FontType.REGULAR;
}
@ConfigItem(
keyName = "menuEntryShift",
name = "Require Shift for overlay menu",
description = "Overlay right-click menu will require shift to be added",
position = 33,
position = 34,
section = overlaySettings
)
default boolean menuEntryShift()

View File

@@ -27,6 +27,7 @@ package net.runelite.client.ui.overlay.components;
import com.google.common.base.Strings;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Point;
@@ -53,6 +54,7 @@ public class InfoBoxComponent implements LayoutableRenderableEntity
private Dimension preferredSize = new Dimension(DEFAULT_SIZE, DEFAULT_SIZE);
private String text;
private Color color = Color.WHITE;
private Font font;
private boolean outline;
private Color backgroundColor = ComponentConstants.STANDARD_BACKGROUND_COLOR;
private BufferedImage image;
@@ -67,7 +69,7 @@ public class InfoBoxComponent implements LayoutableRenderableEntity
return new Dimension();
}
graphics.setFont(getSize() < DEFAULT_SIZE ? FontManager.getRunescapeSmallFont() : FontManager.getRunescapeFont());
graphics.setFont(getSize() < DEFAULT_SIZE ? FontManager.getRunescapeSmallFont() : font);
final int baseX = preferredLocation.x;
final int baseY = preferredLocation.y;

View File

@@ -28,6 +28,7 @@ package net.runelite.client.ui.overlay.infobox;
import com.google.common.base.Strings;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
@@ -122,6 +123,7 @@ public class InfoBoxOverlay extends OverlayPanel
panelComponent.setPreferredSize(new Dimension(DEFAULT_WRAP_COUNT * (config.infoBoxSize() + GAP), DEFAULT_WRAP_COUNT * (config.infoBoxSize() + GAP)));
panelComponent.setOrientation(orientation);
final Font font = config.infoboxFontType().getFont();
for (InfoBox box : infoBoxes)
{
if (!box.render())
@@ -134,6 +136,7 @@ public class InfoBoxOverlay extends OverlayPanel
final InfoBoxComponent infoBoxComponent = new InfoBoxComponent();
infoBoxComponent.setText(text);
infoBoxComponent.setFont(font);
if (color != null)
{
infoBoxComponent.setColor(color);