diff src/graphics.h.in @ 11455:2be9e22796d2

improvements in text-extent calculation
author Konstantinos Poulios <logari81@googlemail.com>
date Thu, 06 Jan 2011 20:46:03 +0100
parents ecd87194adb6
children fd0a3ac60b0e
line wrap: on
line diff
--- a/src/graphics.h.in	Thu Jan 06 19:56:50 2011 +0100
+++ b/src/graphics.h.in	Thu Jan 06 20:46:03 2011 +0100
@@ -42,6 +42,7 @@
 #include "oct-map.h"
 #include "oct-mutex.h"
 #include "ov.h"
+#include "txt-eng-ft.h"
 
 // FIXME -- maybe this should be a configure option?
 // Matlab defaults to "Helvetica", but that causes problems for many
@@ -3518,7 +3519,7 @@
       radio_property units u , "{data}|pixels|normalized|inches|centimeters|points"
       array_property position mu , Matrix (1, 3, 0.0)
       double_property rotation mu , 0
-      radio_property horizontalalignment m , "{left}|center|right"
+      radio_property horizontalalignment mu , "{left}|center|right"
       color_property color , color_values (0, 0, 0)
       string_property fontname u , OCTAVE_DEFAULT_FONTNAME
       double_property fontsize u , 10
@@ -3534,7 +3535,7 @@
       radio_property linestyle , "{-}|--|:|-.|none"
       double_property linewidth , 0.5
       double_property margin , 1
-      radio_property verticalalignment m , "top|cap|{middle}|baseline|bottom"
+      radio_property verticalalignment mu , "top|cap|{middle}|baseline|bottom"
       array_property extent rG , Matrix (1, 4, 0.0)
       // hidden properties for limit computation
       row_vector_property xlim hlr , Matrix ()
@@ -3551,6 +3552,12 @@
     END_PROPERTIES
 
     Matrix get_data_position (void) const;
+    Matrix get_extent_matrix (void) const;
+    const uint8NDArray& get_pixels (void) const { return pixels; }
+#if HAVE_FREETYPE
+    // freetype render, used for text rendering
+    ft_render renderer;
+#endif
 
   protected:
     void init (void)
@@ -3594,11 +3601,14 @@
     void update_fontangle (void) { update_text_extent (); }
     void update_fontweight (void) { update_text_extent (); }
     void update_interpreter (void) { update_text_extent (); }
+    void update_horizontalalignment (void) { update_text_extent (); }
+    void update_verticalalignment (void) { update_text_extent (); }
 
     void update_units (void);
 
   private:
     std::string cached_units;
+    uint8NDArray pixels;
   };
 
 private: