changeset 30041:f148aff802b6

maint: use "m_" prefix for member variables of text_renderer objects. * ft-text-renderer.cc: Use "m_" prefix for member variables of ft_font class. * text-renderer.cc, text-renderer.h: Use "m_" prefix for member variables of text_renderer class.
author Rik <rik@octave.org>
date Wed, 25 Aug 2021 11:25:41 -0700
parents 805357e6b058
children 13c04ecbfbe1
files libinterp/corefcn/ft-text-renderer.cc libinterp/corefcn/text-renderer.cc libinterp/corefcn/text-renderer.h
diffstat 3 files changed, 109 insertions(+), 107 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/ft-text-renderer.cc	Wed Aug 25 09:17:48 2021 -0700
+++ b/libinterp/corefcn/ft-text-renderer.cc	Wed Aug 25 11:25:41 2021 -0700
@@ -542,19 +542,19 @@
     public:
 
       ft_font (void)
-        : text_renderer::font (), face (nullptr) { }
+        : text_renderer::font (), m_face (nullptr) { }
 
       ft_font (const std::string& nm, const std::string& wt,
                const std::string& ang, double sz, FT_Face f = nullptr)
-        : text_renderer::font (nm, wt, ang, sz), face (f)
+        : text_renderer::font (nm, wt, ang, sz), m_face (f)
       { }
 
       ft_font (const ft_font& ft);
 
       ~ft_font (void)
       {
-        if (face)
-          FT_Done_Face (face);
+        if (m_face)
+          FT_Done_Face (m_face);
       }
 
       ft_font& operator = (const ft_font& ft);
@@ -565,7 +565,7 @@
 
     private:
 
-      mutable FT_Face face;
+      mutable FT_Face m_face;
     };
 
     void push_new_line (void);
@@ -1471,13 +1471,13 @@
   }
 
   ft_text_renderer::ft_font::ft_font (const ft_font& ft)
-    : text_renderer::font (ft), face (nullptr)
+    : text_renderer::font (ft), m_face (nullptr)
   {
 #if defined (HAVE_FT_REFERENCE_FACE)
     FT_Face ft_face = ft.get_face ();
 
     if (ft_face && FT_Reference_Face (ft_face) == 0)
-      face = ft_face;
+      m_face = ft_face;
 #endif
   }
 
@@ -1488,17 +1488,17 @@
       {
         text_renderer::font::operator = (ft);
 
-        if (face)
+        if (m_face)
           {
-            FT_Done_Face (face);
-            face = nullptr;
+            FT_Done_Face (m_face);
+            m_face = nullptr;
           }
 
 #if defined (HAVE_FT_REFERENCE_FACE)
         FT_Face ft_face = ft.get_face ();
 
         if (ft_face && FT_Reference_Face (ft_face) == 0)
-          face = ft_face;
+          m_face = ft_face;
 #endif
       }
 
@@ -1508,20 +1508,20 @@
   FT_Face
   ft_text_renderer::ft_font::get_face (void) const
   {
-    if (! face && ! name.empty ())
+    if (! m_face && ! m_name.empty ())
       {
-        face = ft_manager::get_font (name, weight, angle, size);
+        m_face = ft_manager::get_font (m_name, m_weight, m_angle, m_size);
 
-        if (face)
+        if (m_face)
           {
-            if (FT_Set_Char_Size (face, 0, size*64, 0, 0))
-              ::warning ("ft_text_renderer: unable to set font size to %g", size);
+            if (FT_Set_Char_Size (m_face, 0, m_size*64, 0, 0))
+              ::warning ("ft_text_renderer: unable to set font size to %g", m_size);
           }
         else
           ::warning ("ft_text_renderer: unable to load appropriate font");
       }
 
-    return face;
+    return m_face;
   }
 }
 
--- a/libinterp/corefcn/text-renderer.cc	Wed Aug 25 09:17:48 2021 -0700
+++ b/libinterp/corefcn/text-renderer.cc	Wed Aug 25 11:25:41 2021 -0700
@@ -37,13 +37,14 @@
 namespace octave
 {
   text_renderer::text_renderer (void)
-    : rep (make_ft_text_renderer ()), latex_rep (make_latex_text_renderer ())
+    : m_rep (make_ft_text_renderer ()),
+      m_latex_rep (make_latex_text_renderer ())
   { }
 
   text_renderer::~text_renderer (void)
   {
-    delete rep;
-    delete latex_rep;
+    delete m_rep;
+    delete m_latex_rep;
   }
 
   bool
@@ -51,7 +52,7 @@
   {
     static bool warned = false;
 
-    if (! rep)
+    if (! m_rep)
       {
         if (! warned)
           {
@@ -62,7 +63,7 @@
           }
       }
 
-    return rep != nullptr;
+    return m_rep != nullptr;
   }
 
   Matrix
@@ -70,7 +71,7 @@
   {
     static Matrix empty_extent (1, 4, 0.0);
 
-    return ok () ? rep->get_extent (elt, rotation) : empty_extent;
+    return ok () ? m_rep->get_extent (elt, rotation) : empty_extent;
   }
 
   Matrix
@@ -79,10 +80,10 @@
   {
     static Matrix retval (1, 4, 0.0);
 
-    if (interpreter == "latex" && latex_rep->ok ())
-      retval = latex_rep->get_extent (txt, rotation, interpreter);
+    if (interpreter == "latex" && m_latex_rep->ok ())
+      retval = m_latex_rep->get_extent (txt, rotation, interpreter);
     else if (ok ())
-      retval = rep->get_extent (txt, rotation, interpreter);
+      retval = m_rep->get_extent (txt, rotation, interpreter);
 
     return retval;
   }
@@ -91,7 +92,7 @@
   text_renderer::set_anti_aliasing (bool val)
   {
     if (ok ())
-      rep->set_anti_aliasing (val);
+      m_rep->set_anti_aliasing (val);
   }
 
   octave_map
@@ -100,7 +101,7 @@
     octave_map retval;
 
     if (ok ())
-      retval = rep->get_system_fonts ();
+      retval = m_rep->get_system_fonts ();
 
     return retval;
   }
@@ -111,8 +112,8 @@
   {
     if (ok ())
       {
-        rep->set_font (name, weight, angle, size);
-        latex_rep->set_font (name, weight, angle, size);
+        m_rep->set_font (name, weight, angle, size);
+        m_latex_rep->set_font (name, weight, angle, size);
       }
   }
 
@@ -121,8 +122,8 @@
   {
     if (ok ())
       {
-        rep->set_color (c);
-        latex_rep->set_color (c);
+        m_rep->set_color (c);
+        m_latex_rep->set_color (c);
       }
   }
 
@@ -136,12 +137,12 @@
     static Matrix empty_bbox (1, 4, 0.0);
     static uint8NDArray empty_pxls;
 
-    if (interpreter == "latex" && latex_rep->ok ())
-      latex_rep->text_to_pixels (txt, pxls, bbox, halign, valign, rotation,
-                                 interpreter, handle_rotation);
+    if (interpreter == "latex" && m_latex_rep->ok ())
+      m_latex_rep->text_to_pixels (txt, pxls, bbox, halign, valign, rotation,
+                                   interpreter, handle_rotation);
     else if (ok ())
-      rep->text_to_pixels (txt, pxls, bbox, halign, valign, rotation,
-                           interpreter, handle_rotation);
+      m_rep->text_to_pixels (txt, pxls, bbox, halign, valign, rotation,
+                             interpreter, handle_rotation);
     else
       {
         bbox = empty_bbox;
@@ -159,12 +160,12 @@
     static Matrix empty_bbox (1, 4, 0.0);
     static std::list<text_renderer::string> empty_lst;
 
-    if (interpreter == "latex" && latex_rep->ok ())
-      latex_rep->text_to_strlist (txt, lst, bbox, halign, valign, rotation,
-                                  interpreter);
+    if (interpreter == "latex" && m_latex_rep->ok ())
+      m_latex_rep->text_to_strlist (txt, lst, bbox, halign, valign, rotation,
+                                    interpreter);
     else if (ok ())
-      rep->text_to_strlist (txt, lst, bbox, halign, valign, rotation,
-                            interpreter);
+      m_rep->text_to_strlist (txt, lst, bbox, halign, valign, rotation,
+                              interpreter);
     else
       {
         bbox = empty_bbox;
--- a/libinterp/corefcn/text-renderer.h	Wed Aug 25 09:17:48 2021 -0700
+++ b/libinterp/corefcn/text-renderer.h	Wed Aug 25 11:25:41 2021 -0700
@@ -84,17 +84,17 @@
     public:
 
       font (void)
-        : name (), weight (), angle (), size (0)
+        : m_name (), m_weight (), m_angle (), m_size (0)
       { }
 
       font (const std::string& nm, const std::string& wt,
             const std::string& ang, double sz)
-        : name (nm), weight (wt), angle (ang), size (sz)
+        : m_name (nm), m_weight (wt), m_angle (ang), m_size (sz)
       { }
 
       font (const font& ft)
-        : name (ft.name), weight (ft.weight), angle (ft.angle),
-          size (ft.size)
+        : m_name (ft.m_name), m_weight (ft.m_weight), m_angle (ft.m_angle),
+          m_size (ft.m_size)
       { }
 
       ~font (void) = default;
@@ -103,29 +103,29 @@
       {
         if (&ft != this)
           {
-            name = ft.name;
-            weight = ft.weight;
-            angle = ft.angle;
-            size = ft.size;
+            m_name = ft.m_name;
+            m_weight = ft.m_weight;
+            m_angle = ft.m_angle;
+            m_size = ft.m_size;
           }
 
         return *this;
       }
 
-      std::string get_name (void) const { return name; }
+      std::string get_name (void) const { return m_name; }
 
-      std::string get_weight (void) const { return weight; }
+      std::string get_weight (void) const { return m_weight; }
 
-      std::string get_angle (void) const { return angle; }
+      std::string get_angle (void) const { return m_angle; }
 
-      double get_size (void) const { return size; }
+      double get_size (void) const { return m_size; }
 
     protected:
 
-      std::string name;
-      std::string weight;
-      std::string angle;
-      double size;
+      std::string m_name;
+      std::string m_weight;
+      std::string m_angle;
+      double m_size;
     };
 
     // Container for substrings after parsing.
@@ -134,15 +134,16 @@
     {
     public:
 
-      string (const std::string& s, font& f, const double x0, const double y0)
-        : str (s), family (f.get_name ()), fnt (f), x (x0), y (y0), z (0.0),
-          xdata (), code (0), color (Matrix (1,3,0.0)), svg_element ()
+      string (const std::string& s, font& f, const double x, const double y)
+        : m_str (s), m_family (f.get_name ()), m_fnt (f), m_x (x), m_y (y),
+          m_z (0.0), m_xdata (), m_code (0), m_color (Matrix (1,3,0.0)),
+          m_svg_element ()
       { }
 
       string (const string& s)
-        : str (s.str), family (s.family), fnt (s.fnt), x (s.x), y (s.y),
-          z (s.z), xdata (s.xdata), code (s.code), color (s.color),
-          svg_element (s.svg_element)
+        : m_str (s.m_str), m_family (s.m_family), m_fnt (s.m_fnt), m_x (s.m_x),
+          m_y (s.m_y), m_z (s.m_z), m_xdata (s.m_xdata), m_code (s.m_code),
+          m_color (s.m_color), m_svg_element (s.m_svg_element)
       { }
 
       ~string (void) = default;
@@ -151,79 +152,79 @@
       {
         if (&s != this)
           {
-            str = s.str;
-            family = s.family;
-            fnt = s.fnt;
-            x = s.x;
-            y = s.y;
-            z = s.z;
-            xdata = s.xdata;
-            code = s.code;
-            color = s.color;
+            m_str = s.m_str;
+            m_family = s.m_family;
+            m_fnt = s.m_fnt;
+            m_x = s.m_x;
+            m_y = s.m_y;
+            m_z = s.m_z;
+            m_xdata = s.m_xdata;
+            m_code = s.m_code;
+            m_color = s.m_color;
           }
 
         return *this;
       }
 
-      void set_string (const std::string& s) { str = s; }
+      void set_string (const std::string& s) { m_str = s; }
 
-      std::string get_string (void) const { return str; }
+      std::string get_string (void) const { return m_str; }
 
-      std::string get_name (void) const { return fnt.get_name (); }
+      std::string get_name (void) const { return m_fnt.get_name (); }
 
-      std::string get_family (void) const { return family; }
+      std::string get_family (void) const { return m_family; }
 
-      void set_family (const std::string& nm) { family = nm; }
+      void set_family (const std::string& nm) { m_family = nm; }
 
-      std::string get_weight (void) const { return fnt.get_weight (); }
+      std::string get_weight (void) const { return m_fnt.get_weight (); }
 
-      std::string get_angle (void) const { return fnt.get_angle (); }
+      std::string get_angle (void) const { return m_fnt.get_angle (); }
 
-      double get_size (void) const { return fnt.get_size (); }
+      double get_size (void) const { return m_fnt.get_size (); }
 
-      void set_x (const double x0) { x = x0; }
+      void set_x (const double x) { m_x = x; }
 
-      double get_x (void) const { return x; }
+      double get_x (void) const { return m_x; }
 
-      void set_xdata (const std::vector<double>& x0) { xdata = x0; }
+      void set_xdata (const std::vector<double>& x) { m_xdata = x; }
 
-      std::vector<double> get_xdata (void) const { return xdata; }
+      std::vector<double> get_xdata (void) const { return m_xdata; }
 
-      void set_y (const double y0) { y = y0; }
+      void set_y (const double y) { m_y = y; }
 
-      double get_y (void) const { return y; }
+      double get_y (void) const { return m_y; }
 
-      void set_z (const double z0) { z = z0; }
+      void set_z (const double z) { m_z = z; }
 
-      double get_z (void) const { return z; }
+      double get_z (void) const { return m_z; }
 
-      void set_code (const uint32_t c) { code = c; }
+      void set_code (const uint32_t code) { m_code = code; }
 
-      uint32_t get_code (void) const { return code; }
+      uint32_t get_code (void) const { return m_code; }
 
-      void set_svg_element (const std::string& svg) { svg_element = svg; }
+      void set_svg_element (const std::string& svg) { m_svg_element = svg; }
 
-      std::string get_svg_element (void) const { return svg_element; }
+      std::string get_svg_element (void) const { return m_svg_element; }
 
       void set_color (const uint8NDArray& c)
       {
-        color(0) = static_cast<double> (c(0)) / 255;
-        color(1) = static_cast<double> (c(1)) / 255;
-        color(2) = static_cast<double> (c(2)) / 255;
+        m_color(0) = static_cast<double> (c(0)) / 255;
+        m_color(1) = static_cast<double> (c(1)) / 255;
+        m_color(2) = static_cast<double> (c(2)) / 255;
       }
 
-      Matrix get_color (void) const { return color; }
+      Matrix get_color (void) const { return m_color; }
 
     private:
 
-      std::string str;
-      std::string family;
-      font fnt;
-      double x, y, z;
-      std::vector<double> xdata;
-      uint32_t code;
-      Matrix color;
-      std::string svg_element;
+      std::string m_str;
+      std::string m_family;
+      font m_fnt;
+      double m_x, m_y, m_z;
+      std::vector<double> m_xdata;
+      uint32_t m_code;
+      Matrix m_color;
+      std::string m_svg_element;
     };
 
     void text_to_strlist (const std::string& txt,
@@ -233,8 +234,8 @@
 
   private:
 
-    base_text_renderer *rep;
-    base_text_renderer *latex_rep;
+    base_text_renderer *m_rep;
+    base_text_renderer *m_latex_rep;
   };
 }