Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-core / tags / synfig_0_61_06 / 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 **
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.
14 **
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.
19 **      \endlegal
20 **
21 ** === N O T E S ===========================================================
22 **
23 ** ========================================================================= */
24
25 /* === H E A D E R S ======================================================= */
26
27 #define SYNFIG_MODULE
28
29 #ifdef USING_PCH
30 #       include "pch.h"
31 #else
32 #ifdef HAVE_CONFIG_H
33 #       include <config.h>
34 #endif
35
36 #include <string.h>
37 #include <synfig/module.h>
38 #include "lyr_freetype.h"
39 #include <iostream>
40 #include <ETL/stringf>
41
42 #include <ft2build.h>
43 #include FT_FREETYPE_H
44
45 #endif
46
47 using namespace etl;
48 using namespace std;
49 using namespace synfig;
50
51 FT_Library  ft_library;
52
53 /* === E N T R Y P O I N T ================================================= */
54
55 bool freetype_constructor(synfig::ProgressCallback *cb)
56 {
57         int error;
58         if(cb)cb->task("Initializing FreeType...");
59         if ( (error = FT_Init_FreeType( &ft_library )) )
60         {
61                 if(cb)cb->error(strprintf("lyr_freetype: FreeType initialization failed. (err=%d)",error));
62                 return false;
63         }
64         return true;
65 }
66
67 void freetype_destructor()
68 {
69         std::cerr<<"freetype_destructor()"<<std::endl;
70 }
71
72 /* === E N T R Y P O I N T ================================================= */
73
74 MODULE_DESC_BEGIN(liblyr_freetype)
75         MODULE_NAME("FreeType Font Layer")
76         MODULE_DESCRIPTION("Provides a font rendering layer via FreeType")
77         MODULE_AUTHOR("Robert B. Quattlebaum")
78         MODULE_VERSION("1.0")
79         MODULE_COPYRIGHT(SYNFIG_COPYRIGHT)
80
81         MODULE_CONSTRUCTOR(freetype_constructor)
82         MODULE_DESTRUCTOR(freetype_destructor)
83 MODULE_DESC_END
84
85 MODULE_INVENTORY_BEGIN(liblyr_freetype)
86         BEGIN_LAYERS
87                 LAYER(lyr_freetype)
88                 LAYER_ALIAS(lyr_freetype,"Text")
89         END_LAYERS
90 MODULE_INVENTORY_END