1 /*! ========================================================================
3 ** Template Header File
4 ** $Id: lyr_freetype.h,v 1.3 2005/01/24 03:08:17 darco Exp $
6 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
8 ** This package is free software; you can redistribute it and/or
9 ** modify it under the terms of the GNU General Public License as
10 ** published by the Free Software Foundation; either version 2 of
11 ** the License, or (at your option) any later version.
13 ** This package is distributed in the hope that it will be useful,
14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ** General Public License for more details.
18 ** === N O T E S ===========================================================
20 ** ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SYNFIG_LYR_FREETYPE_H
25 #define __SYNFIG_LYR_FREETYPE_H
27 /* === H E A D E R S ======================================================= */
30 //#define USE_MAC_FT_FUNCS (1)
33 #include <synfig/layer_composite.h>
34 #include <synfig/vector.h>
35 #include <synfig/color.h>
36 #include <synfig/string.h>
39 #include FT_FREETYPE_H
43 #include <synfig/string.h>
44 #include <synfig/time.h>
45 #include <synfig/context.h>
46 #include <synfig/paramdesc.h>
47 #include <synfig/renddesc.h>
48 #include <synfig/surface.h>
49 #include <synfig/value.h>
50 #include <synfig/valuenode.h>
51 #include <synfig/canvas.h>
56 #ifdef USE_MAC_FT_FUNCS
57 #include <CoreServices/CoreServices.h>
61 /* === M A C R O S ========================================================= */
63 /* === T Y P E D E F S ===================================================== */
65 /* === C L A S S E S & S T R U C T S ======================================= */
67 using namespace synfig;
81 std::vector<Glyph> glyph_table;
83 TextLine():width(0) { }
84 void clear_and_free();
86 int actual_height()const
90 std::vector<Glyph>::const_iterator iter;
91 for(iter=glyph_table.begin();iter!=glyph_table.end();++iter)
95 //FT_Glyph_Get_CBox( glyphs[n], ft_glyph_bbox_pixels, &glyph_bbox );
96 FT_Glyph_Get_CBox( iter->glyph, ft_glyph_bbox_subpixels, &glyph_bbox );
98 if(glyph_bbox.yMax>height)
99 height=glyph_bbox.yMax;
106 class lyr_freetype : public synfig::Layer_Composite, public synfig::Layer_NoDeform
108 SYNFIG_LAYER_MODULE_EXT
113 synfig::String family;
116 synfig::Vector orient;
119 synfig::Real compress;
120 synfig::Real vcompress;
133 mutable synfig::Mutex mutex;
137 virtual ~lyr_freetype();
139 virtual bool set_param(const String & param, const synfig::ValueBase &value);
140 virtual ValueBase get_param(const String & param)const;
141 virtual Color get_color(Context context, const synfig::Point &pos)const;
142 virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
144 virtual Vocab get_param_vocab()const;
146 virtual bool set_version(const String &ver){if(ver=="0.1")old_version=true;return true;}
147 virtual void reset_version(){old_version=false;}
149 virtual synfig::Rect get_bounding_rect()const;
152 void new_font(const synfig::String &family, int style=0, int weight=400);
153 bool new_font_(const synfig::String &family, int style=0, int weight=400);
154 bool new_face(const synfig::String &newfont);
157 extern FT_Library ft_library;
159 /* === E N D =============================================================== */