view libinterp/corefcn/txt-latex.h @ 17454:fd3e999305ea

Moved functionality from latex and ft renderer to base_text_renderer. * txt-render.cc/.h: Created three new methods: rotate_data, alignment and rotate_bounding_box. * txt-latex.cc/.h: Moved part of functionality to three new methods of base_text_render. * txt-eng-ft.cc/.h: Moved part of functionality to three new methods of base_text_render. To avoid multiple copy/paste code.
author Andrej Lojdl <andrej.lojdl@gmail.com>
date Tue, 17 Sep 2013 20:40:02 +0200
parents d415dc6ac1e2
children 1647020d09ec
line wrap: on
line source

/*

   Copyright (C) 2013 Andrej Lojdl

   This file is part of Octave.

   Octave is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 3 of the License, or (at your
   option) any later version.

   Octave is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   for more details.

   You should have received a copy of the GNU General Public License
   along with Octave; see the file COPYING.  If not, see
   <http://www.gnu.org/licenses/>.

 */

#if ! defined (txt_latex_h)
#define txt_latex_h 1

#ifdef ENABLE_LATEX

#include <string>
#include <dMatrix.h>
#include <uint8NDArray.h>
#include "txt-render.h"

class 
OCTINTERP_API
latex_render : public base_text_render
{  
public:
  latex_render (void);

  ~latex_render (void);  

  void set_font (const std::string& name, const std::string& weight,
                 const std::string& angle, double size);

  void set_color (Matrix c);

  void text_to_pixels (const std::string& txt,
                       uint8NDArray& pixels_, Matrix& bbox,
                       int halign, int valign, double rotation);

  Matrix get_extent (text_element *elt, double rotation = 0.0);
  Matrix get_extent (const std::string& txt, double rotation = 0.0);
  
  /* method that cheks if there are all required programs installed */
  int check_programs (void);

  /* method making TEX file from text (input string) */ 
  void adapter (const std::string& txt);

  /* method rendering text TEX -> DVI -> EPS -> PNG -> RAW */ 
  uint8NDArray render (void);

private:
  int font_size;
  std::string font_name,directory_path;
  Matrix bbox;
  uint8NDArray pixels;
  uint8NDArray color;

};
#endif
#endif //ENABLE_LATEX