Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if ! defined (txt_eng_ft_h)
00024 #define txt_eng_ft_h 1
00025
00026 #if HAVE_FREETYPE
00027
00028 #include <ft2build.h>
00029 #include FT_FREETYPE_H
00030
00031 #include <dMatrix.h>
00032 #include <uint8NDArray.h>
00033 #include "txt-eng.h"
00034
00035 class
00036 OCTINTERP_API
00037 ft_render : public text_processor
00038 {
00039 public:
00040 enum {
00041 MODE_BBOX = 0,
00042 MODE_RENDER = 1
00043 };
00044
00045 enum {
00046 ROTATION_0 = 0,
00047 ROTATION_90 = 1,
00048 ROTATION_180 = 2,
00049 ROTATION_270 = 3
00050 };
00051
00052 public:
00053 ft_render (void);
00054
00055 ~ft_render (void);
00056
00057 void visit (text_element_string& e);
00058
00059 void reset (void);
00060
00061 uint8NDArray get_pixels (void) const { return pixels; }
00062
00063 Matrix get_boundingbox (void) const { return bbox; }
00064
00065 uint8NDArray render (text_element* elt, Matrix& box,
00066 int rotation = ROTATION_0);
00067
00068 Matrix get_extent (text_element *elt, double rotation = 0.0);
00069 Matrix get_extent (const std::string& txt, double rotation = 0.0);
00070
00071 void set_font (const std::string& name, const std::string& weight,
00072 const std::string& angle, double size);
00073
00074 void set_color (Matrix c);
00075
00076 void set_mode (int m);
00077
00078 void text_to_pixels (const std::string& txt,
00079 uint8NDArray& pixels_, Matrix& bbox,
00080 int halign, int valign, double rotation);
00081
00082 private:
00083 int rotation_to_mode (double rotation) const;
00084
00085
00086
00087 ft_render (const ft_render&);
00088
00089 ft_render& operator = (const ft_render&);
00090
00091 private:
00092 FT_Face face;
00093 Matrix bbox;
00094 uint8NDArray pixels;
00095 int xoffset;
00096 int yoffset;
00097 int mode;
00098 uint8_t red, green, blue;
00099 };
00100
00101 #endif // HAVE_FREETYPE
00102
00103 #endif