2
/******************************************************************************
3
* MODULE : free_type.cpp
4
* DESCRIPTION: Interface with Free Type II
5
* COPYRIGHT : (C) 2003 Joris van der Hoeven
6
*******************************************************************************
7
* This software falls under the GNU general public license and comes WITHOUT
8
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
9
* If you don't have this file, write to the Free Software Foundation, Inc.,
10
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
11
******************************************************************************/
13
#include "Freetype/free_type.hpp"
14
#include "Link/dyn_link.hpp"
18
static bool ft_initialized= false;
19
static bool ft_error = true;
21
FT_Library ft_library;
23
FT_Error (*ft_init_freetype) (FT_Library *alibrary);
24
FT_Error (*ft_new_face) (FT_Library library,
25
const char* filepathname,
28
FT_Error (*ft_set_char_size) (FT_Face face,
29
FT_F26Dot6 char_width,
30
FT_F26Dot6 char_height,
31
FT_UInt horz_resolution,
32
FT_UInt vert_resolution);
33
FT_UInt (*ft_get_char_index) (FT_Face face,
35
FT_Error (*ft_load_glyph) (FT_Face face,
38
FT_Error (*ft_render_glyph) (FT_GlyphSlot slot,
39
FT_Render_Mode render_mode);
41
typedef FT_Error (*glyph_renderer) (FT_GlyphSlot, FT_Render_Mode);
45
if (ft_initialized) return ft_error;
47
#ifdef LINKED_FREETYPE
48
ft_init_freetype = FT_Init_FreeType;
49
ft_new_face = FT_New_Face;
50
ft_set_char_size = FT_Set_Char_Size;
51
ft_get_char_index= FT_Get_Char_Index;
52
ft_load_glyph = FT_Load_Glyph;
53
ft_render_glyph = (glyph_renderer) ((void*) FT_Render_Glyph);
54
if (ft_init_freetype (&ft_library)) return true;
55
if (DEBUG_AUTO) cout << "TeXmacs] With linked TrueType support\n";
57
int status= debug_off ();
58
(void) symbol_install ("/usr/lib/libfreetype.so", "FT_Init_FreeType" ,
59
(pointer&) ft_init_freetype);
60
if (ft_init_freetype == NULL) return true;
61
(void) symbol_install ("/usr/lib/libfreetype.so", "FT_New_Face" ,
62
(pointer&) ft_new_face);
63
if (ft_new_face == NULL) return true;
64
(void) symbol_install ("/usr/lib/libfreetype.so", "FT_Set_Char_Size" ,
65
(pointer&) ft_set_char_size);
66
if (ft_set_char_size == NULL) return true;
67
(void) symbol_install ("/usr/lib/libfreetype.so", "FT_Get_Char_Index",
68
(pointer&) ft_get_char_index);
69
if (ft_get_char_index == NULL) return true;
70
(void) symbol_install ("/usr/lib/libfreetype.so", "FT_Load_Glyph" ,
71
(pointer&) ft_load_glyph);
72
if (ft_load_glyph == NULL) return true;
73
(void) symbol_install ("/usr/lib/libfreetype.so", "FT_Render_Glyph" ,
74
(pointer&) ft_render_glyph);
75
if (ft_render_glyph == NULL) return true;
77
if (ft_init_freetype (&ft_library)) return true;
78
if (DEBUG_AUTO) cout << "TeXmacs] Installed TrueType support\n";
86
return !ft_initialize ();
91
bool ft_initialize () { return true; }
92
bool ft_present () { return false; }