1 /* === S Y N F I G ========================================================= */
2 /*! \file lyr_freetype.h
3 ** \brief Template Header
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 ** === N O T E S ===========================================================
23 ** ========================================================================= */
25 /* === S T A R T =========================================================== */
27 #ifndef __SYNFIG_LYR_FREETYPE_H
28 #define __SYNFIG_LYR_FREETYPE_H
30 /* === H E A D E R S ======================================================= */
33 //#define USE_MAC_FT_FUNCS (1)
36 #include <synfig/layer_composite.h>
37 #include <synfig/vector.h>
38 #include <synfig/color.h>
39 #include <synfig/string.h>
42 #include FT_FREETYPE_H
46 #include <synfig/string.h>
47 #include <synfig/time.h>
48 #include <synfig/context.h>
49 #include <synfig/paramdesc.h>
50 #include <synfig/renddesc.h>
51 #include <synfig/surface.h>
52 #include <synfig/value.h>
53 #include <synfig/valuenode.h>
54 #include <synfig/canvas.h>
59 #ifdef USE_MAC_FT_FUNCS
60 #include <CoreServices/CoreServices.h>
64 /* === M A C R O S ========================================================= */
66 /* === T Y P E D E F S ===================================================== */
68 /* === C L A S S E S & S T R U C T S ======================================= */
70 using namespace synfig;
84 std::vector<Glyph> glyph_table;
86 TextLine():width(0) { }
87 void clear_and_free();
89 int actual_height()const
93 std::vector<Glyph>::const_iterator iter;
94 for(iter=glyph_table.begin();iter!=glyph_table.end();++iter)
98 //FT_Glyph_Get_CBox( glyphs[n], ft_glyph_bbox_pixels, &glyph_bbox );
99 FT_Glyph_Get_CBox( iter->glyph, ft_glyph_bbox_subpixels, &glyph_bbox );
101 if(glyph_bbox.yMax>height)
102 height=glyph_bbox.yMax;
109 class lyr_freetype : public synfig::Layer_Composite, public synfig::Layer_NoDeform
111 SYNFIG_LAYER_MODULE_EXT
116 synfig::String family;
119 synfig::Vector orient;
122 synfig::Real compress;
123 synfig::Real vcompress;
136 mutable synfig::Mutex mutex;
140 virtual ~lyr_freetype();
142 virtual bool set_param(const String & param, const synfig::ValueBase &value);
143 virtual ValueBase get_param(const String & param)const;
144 virtual Color get_color(Context context, const synfig::Point &pos)const;
145 virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
147 virtual Vocab get_param_vocab()const;
149 virtual bool set_version(const String &ver){if(ver=="0.1")old_version=true;return true;}
150 virtual void reset_version(){old_version=false;}
152 virtual synfig::Rect get_bounding_rect()const;
155 void new_font(const synfig::String &family, int style=0, int weight=400);
156 bool new_font_(const synfig::String &family, int style=0, int weight=400);
157 bool new_face(const synfig::String &newfont);
160 extern FT_Library ft_library;
162 /* === E N D =============================================================== */