From 45841657a03e0436a26a6cacecc135ceb625c10d Mon Sep 17 00:00:00 2001 From: bancika Date: Thu, 27 Sep 2012 16:17:56 +0000 Subject: [PATCH] Mirrored text for PCB artwork --- .../src/org/diylc/components/misc/PCBText.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-library/src/org/diylc/components/misc/PCBText.java b/ diy-layout-creator --username bancika@gmail.com/diylc-library/src/org/diylc/components/misc/PCBText.java index a28ec151..93e7f9e5 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-library/src/org/diylc/components/misc/PCBText.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-library/src/org/diylc/components/misc/PCBText.java @@ -26,7 +26,7 @@ public class PCBText extends AbstractComponent { public static String DEFAULT_TEXT = "Double click to edit text"; - public static Font DEFAULT_FONT = new Font("Courier New", Font.BOLD, 14); + public static Font DEFAULT_FONT = new Font("Courier New", Font.BOLD, 15); private static final long serialVersionUID = 1L; @@ -106,8 +106,8 @@ public class PCBText extends AbstractComponent { @Override public void drawIcon(Graphics2D g2d, int width, int height) { g2d.setColor(LABEL_COLOR); - g2d.setFont(LABEL_FONT.deriveFont(13f * width / 32).deriveFont( - Font.PLAIN)); + g2d.setFont(DEFAULT_FONT.deriveFont(15f * width / 32).deriveFont( + Font.BOLD)); FontMetrics fontMetrics = g2d.getFontMetrics(); Rectangle2D rect = fontMetrics.getStringBounds("Abc", g2d); @@ -118,6 +118,8 @@ public class PCBText extends AbstractComponent { // Center text horizontally and vertically. int x = (width - textWidth) / 2 + 1; int y = (height - textHeight) / 2 + fontMetrics.getAscent(); + g2d.scale(-1, 1); + g2d.translate(-width, 0); g2d.drawString("Abc", x, y); }