From 151cb017954eec935a38c7758dd937d4e82137af Mon Sep 17 00:00:00 2001
From: Jeff Young <jeff@rokeby.ie>
Date: Thu, 27 Mar 2025 22:50:12 +0000
Subject: [PATCH] Mirror pad numbers when appropriate.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20459
---
 include/plotters/plotter.h       | 3 +++
 pcbnew/plot_brditems_plotter.cpp | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/include/plotters/plotter.h b/include/plotters/plotter.h
index 4e77e6402e..04063466f9 100644
--- a/include/plotters/plotter.h
+++ b/include/plotters/plotter.h
@@ -138,6 +138,9 @@ public:
     virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_pageInfo = aPageSettings; }
     PAGE_INFO& PageSettings() { return m_pageInfo; }
 
+    void SetPlotMirrored( bool aMirror ) { m_plotMirror = aMirror; };
+    bool GetPlotMirrored() const { return m_plotMirror; }
+
     /**
      * Set the line width for the next drawing.
      *
diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp
index f77cbc2941..e75786a969 100644
--- a/pcbnew/plot_brditems_plotter.cpp
+++ b/pcbnew/plot_brditems_plotter.cpp
@@ -121,6 +121,8 @@ void BRDITEMS_PLOTTER::PlotPadNumber( const PAD* aPad, const COLOR4D& aColor )
 
     TEXT_ATTRIBUTES textAttrs;
 
+    textAttrs.m_Mirrored = m_plotter->GetPlotMirrored();
+
     if( padsize.x < ( padsize.y * 0.95 ) )
     {
         textAttrs.m_Angle = ANGLE_90;