changeset 20320:6db2ea5556a4

Make use of the axes "ticklabelinterpreter" property (bug #45438) * plot.txi: add an anchor pointing to usage of interpreter property * genpropdoc.m: document axes "ticklabelinterpreter" property and text "interpreter" property * gl-render.h: new private attribute "interpreter" that stores the interperter to be used in text_to_pixels * gl-render.h (set_interpreter): new protected virtual method to set "interpreter" * gl-render.cc (opengl_renderer::draw_axes): set interpreter before rendering tick labels * gl-render.cc (opengl_renderer::text_to_pixels): make use of interpreter attribute * graphics.cc (axes::properties::set_defaults): initialize "ticklabelinterpreter" instead of unused "interpreter" * graphics.in.h (axes::properties): fix doubly defined defaults for "ticklabelinterpreter" and "interpreter" properties
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Tue, 23 Jun 2015 22:21:50 +0200
parents 085c99b96aed
children 42b7d7758c4a
files doc/interpreter/genpropdoc.m doc/interpreter/plot.txi libinterp/corefcn/gl-render.cc libinterp/corefcn/gl-render.h libinterp/corefcn/graphics.cc libinterp/corefcn/graphics.in.h
diffstat 6 files changed, 23 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/genpropdoc.m	Thu Jun 25 08:32:21 2015 -0400
+++ b/doc/interpreter/genpropdoc.m	Tue Jun 23 22:21:50 2015 +0200
@@ -665,6 +665,10 @@
 
       case "tickdirmode"
 
+      case "ticklabelinterpreter"
+        s.doc = "Control the way x/y/zticklabel properties are interpreted.\n\
+@xref{XREFinterpreterusage, , @w{Use of the interpreter property}}.";
+        
       case "ticklength"
         s.doc = "Two-element vector @code{[2Dlen 3Dlen]} specifying the \
 length of the tickmarks relative to the longest visible axis.";
@@ -828,6 +832,7 @@
         s.doc = doc_unused;
 
       case "interpreter"
+        
       case "linestyle"
         s.doc = "@xref{Line Styles}.";
 
@@ -930,6 +935,10 @@
 
       case "horizontalalignment"
       case "interpreter"
+        s.doc = "Control the way the @qcode{\"string\"} property is \
+interpreted.\n\
+@xref{XREFinterpreterusage, , @w{Use of the interpreter property}}.";
+        
       case "linestyle"
         s.doc = sprintf (doc_notimpl, "Background area");
 
--- a/doc/interpreter/plot.txi	Thu Jun 25 08:32:21 2015 -0400
+++ b/doc/interpreter/plot.txi	Tue Jun 23 22:21:50 2015 +0200
@@ -616,6 +616,7 @@
 @DOCSTRING(closereq)
 
 @node Use of the @code{interpreter} Property
+@anchor{XREFinterpreterusage}
 @subsection Use of the @code{interpreter} Property
 
 All text objects---such as titles, labels, legends, and text---include
--- a/libinterp/corefcn/gl-render.cc	Thu Jun 25 08:32:21 2015 -0400
+++ b/libinterp/corefcn/gl-render.cc	Tue Jun 23 22:21:50 2015 +0200
@@ -1475,6 +1475,7 @@
   draw_axes_boxes (props);
 
   set_font (props);
+  set_interpreter (props.get_ticklabelinterpreter ());
 
   draw_axes_x_grid (props);
   draw_axes_y_grid (props);
@@ -3229,7 +3230,7 @@
 {
 #if HAVE_FREETYPE
   text_renderer.text_to_pixels (txt, pixels, bbox,
-                                halign, valign, rotation, "none");
+                                halign, valign, rotation, interpreter);
 #endif
 }
 
--- a/libinterp/corefcn/gl-render.h	Thu Jun 25 08:32:21 2015 -0400
+++ b/libinterp/corefcn/gl-render.h	Tue Jun 23 22:21:50 2015 +0200
@@ -59,7 +59,7 @@
   opengl_renderer (void)
     : toolkit (), xform (), xmin (), xmax (), ymin (), ymax (),
     zmin (), zmax (), xZ1 (), xZ2 (), marker_id (), filled_marker_id (),
-    camera_pos (), camera_dir ()
+    camera_pos (), camera_dir (), interpreter ("none")
 #if HAVE_FREETYPE
     , text_renderer ()
 #endif
@@ -108,6 +108,10 @@
                             double z1, double z2);
   virtual void set_clipping (bool on);
   virtual void set_font (const base_properties& props);
+  virtual void set_interpreter (const caseless_str interp) 
+  {
+    interpreter = interp;
+  }
 
   virtual void init_marker (const std::string& m, double size, float width);
   virtual void end_marker (void);
@@ -207,6 +211,9 @@
   // camera information for primitive sorting
   ColumnVector camera_pos, camera_dir;
 
+  // interpreter to be used by text_to_pixels
+  caseless_str interpreter;
+
 #if HAVE_FREETYPE
   // FreeType render, used for text rendering
   ft_render text_renderer;
--- a/libinterp/corefcn/graphics.cc	Thu Jun 25 08:32:21 2015 -0400
+++ b/libinterp/corefcn/graphics.cc	Tue Jun 23 22:21:50 2015 +0200
@@ -5056,7 +5056,7 @@
   yticklabelmode = "auto";
   zticklabelmode = "auto";
 
-  interpreter = "none";
+  ticklabelinterpreter = "tex";
 
   color = color_values ("white");
   xcolor = color_values ("black");
--- a/libinterp/corefcn/graphics.in.h	Thu Jun 25 08:32:21 2015 -0400
+++ b/libinterp/corefcn/graphics.in.h	Tue Jun 23 22:21:50 2015 +0200
@@ -3931,7 +3931,7 @@
       radio_property gridlinestyle , "{:}|-|--|-.|none"
       // NOTE: interpreter is not a Matlab axis property, but it makes
       //       more sense to have it so that axis ticklabels can use it.
-      radio_property interpreter , "{tex}|latex|{none}"
+      radio_property interpreter , "{tex}|latex|none"
       double_property labelfontsizemultiplier , 1.1
       radio_property layer u , "{bottom}|top"
       // FIXME: should be kind of string array.
@@ -3954,7 +3954,7 @@
       radio_property tickdir mu , "{in}|out"
       radio_property tickdirmode u , "{auto}|manual"
       // FIXME: Added recently to Matlab, should replace interpreter property.
-      radio_property ticklabelinterpreter , "{tex}|latex|{none}"
+      radio_property ticklabelinterpreter , "{tex}|latex|none"
       array_property ticklength u , default_axes_ticklength ()
       array_property tightinset r , Matrix (1, 4, 0.0)
       handle_property title SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)