From 8d1f0287587722b3055bf6c196ec836bcdc45296 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Wed, 24 Jun 2020 21:01:34 -0700 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. --- .../ui/overlay/components/TextComponent.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 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 5c7f47bf2a..3b10b3561b 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 @@ -60,15 +60,19 @@ public class TextComponent implements RenderableEntity final String textWithoutCol = Text.removeTags(textSplitOnCol); final String colColor = textSplitOnCol.substring(textSplitOnCol.indexOf("=") + 1, textSplitOnCol.indexOf(">")); - // shadow graphics.setColor(Color.BLACK); - graphics.drawString(textWithoutCol, x + 1, position.y + 1); if (outline) { - graphics.drawString(textWithoutCol, x - 1, position.y - 1); - graphics.drawString(textWithoutCol, x - 1, position.y + 1); - graphics.drawString(textWithoutCol, x + 1, position.y - 1); + graphics.drawString(textWithoutCol, x, position.y + 1); + graphics.drawString(textWithoutCol, x, position.y - 1); + graphics.drawString(textWithoutCol, x + 1, position.y); + graphics.drawString(textWithoutCol, x - 1, position.y); + } + else + { + // shadow + graphics.drawString(textWithoutCol, x + 1, position.y + 1); } // actual text @@ -80,15 +84,19 @@ public class TextComponent implements RenderableEntity } else { - // shadow graphics.setColor(Color.BLACK); - graphics.drawString(text, position.x + 1, position.y + 1); if (outline) { - graphics.drawString(text, position.x - 1, position.y - 1); - graphics.drawString(text, position.x - 1, position.y + 1); - graphics.drawString(text, position.x + 1, position.y - 1); + graphics.drawString(text, position.x, position.y + 1); + graphics.drawString(text, position.x, position.y - 1); + graphics.drawString(text, position.x + 1, position.y); + graphics.drawString(text, position.x - 1, position.y); + } + else + { + // shadow + graphics.drawString(text, position.x + 1, position.y + 1); } // actual text