diff --git a/src/main/java/net/rptools/maptool/client/ui/zone/renderer/ZoneRenderer.java b/src/main/java/net/rptools/maptool/client/ui/zone/renderer/ZoneRenderer.java
index 9f029a479a..23f7e91ed4 100644
--- a/src/main/java/net/rptools/maptool/client/ui/zone/renderer/ZoneRenderer.java
+++ b/src/main/java/net/rptools/maptool/client/ui/zone/renderer/ZoneRenderer.java
@@ -1220,7 +1220,9 @@ private void renderLabels(Graphics2D g, PlayerView view) {
timer.start("labels-1.1");
ScreenPoint sp = ScreenPoint.fromZonePointRnd(this, zp.x, zp.y);
var dim = flabel.getDimensions(g, label.getLabel());
- Rectangle bounds = flabel.render(g, (int) sp.x, (int) sp.y, label.getLabel());
+ Rectangle bounds =
+ flabel.render(
+ g, (int) (sp.x - dim.width / 2), (int) (sp.y - dim.height / 2), label.getLabel());
labelLocationList.add(new LabelLocation(bounds, label));
timer.stop("labels-1.1");
}
diff --git a/src/main/java/net/rptools/maptool/model/transform/campaign/LabelFontAndBGTransform.java b/src/main/java/net/rptools/maptool/model/transform/campaign/LabelFontAndBGTransform.java
index f0098baecb..7f88abfecf 100644
--- a/src/main/java/net/rptools/maptool/model/transform/campaign/LabelFontAndBGTransform.java
+++ b/src/main/java/net/rptools/maptool/model/transform/campaign/LabelFontAndBGTransform.java
@@ -28,10 +28,22 @@ public class LabelFontAndBGTransform implements ModelVersionTransformation {
/** The end label tag that we want to replace. */
private static final String endLabelTag = "";
+ /** The pattern that we want o match for 0 foreground color. */
+ private static final String replace0ForegroundTags =
+ "0[^<]*" + endLabelTag;
+
+ /**
+ * The foreground color that we want to use for the label where the legacy foreground color is 0.
+ */
+ private static final Color legacyForegroundColor = new Color(0.0f, 0.0f, 0.0f, 1.0f);
+
+ private static final String foreground0Replacement =
+ "" + legacyForegroundColor.getRGB() + "\n" + endLabelTag;
+
/** The background color that we want to use for the new label tag. */
private static final Color legacyBackgroundColor = new Color(0.82f, 0.82f, 0.82f, 1.0f);
- /** The replacement string that we want to use for the end label tag. */
+ /** The replacement string that we want to use for the new label tag. */
private static final String replacement =
""
+ legacyBackgroundColor.getRGB()
@@ -54,8 +66,13 @@ public class LabelFontAndBGTransform implements ModelVersionTransformation {
/** The pattern that we want to use to match the end label tag. */
private static final Pattern pattern = Pattern.compile(endLabelTag, Pattern.DOTALL);
+ /** The pattern that we want to use to match the legacy foreground color of 0. */
+ private static final Pattern replace0Foreground =
+ Pattern.compile(replace0ForegroundTags, Pattern.DOTALL);
+
@Override
public String transform(String xml) {
- return pattern.matcher(xml).replaceAll(replacement);
+ String replace0 = replace0Foreground.matcher(xml).replaceAll(foreground0Replacement);
+ return pattern.matcher(replace0).replaceAll(replacement);
}
}