From 36e86c6619b9d7537ed0dc2a505296d17403258a Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Thu, 25 Jun 2020 06:01:34 +0200 Subject: [PATCH] TextComponent: Draw outline using one axis offset at a time This commit prevents fonts with thin and angled glyphs from having gaps between the characters and their outline by offsetting outline draws in one direction exclusively. (cherry picked from commit 8d1f0287587722b3055bf6c196ec836bcdc45296) --- .../ui/overlay/components/TextComponent.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/TextComponent.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/TextComponent.java index 77375541bc..cac5c61e2b 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/TextComponent.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/TextComponent.java @@ -47,7 +47,8 @@ public class TextComponent implements RenderableEntity private String text; private Point position = new Point(); private Color color = Color.WHITE; - private Color borderColor = Color.BLACK; + private boolean outline; + private boolean alpha; // Generates a lot of garbage! @Override public Dimension render(Graphics2D graphics) @@ -71,8 +72,20 @@ public class TextComponent implements RenderableEntity } else { - renderText(graphics, position.x, position.y, text, color, borderColor); + if (alpha) + { + drawAlpha(graphics, position.x, position.y, text, color); + } + else + { + drawOutline(graphics, text); + + // actual text + graphics.setColor(color); + graphics.drawString(text, position.x, position.y); + } } + return new Dimension(fontMetrics.stringWidth(text), fontMetrics.getHeight()); }