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