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 Robert B. Quattlebaum Jr.
8 ** This software and associated documentation
9 ** are CONFIDENTIAL and PROPRIETARY property of
10 ** the above-mentioned copyright holder.
12 ** You may not copy, print, publish, or in any
13 ** other way distribute this software without
14 ** a prior written agreement with
15 ** the copyright holder.
17 ** === N O T E S ===========================================================
19 ** ========================================================================= */
21 /* === S T A R T =========================================================== */
23 #ifndef __SYNFIG_LYR_FREETYPE_H
24 #define __SYNFIG_LYR_FREETYPE_H
26 /* === H E A D E R S ======================================================= */
29 //#define USE_MAC_FT_FUNCS (1)
32 #include <synfig/layer_composite.h>
33 #include <synfig/vector.h>
34 #include <synfig/color.h>
35 #include <synfig/string.h>
38 #include FT_FREETYPE_H
42 #include <synfig/string.h>
43 #include <synfig/time.h>
44 #include <synfig/context.h>
45 #include <synfig/paramdesc.h>
46 #include <synfig/renddesc.h>
47 #include <synfig/surface.h>
48 #include <synfig/value.h>
49 #include <synfig/valuenode.h>
50 #include <synfig/canvas.h>
55 #ifdef USE_MAC_FT_FUNCS
56 #include <CoreServices/CoreServices.h>
60 /* === M A C R O S ========================================================= */
62 /* === T Y P E D E F S ===================================================== */
64 /* === C L A S S E S & S T R U C T S ======================================= */
66 using namespace synfig;
80 std::vector<Glyph> glyph_table;
82 TextLine():width(0) { }
83 void clear_and_free();
85 int actual_height()const
89 std::vector<Glyph>::const_iterator iter;
90 for(iter=glyph_table.begin();iter!=glyph_table.end();++iter)
94 //FT_Glyph_Get_CBox( glyphs[n], ft_glyph_bbox_pixels, &glyph_bbox );
95 FT_Glyph_Get_CBox( iter->glyph, ft_glyph_bbox_subpixels, &glyph_bbox );
97 if(glyph_bbox.yMax>height)
98 height=glyph_bbox.yMax;
105 class lyr_freetype : public synfig::Layer_Composite, public synfig::Layer_NoDeform
107 SYNFIG_LAYER_MODULE_EXT
112 synfig::String family;
115 synfig::Vector orient;
118 synfig::Real compress;
119 synfig::Real vcompress;
132 mutable synfig::Mutex mutex;
136 virtual ~lyr_freetype();
138 virtual bool set_param(const String & param, const synfig::ValueBase &value);
139 virtual ValueBase get_param(const String & param)const;
140 virtual Color get_color(Context context, const synfig::Point &pos)const;
141 virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
143 virtual Vocab get_param_vocab()const;
145 virtual bool set_version(const String &ver){if(ver=="0.1")old_version=true;return true;}
146 virtual void reset_version(){old_version=false;}
148 virtual synfig::Rect get_bounding_rect()const;
151 void new_font(const synfig::String &family, int style=0, int weight=400);
152 bool new_font_(const synfig::String &family, int style=0, int weight=400);
153 bool new_face(const synfig::String &newfont);
156 extern FT_Library ft_library;
158 /* === E N D =============================================================== */