changeset 17118:527991b748ba

Updated latex_render class. * module.mk: Fixed error with file locations. * txt-latex.h: Removed latex_render::get_bbox method. * txt-latex.cc: Removed latex_render::get_bbox method, upgradet latex_render::text_to_pixels method to read bounding box.
author AndrejLojdl <andrej.lojdl@gmail.com>
date Thu, 01 Aug 2013 18:15:12 +0200
parents dd399f461ff3
children 0f6cfae86e85
files libinterp/corefcn/module.mk libinterp/corefcn/txt-latex.cc libinterp/corefcn/txt-latex.h
diffstat 3 files changed, 10 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/module.mk
+++ b/libinterp/corefcn/module.mk
@@ -98,8 +98,8 @@
   corefcn/symtab.h \
   corefcn/sysdep.h \
   corefcn/toplev.h \
-  interp-core/txt-render.h \
-  interp-core/txt-latex.h \
+  corefcn/txt-render.h \
+  corefcn/txt-latex.h \
   corefcn/txt-eng-ft.h \
   corefcn/txt-eng.h \
   corefcn/unwind-prot.h \
@@ -242,8 +242,8 @@
   corefcn/time.cc \
   corefcn/toplev.cc \
   corefcn/tril.cc \
-  interp-core/txt-render.cc \
-  interp-core/txt-latex.cc \
+  corefcn/txt-render.cc \
+  corefcn/txt-latex.cc \
   corefcn/txt-eng-ft.cc \
   corefcn/typecast.cc \
   corefcn/unwind-prot.cc \
--- a/libinterp/corefcn/txt-latex.cc
+++ b/libinterp/corefcn/txt-latex.cc
@@ -111,39 +111,12 @@
       file.close();
     }
   else
-    exit (EXIT_FAILURE);
-    
+    exit (EXIT_FAILURE); 
   
   
   return data; 
 }
 
-Matrix 
-latex_render::get_bbox (void)
-{
-  Matrix bounding_box (1, 4, 0.0);
-  std::ifstream file;
-  std::string skip;
-  int width, height;
-  
-  file.open("default.ppm");
-
-  std::getline(file, skip);
-  std::getline(file, skip);
-
-  
-  file>>width>>height;
-  
-  bounding_box(2) = width;
-  bounding_box(3) = height;
-
-  file.close();
-  
-  remove("default.ppm");
-  
-  return bounding_box;
-}
-
 void
 latex_render::set_font (const std::string& name, const std::string& weight,
                         const std::string& angle, double size)
@@ -159,7 +132,10 @@
 {
   adapter (txt);
   pixels = render();
-  bbox = get_bbox();	
+  
+  bbox = Matrix (1, 4, 0.0);
+  bbox(2) = pixels.dim2();
+  bbox(3) = pixels.dim3();	
 }
 
 Matrix
--- a/libinterp/corefcn/txt-latex.h
+++ b/libinterp/corefcn/txt-latex.h
@@ -53,12 +53,9 @@
   // method making TEX file from text (input string) 
   void adapter (const std::string& txt);
 
-  // method rendering text TEX -> DVI -> EPS -> PNG 
+  // method rendering text TEX -> DVI -> EPS -> PPM 
   uint8NDArray render (void);
 
-  // method extracting bounding box from EPS file
-  Matrix get_bbox (void);
-
 private:
   Matrix bbox;
   uint8NDArray pixels;