]> gitweb.factorcode.org Git - factor.git/blob - extra/freetype/freetype.factor
more loading fixes
[factor.git] / extra / freetype / freetype.factor
1 ! Copyright (C) 2005, 2007 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien alien.syntax kernel system combinators
4 alien.libraries ;
5 IN: freetype
6
7 << "freetype" {
8     { [ os macosx? ] [ "/usr/X11R6/lib/libfreetype.6.dylib" "cdecl" add-library ] }
9     { [ os windows? ] [ "freetype6.dll" "cdecl" add-library ] }
10     { [ t ] [ drop ] }
11 } cond >>
12
13 LIBRARY: freetype
14
15 TYPEDEF: uchar FT_Byte
16 TYPEDEF: void* FT_Bytes
17 TYPEDEF: char FT_Char
18 TYPEDEF: int FT_Int
19 TYPEDEF: int FT_Int32
20 TYPEDEF: uint FT_UInt
21 TYPEDEF: short FT_Short
22 TYPEDEF: ushort FT_UShort
23 TYPEDEF: long FT_Long
24 TYPEDEF: ulong FT_ULong
25 TYPEDEF: uchar FT_Bool
26 TYPEDEF: ulong FT_Offset
27 TYPEDEF: int FT_PtrDist
28 TYPEDEF: char FT_String
29 TYPEDEF: int FT_Tag
30 TYPEDEF: int FT_Error
31 TYPEDEF: long FT_Fixed
32 TYPEDEF: void* FT_Pointer
33 TYPEDEF: long FT_Pos
34 TYPEDEF: ushort FT_UFWord
35 TYPEDEF: short FT_F2Dot14
36 TYPEDEF: long FT_F26Dot6
37
38 FUNCTION: FT_Error FT_Init_FreeType ( void* library ) ;
39
40 ! circular reference between glyph and face
41 TYPEDEF: void face
42 TYPEDEF: void glyph
43
44 C-STRUCT: glyph
45     { "void*" "library" }
46     { "face*" "face" }
47     { "glyph*" "next" }
48     { "FT_UInt" "reserved" }
49     { "void*" "generic" }
50     { "void*" "generic" }
51
52     { "FT_Pos" "width" }
53     { "FT_Pos" "height" }
54
55     { "FT_Pos" "hori-bearing-x" }
56     { "FT_Pos" "hori-bearing-y" }
57     { "FT_Pos" "hori-advance" }
58
59     { "FT_Pos" "vert-bearing-x" }
60     { "FT_Pos" "vert-bearing-y" }
61     { "FT_Pos" "vert-advance" }
62
63     { "FT_Fixed" "linear-hori-advance" }
64     { "FT_Fixed" "linear-vert-advance" }
65     { "FT_Pos" "advance-x" }
66     { "FT_Pos" "advance-y" }
67
68     { "intptr_t" "format" }
69
70     { "int" "bitmap-rows" }
71     { "int" "bitmap-width" }
72     { "int" "bitmap-pitch" }
73     { "void*" "bitmap-buffer" }
74     { "short" "bitmap-num-grays" }
75     { "char" "bitmap-pixel-mode" }
76     { "char" "bitmap-palette-mode" }
77     { "void*" "bitmap-palette" }
78
79     { "FT_Int" "bitmap-left" }
80     { "FT_Int" "bitmap-top" }
81
82     { "short" "n-contours" }
83     { "short" "n-points" }
84
85     { "void*" "points" }
86     { "char*" "tags" }
87     { "short*" "contours" }
88
89     { "int" "outline-flags" }
90
91     { "FT_UInt" "num_subglyphs" }
92     { "void*" "subglyphs" }
93
94     { "void*" "control-data" }
95     { "long" "control-len" }
96
97     { "FT_Pos" "lsb-delta" }
98     { "FT_Pos" "rsb-delta" }
99
100     { "void*" "other" } ;
101
102 C-STRUCT: face-size
103     { "face*" "face" }
104     { "void*" "generic" }
105     { "void*" "generic" }
106
107     { "FT_UShort" "x-ppem" }
108     { "FT_UShort" "y-ppem" }
109
110     { "FT_Fixed" "x-scale" }
111     { "FT_Fixed" "y-scale" }
112
113     { "FT_Pos" "ascender" }
114     { "FT_Pos" "descender" }
115     { "FT_Pos" "height" }
116     { "FT_Pos" "max-advance" } ;
117
118 C-STRUCT: face
119     { "FT_Long" "num-faces" }
120     { "FT_Long" "index" }
121
122     { "FT_Long" "flags" }
123     { "FT_Long" "style-flags" }
124
125     { "FT_Long" "num-glyphs" }
126
127     { "FT_Char*" "family-name" }
128     { "FT_Char*" "style-name" }
129
130     { "FT_Int" "num-fixed-sizes" }
131     { "void*" "available-sizes" }
132
133     { "FT_Int" "num-charmaps" }
134     { "void*" "charmaps" }
135
136     { "void*" "generic" }
137     { "void*" "generic" }
138
139     { "FT_Pos" "x-min" }
140     { "FT_Pos" "y-min" }
141     { "FT_Pos" "x-max" }
142     { "FT_Pos" "y-max" }
143
144     { "FT_UShort" "units-per-em" }
145     { "FT_Short" "ascender" }
146     { "FT_Short" "descender" }
147     { "FT_Short" "height" }
148
149     { "FT_Short" "max-advance-width" }
150     { "FT_Short" "max-advance-height" }
151
152     { "FT_Short" "underline-position" }
153     { "FT_Short" "underline-thickness" }
154
155     { "glyph*" "glyph" }
156     { "face-size*" "size" }
157     { "void*" "charmap" } ;
158
159 C-STRUCT: FT_Bitmap
160     { "int" "rows" }
161     { "int" "width" }
162     { "int" "pitch" }
163     { "void*" "buffer" }
164     { "short" "num_grays" }
165     { "char" "pixel_mode" }
166     { "char" "palette_mode" }
167     { "void*" "palette" } ;
168
169 FUNCTION: FT_Error FT_New_Face ( void* library, FT_Char* font, FT_Long index, face* face ) ;
170
171 FUNCTION: FT_Error FT_New_Memory_Face ( void* library, FT_Byte* file_base, FT_Long file_size, FT_Long face_index, FT_Face* aface ) ;
172
173 FUNCTION: FT_Error FT_Set_Char_Size ( face* face, FT_F26Dot6 char_width, FT_F26Dot6 char_height, FT_UInt horizontal_dpi, FT_UInt vertical_dpi ) ;
174
175 FUNCTION: FT_Error FT_Load_Char ( face* face, FT_ULong charcode, FT_Int32 load_flags ) ;
176
177 C-ENUM:
178     FT_RENDER_MODE_NORMAL
179     FT_RENDER_MODE_LIGHT
180     FT_RENDER_MODE_MONO
181     FT_RENDER_MODE_LCD
182     FT_RENDER_MODE_LCD_V ;
183
184 C-ENUM:
185     FT_PIXEL_MODE_NONE
186     FT_PIXEL_MODE_MONO
187     FT_PIXEL_MODE_GRAY
188     FT_PIXEL_MODE_GRAY2
189     FT_PIXEL_MODE_GRAY4
190     FT_PIXEL_MODE_LCD
191     FT_PIXEL_MODE_LCD_V ;
192
193 FUNCTION: int FT_Render_Glyph ( glyph* slot, int render_mode ) ;
194
195 FUNCTION: void FT_Done_Face ( face* face ) ;
196
197 FUNCTION: void FT_Done_FreeType ( void* library ) ;
198
199 FUNCTION: FT_Long FT_MulFix ( FT_Long a, FT_Long b ) ;
200