diff libinterp/corefcn/gl2ps-print.cc @ 21209:67d2965af0b5

revamp text rendering classes * base-text-renderer.h: New file. * ft-text-renderer.h, ft-text-renderer.cc: New files for freetype text rendering classes, adapted from txt-eng-ft.h and txt-eng.cc. * text-renderer.h, text-renderer.cc: New files. Public interface for text rendering. * gl-select.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, graphics.cc, graphics.in.h: Adapt to use new text rendering interface that does not require checking HAVE_FREETYPE. * libinterp/corefcn/module.mk: Update.
author John W. Eaton <jwe@octave.org>
date Sat, 06 Feb 2016 08:15:53 -0500
parents 945695cafd2b
children 721539013db4
line wrap: on
line diff
--- a/libinterp/corefcn/gl2ps-print.cc	Fri Feb 05 14:53:10 2016 -0500
+++ b/libinterp/corefcn/gl2ps-print.cc	Sat Feb 06 08:15:53 2016 -0500
@@ -41,7 +41,7 @@
 #include "gl-render.h"
 #include "oct-opengl.h"
 #include "sysdep.h"
-#include "txt-eng-ft.h"
+#include "text-renderer.h"
 
 class
 OCTINTERP_API
@@ -123,11 +123,11 @@
 
 private:
 
-  // Use xform to compute the coordinates of the ft_string list
+  // Use xform to compute the coordinates of the string list
   // that have been parsed by freetype
   void fix_strlist_position (double x, double y, double z,
                              Matrix box, double rotation,
-                             std::list<ft_render::ft_string>& lst);
+                             std::list<text_renderer::string>& lst);
 
   int alignment_to_mode (int ha, int va) const;
   FILE *fp;
@@ -302,9 +302,9 @@
 void
 gl2ps_renderer::fix_strlist_position (double x, double y, double z,
                                      Matrix box, double rotation,
-                                     std::list<ft_render::ft_string>& lst)
+                                     std::list<text_renderer::string>& lst)
 {
-  for (std::list<ft_render::ft_string>::iterator p = lst.begin ();
+  for (std::list<text_renderer::string>::iterator p = lst.begin ();
        p != lst.end (); p++)
     {
       // Get pixel coordinates
@@ -552,7 +552,7 @@
   // string using freetype
   Matrix bbox;
   std::string str = txt;
-  std::list<ft_render::ft_string> lst;
+  std::list<text_renderer::string> lst;
 
   text_to_strlist (str, lst, bbox, ha, va, rotation);
 
@@ -565,7 +565,7 @@
       int sz = fontsize;
       if (! lst.empty () && term.find ("tex") == std::string::npos)
         {
-          ft_render::ft_string s = lst.front ();
+          text_renderer::string s = lst.front ();
           name = select_font (s.get_name (), s.get_weight () == "bold",
                               s.get_angle () == "italic");
           set_color (s.get_color ());
@@ -591,7 +591,7 @@
   // Translate and rotate coordinates in order to use bottom-left alignment
   fix_strlist_position (x, y, z, bbox, rotation, lst);
 
-  for (std::list<ft_render::ft_string>::iterator p = lst.begin ();
+  for (std::list<text_renderer::string>::iterator p = lst.begin ();
        p != lst.end (); p++)
     {
       fontname = select_font ((*p).get_name (),