ui: add infobox font config
Co-authored-by: Vanilj <robindavidsson@outlook.com>
This commit is contained in:
@@ -332,11 +332,23 @@ public interface RuneLiteConfig extends Config
|
|||||||
return FontType.REGULAR;
|
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(
|
@ConfigItem(
|
||||||
keyName = "menuEntryShift",
|
keyName = "menuEntryShift",
|
||||||
name = "Require Shift for overlay menu",
|
name = "Require Shift for overlay menu",
|
||||||
description = "Overlay right-click menu will require shift to be added",
|
description = "Overlay right-click menu will require shift to be added",
|
||||||
position = 33,
|
position = 34,
|
||||||
section = overlaySettings
|
section = overlaySettings
|
||||||
)
|
)
|
||||||
default boolean menuEntryShift()
|
default boolean menuEntryShift()
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ package net.runelite.client.ui.overlay.components;
|
|||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Font;
|
||||||
import java.awt.FontMetrics;
|
import java.awt.FontMetrics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
@@ -53,6 +54,7 @@ public class InfoBoxComponent implements LayoutableRenderableEntity
|
|||||||
private Dimension preferredSize = new Dimension(DEFAULT_SIZE, DEFAULT_SIZE);
|
private Dimension preferredSize = new Dimension(DEFAULT_SIZE, DEFAULT_SIZE);
|
||||||
private String text;
|
private String text;
|
||||||
private Color color = Color.WHITE;
|
private Color color = Color.WHITE;
|
||||||
|
private Font font;
|
||||||
private boolean outline;
|
private boolean outline;
|
||||||
private Color backgroundColor = ComponentConstants.STANDARD_BACKGROUND_COLOR;
|
private Color backgroundColor = ComponentConstants.STANDARD_BACKGROUND_COLOR;
|
||||||
private BufferedImage image;
|
private BufferedImage image;
|
||||||
@@ -67,7 +69,7 @@ public class InfoBoxComponent implements LayoutableRenderableEntity
|
|||||||
return new Dimension();
|
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 baseX = preferredLocation.x;
|
||||||
final int baseY = preferredLocation.y;
|
final int baseY = preferredLocation.y;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ package net.runelite.client.ui.overlay.infobox;
|
|||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Font;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Rectangle;
|
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.setPreferredSize(new Dimension(DEFAULT_WRAP_COUNT * (config.infoBoxSize() + GAP), DEFAULT_WRAP_COUNT * (config.infoBoxSize() + GAP)));
|
||||||
panelComponent.setOrientation(orientation);
|
panelComponent.setOrientation(orientation);
|
||||||
|
|
||||||
|
final Font font = config.infoboxFontType().getFont();
|
||||||
for (InfoBox box : infoBoxes)
|
for (InfoBox box : infoBoxes)
|
||||||
{
|
{
|
||||||
if (!box.render())
|
if (!box.render())
|
||||||
@@ -134,6 +136,7 @@ public class InfoBoxOverlay extends OverlayPanel
|
|||||||
|
|
||||||
final InfoBoxComponent infoBoxComponent = new InfoBoxComponent();
|
final InfoBoxComponent infoBoxComponent = new InfoBoxComponent();
|
||||||
infoBoxComponent.setText(text);
|
infoBoxComponent.setText(text);
|
||||||
|
infoBoxComponent.setFont(font);
|
||||||
if (color != null)
|
if (color != null)
|
||||||
{
|
{
|
||||||
infoBoxComponent.setColor(color);
|
infoBoxComponent.setColor(color);
|
||||||
|
|||||||
Reference in New Issue
Block a user