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 __SINFG_LYR_FREETYPE_H
24 #define __SINFG_LYR_FREETYPE_H
26 /* === H E A D E R S ======================================================= */
28 #include <sinfg/layer_composite.h>
29 #include <sinfg/vector.h>
30 #include <sinfg/color.h>
31 #include <sinfg/string.h>
34 #include FT_FREETYPE_H
38 /* === M A C R O S ========================================================= */
40 /* === T Y P E D E F S ===================================================== */
42 /* === C L A S S E S & S T R U C T S ======================================= */
44 using namespace sinfg;
58 std::vector<Glyph> glyph_table;
60 TextLine():width(0) { }
61 void clear_and_free();
63 int actual_height()const
67 std::vector<Glyph>::const_iterator iter;
68 for(iter=glyph_table.begin();iter!=glyph_table.end();++iter)
72 //FT_Glyph_Get_CBox( glyphs[n], ft_glyph_bbox_pixels, &glyph_bbox );
73 FT_Glyph_Get_CBox( iter->glyph, ft_glyph_bbox_subpixels, &glyph_bbox );
75 if(glyph_bbox.yMax>height)
76 height=glyph_bbox.yMax;
83 class lyr_freetype : public sinfg::Layer_Composite, public sinfg::Layer_NoDeform
85 SINFG_LAYER_MODULE_EXT
97 sinfg::Real vcompress;
110 mutable sinfg::Mutex mutex;
114 virtual ~lyr_freetype();
116 virtual bool set_param(const String & param, const sinfg::ValueBase &value);
117 virtual ValueBase get_param(const String & param)const;
118 virtual Color get_color(Context context, const Point &pos)const;
119 virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
121 virtual Vocab get_param_vocab()const;
123 virtual bool set_version(const String &ver){if(ver=="0.1")old_version=true;return true;}
124 virtual void reset_version(){old_version=false;}
126 virtual sinfg::Rect get_bounding_rect()const;
129 void new_font(const sinfg::String &family, int style=0, int weight=400);
130 bool new_font_(const sinfg::String &family, int style=0, int weight=400);
131 bool new_face(const sinfg::String &newfont);
134 extern FT_Library ft_library;
136 /* === E N D =============================================================== */