Merge pull request #11977 from Nightfirecat/fix-text-outline
TextComponent: Draw outline using one axis offset at a time
This commit is contained in:
@@ -60,15 +60,19 @@ public class TextComponent implements RenderableEntity
|
|||||||
final String textWithoutCol = Text.removeTags(textSplitOnCol);
|
final String textWithoutCol = Text.removeTags(textSplitOnCol);
|
||||||
final String colColor = textSplitOnCol.substring(textSplitOnCol.indexOf("=") + 1, textSplitOnCol.indexOf(">"));
|
final String colColor = textSplitOnCol.substring(textSplitOnCol.indexOf("=") + 1, textSplitOnCol.indexOf(">"));
|
||||||
|
|
||||||
// shadow
|
|
||||||
graphics.setColor(Color.BLACK);
|
graphics.setColor(Color.BLACK);
|
||||||
graphics.drawString(textWithoutCol, x + 1, position.y + 1);
|
|
||||||
|
|
||||||
if (outline)
|
if (outline)
|
||||||
{
|
{
|
||||||
graphics.drawString(textWithoutCol, x - 1, position.y - 1);
|
graphics.drawString(textWithoutCol, x, position.y + 1);
|
||||||
graphics.drawString(textWithoutCol, x - 1, position.y + 1);
|
graphics.drawString(textWithoutCol, x, position.y - 1);
|
||||||
graphics.drawString(textWithoutCol, x + 1, 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
|
// actual text
|
||||||
@@ -80,15 +84,19 @@ public class TextComponent implements RenderableEntity
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// shadow
|
|
||||||
graphics.setColor(Color.BLACK);
|
graphics.setColor(Color.BLACK);
|
||||||
graphics.drawString(text, position.x + 1, position.y + 1);
|
|
||||||
|
|
||||||
if (outline)
|
if (outline)
|
||||||
{
|
{
|
||||||
graphics.drawString(text, position.x - 1, position.y - 1);
|
graphics.drawString(text, position.x, 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 + 1, 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
|
// actual text
|
||||||
|
|||||||
Reference in New Issue
Block a user