Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-core / tags / synfig_0_61_07_rc3 / src / modules / lyr_freetype / main.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file lyr_freetype/main.cpp
3 **      \brief Template Header
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **      Copyright (c) 2007 Chris Moore
10 **
11 **      This package is free software; you can redistribute it and/or
12 **      modify it under the terms of the GNU General Public License as
13 **      published by the Free Software Foundation; either version 2 of
14 **      the License, or (at your option) any later version.
15 **
16 **      This package is distributed in the hope that it will be useful,
17 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
18 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 **      General Public License for more details.
20 **      \endlegal
21 **
22 ** === N O T E S ===========================================================
23 **
24 ** ========================================================================= */
25
26 /* === H E A D E R S ======================================================= */
27
28 #define SYNFIG_MODULE
29
30 #ifdef USING_PCH
31 #       include "pch.h"
32 #else
33 #ifdef HAVE_CONFIG_H
34 #       include <config.h>
35 #endif
36
37 #include <string.h>
38 #include <synfig/module.h>
39 #include "lyr_freetype.h"
40 #include <iostream>
41 #include <ETL/stringf>
42
43 #include <ft2build.h>
44 #include FT_FREETYPE_H
45
46 #endif
47
48 using namespace etl;
49 using namespace std;
50 using namespace synfig;
51
52 FT_Library  ft_library;
53
54 /* === E N T R Y P O I N T ================================================= */
55
56 bool freetype_constructor(synfig::ProgressCallback *cb)
57 {
58         int error;
59         if(cb)cb->task("Initializing FreeType...");
60         if ( (error = FT_Init_FreeType( &ft_library )) )
61         {
62                 if(cb)cb->error(strprintf("Layer_Freetype: FreeType initialization failed. (err=%d)",error));
63                 return false;
64         }
65         return true;
66 }
67
68 void freetype_destructor()
69 {
70         std::cerr<<"freetype_destructor()"<<std::endl;
71 }
72
73 /* === E N T R Y P O I N T ================================================= */
74
75 MODULE_DESC_BEGIN(liblyr_freetype)
76         MODULE_NAME("FreeType Font Layer")
77         MODULE_DESCRIPTION("Provides a font rendering layer via FreeType")
78         MODULE_AUTHOR("Robert B. Quattlebaum")
79         MODULE_VERSION("1.0")
80         MODULE_COPYRIGHT(SYNFIG_COPYRIGHT)
81
82         MODULE_CONSTRUCTOR(freetype_constructor)
83         MODULE_DESTRUCTOR(freetype_destructor)
84 MODULE_DESC_END
85
86 MODULE_INVENTORY_BEGIN(liblyr_freetype)
87         BEGIN_LAYERS
88                 LAYER(Layer_Freetype)
89                 LAYER_ALIAS(Layer_Freetype,"Text")
90         END_LAYERS
91 MODULE_INVENTORY_END