diff --git a/common/preview_items/preview_utils.cpp b/common/preview_items/preview_utils.cpp
index 2aeedcb4c6..ea2bbed1eb 100644
--- a/common/preview_items/preview_utils.cpp
+++ b/common/preview_items/preview_utils.cpp
@@ -121,6 +121,9 @@ void KIGFX::PREVIEW::DrawTextNextToCursor( KIGFX::VIEW* aView, const VECTOR2D& a
                                            bool aDrawingDropShadows )
 {
     KIGFX::GAL*      gal = aView->GetGAL();
+
+    GAL_SCOPED_ATTRS settings( *gal );
+
     KIFONT::FONT*    font = KIFONT::FONT::GetFont();
 
     // constant text size on screen
diff --git a/include/gal/graphics_abstraction_layer.h b/include/gal/graphics_abstraction_layer.h
index 8b5a16fa29..6ad3127259 100644
--- a/include/gal/graphics_abstraction_layer.h
+++ b/include/gal/graphics_abstraction_layer.h
@@ -286,6 +286,16 @@ public:
         m_isFillEnabled = aIsFillEnabled;
     }
 
+    /**
+     * Get the fill status.
+     *
+     * @return true if fill is enabled, false otherwise.
+     */
+    inline bool GetIsFill() const
+    {
+        return m_isFillEnabled;
+    }
+
     /**
      * Enable/disable stroked outlines.
      *
@@ -296,6 +306,16 @@ public:
         m_isStrokeEnabled = aIsStrokeEnabled;
     }
 
+    /**
+     * Get the stroke status.
+     *
+     * @return true if stroke is enabled, false otherwise.
+     */
+    inline bool GetIsStroke() const
+    {
+        return m_isStrokeEnabled;
+    }
+
     /**
      * Set the fill color.
      *
@@ -1147,6 +1167,81 @@ public:
 };
 
 
+/**
+ * Attribute save/restore for GAL attributes.
+ */
+class GAL_SCOPED_ATTRS
+{
+public:
+    enum FLAGS
+    {
+        STROKE_WIDTH = 1,
+        STROKE_COLOR = 2,
+        IS_STROKE = 4,
+        FILL_COLOR = 8,
+        IS_FILL = 16,
+
+        // It is not clear to me that GAL needs to save text attributes.
+        // Only BitmapText uses it, and maybe that should be passed in
+        // explicitly (like for Draw) - every caller of BitmapText sets
+        // the text attributes anyway.
+        // TEXT_ATTRS = 32,
+
+        STROKE = STROKE_WIDTH | STROKE_COLOR | IS_STROKE,
+        FILL = FILL_COLOR | IS_FILL,
+
+        ///< Convenience flag for setting both stroke and fill
+        ALL = STROKE | FILL,
+    };
+
+    /**
+     * Instantiates a GAL_SCOPED_ATTRS object, saving the current attributes of the GAL.
+     *
+     * By default, all stroke and fill attributes are saved, which is usually what you want.
+     */
+    GAL_SCOPED_ATTRS( KIGFX::GAL& aGal, int aFlags = FLAGS::ALL )
+        : m_gal( aGal ), m_flags( aFlags )
+    {
+        // Save what we need to restore later.
+        // These are all so cheap to copy, it's likely not worth if'ing
+        m_strokeWidth = aGal.GetLineWidth();
+        m_strokeColor = aGal.GetStrokeColor();
+        m_isStroke = aGal.GetIsStroke();
+        m_fillColor = aGal.GetFillColor();
+        m_isFill = aGal.GetIsFill();
+    }
+
+    ~GAL_SCOPED_ATTRS()
+    {
+        // Restore the attributes that were saved
+        // based on the flags that were set.
+
+        if( m_flags & STROKE_WIDTH )
+            m_gal.SetLineWidth( m_strokeWidth );
+        if( m_flags & STROKE_COLOR )
+            m_gal.SetStrokeColor( m_strokeColor );
+        if( m_flags & IS_STROKE )
+            m_gal.SetIsStroke( m_isStroke );
+
+        if( m_flags & FILL_COLOR )
+            m_gal.SetFillColor( m_fillColor );
+        if( m_flags & IS_FILL )
+            m_gal.SetIsFill( m_isFill );
+    }
+
+private:
+    GAL& m_gal;
+    int  m_flags;
+
+    COLOR4D m_strokeColor;
+    double  m_strokeWidth;
+    bool    m_isStroke;
+
+    COLOR4D m_fillColor;
+    bool    m_isFill;
+};
+
+
 };    // namespace KIGFX
 
 #endif /* GRAPHICSABSTRACTIONLAYER_H_ */
diff --git a/include/preview_items/preview_utils.h b/include/preview_items/preview_utils.h
index eecbac0ca1..3905b88bbb 100644
--- a/include/preview_items/preview_utils.h
+++ b/include/preview_items/preview_utils.h
@@ -72,6 +72,8 @@ COLOR4D GetShadowColor( const COLOR4D& aColor );
 /**
  * Draw strings next to the cursor.
  *
+ * The GAL attribute context will be restored to its original state after this function is called.
+ *
  * @param aGal the GAL to draw on.
  * @param aCursorPos the position of the cursor to draw next to.
  * @param aTextQuadrant a vector pointing to the quadrant to draw the text in.
@@ -81,7 +83,7 @@ void DrawTextNextToCursor( KIGFX::VIEW* aView, const VECTOR2D& aCursorPos,
                            const VECTOR2D& aTextQuadrant, const wxArrayString& aStrings,
                            bool aDrawingDropShadows );
 
-} // PREVIEW
-} // KIGFX
+} // namespace PREVIEW
+} // namespace KIGFX
 
 #endif  // PREVIEW_PREVIEW_UTILS__H_