1// x11-rs: Rust bindings for X11 libraries
2// The X11 libraries are available under the MIT license.
3// These bindings are public domain.
4
5use std::os::raw::*;
6
7use super::xlib::{Display, Region, Visual, XRectangle};
8use super::xrender::{XGlyphInfo, XRenderColor};
9
10//
11// external types
12//
13
14// freetype
15pub enum FT_FaceRec {}
16pub type FT_UInt = c_uint;
17
18// fontconfig
19pub type FcChar32 = c_uint;
20pub enum FcCharSet {}
21pub enum FcPattern {}
22
23#[repr(C)]
24pub enum FcEndian {
25 Big,
26 Little,
27}
28
29#[repr(C)]
30pub enum FcResult {
31 Match,
32 NoMatch,
33 TypeMismatch,
34 NoId,
35 OutOfMemory,
36}
37
38//
39// functions
40//
41
42x11_link! { Xft, xft, ["libXft.so.2", "libXft.so"], 77,
43 pub fn XftCharExists (_2: *mut Display, _1: *mut XftFont, _0: c_uint) -> c_int,
44 pub fn XftCharFontSpecRender (_7: *mut Display, _6: c_int, _5: c_ulong, _4: c_ulong, _3: c_int, _2: c_int, _1: *const XftCharFontSpec, _0: c_int) -> (),
45 pub fn XftCharIndex (_2: *mut Display, _1: *mut XftFont, _0: c_uint) -> c_uint,
46 pub fn XftCharSpecRender (_8: *mut Display, _7: c_int, _6: c_ulong, _5: *mut XftFont, _4: c_ulong, _3: c_int, _2: c_int, _1: *const XftCharSpec, _0: c_int) -> (),
47 pub fn XftColorAllocName (_4: *mut Display, _3: *const Visual, _2: c_ulong, _1: *const c_char, _0: *mut XftColor) -> c_int,
48 pub fn XftColorAllocValue (_4: *mut Display, _3: *mut Visual, _2: c_ulong, _1: *const XRenderColor, _0: *mut XftColor) -> c_int,
49 pub fn XftColorFree (_3: *mut Display, _2: *mut Visual, _1: c_ulong, _0: *mut XftColor) -> (),
50 pub fn XftDefaultHasRender (_0: *mut Display) -> c_int,
51 pub fn XftDefaultSet (_1: *mut Display, _0: *mut FcPattern) -> c_int,
52 pub fn XftDefaultSubstitute (_2: *mut Display, _1: c_int, _0: *mut FcPattern) -> (),
53 pub fn XftDrawChange (_1: *mut XftDraw, _0: c_ulong) -> (),
54 pub fn XftDrawCharFontSpec (_3: *mut XftDraw, _2: *const XftColor, _1: *const XftCharFontSpec, _0: c_int) -> (),
55 pub fn XftDrawCharSpec (_4: *mut XftDraw, _3: *const XftColor, _2: *mut XftFont, _1: *const XftCharSpec, _0: c_int) -> (),
56 pub fn XftDrawColormap (_0: *mut XftDraw) -> c_ulong,
57 pub fn XftDrawCreate (_3: *mut Display, _2: c_ulong, _1: *mut Visual, _0: c_ulong) -> *mut XftDraw,
58 pub fn XftDrawCreateAlpha (_2: *mut Display, _1: c_ulong, _0: c_int) -> *mut XftDraw,
59 pub fn XftDrawCreateBitmap (_1: *mut Display, _0: c_ulong) -> *mut XftDraw,
60 pub fn XftDrawDestroy (_0: *mut XftDraw) -> (),
61 pub fn XftDrawDisplay (_0: *mut XftDraw) -> *mut Display,
62 pub fn XftDrawDrawable (_0: *mut XftDraw) -> c_ulong,
63 pub fn XftDrawGlyphFontSpec (_3: *mut XftDraw, _2: *const XftColor, _1: *const XftGlyphFontSpec, _0: c_int) -> (),
64 pub fn XftDrawGlyphs (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_uint, _0: c_int) -> (),
65 pub fn XftDrawGlyphSpec (_4: *mut XftDraw, _3: *const XftColor, _2: *mut XftFont, _1: *const XftGlyphSpec, _0: c_int) -> (),
66 pub fn XftDrawPicture (_0: *mut XftDraw) -> c_ulong,
67 pub fn XftDrawRect (_5: *mut XftDraw, _4: *const XftColor, _3: c_int, _2: c_int, _1: c_uint, _0: c_uint) -> (),
68 pub fn XftDrawSetClip (_1: *mut XftDraw, _0: Region) -> c_int,
69 pub fn XftDrawSetClipRectangles (_4: *mut XftDraw, _3: c_int, _2: c_int, _1: *const XRectangle, _0: c_int) -> c_int,
70 pub fn XftDrawSetSubwindowMode (_1: *mut XftDraw, _0: c_int) -> (),
71 pub fn XftDrawSrcPicture (_1: *mut XftDraw, _0: *const XftColor) -> c_ulong,
72 pub fn XftDrawString16 (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_ushort, _0: c_int) -> (),
73 pub fn XftDrawString32 (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_uint, _0: c_int) -> (),
74 pub fn XftDrawString8 (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
75 pub fn XftDrawStringUtf16 (_7: *mut XftDraw, _6: *const XftColor, _5: *mut XftFont, _4: c_int, _3: c_int, _2: *const c_uchar, _1: FcEndian, _0: c_int) -> (),
76 pub fn XftDrawStringUtf8 (_6: *mut XftDraw, _5: *const XftColor, _4: *mut XftFont, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
77 pub fn XftDrawVisual (_0: *mut XftDraw) -> *mut Visual,
78 pub fn XftFontCheckGlyph (_5: *mut Display, _4: *mut XftFont, _3: c_int, _2: c_uint, _1: *mut c_uint, _0: *mut c_int) -> c_int,
79 pub fn XftFontClose (_1: *mut Display, _0: *mut XftFont) -> (),
80 pub fn XftFontCopy (_1: *mut Display, _0: *mut XftFont) -> *mut XftFont,
81 pub fn XftFontInfoCreate (_1: *mut Display, _0: *const FcPattern) -> *mut XftFontInfo,
82 pub fn XftFontInfoDestroy (_1: *mut Display, _0: *mut XftFontInfo) -> (),
83 pub fn XftFontInfoEqual (_1: *const XftFontInfo, _0: *const XftFontInfo) -> c_int,
84 pub fn XftFontInfoHash (_0: *const XftFontInfo) -> c_uint,
85 pub fn XftFontLoadGlyphs (_4: *mut Display, _3: *mut XftFont, _2: c_int, _1: *const c_uint, _0: c_int) -> (),
86 pub fn XftFontMatch (_3: *mut Display, _2: c_int, _1: *const FcPattern, _0: *mut FcResult) -> *mut FcPattern,
87 pub fn XftFontOpenInfo (_2: *mut Display, _1: *mut FcPattern, _0: *mut XftFontInfo) -> *mut XftFont,
88 pub fn XftFontOpenName (_2: *mut Display, _1: c_int, _0: *const c_char) -> *mut XftFont,
89 pub fn XftFontOpenPattern (_1: *mut Display, _0: *mut FcPattern) -> *mut XftFont,
90 pub fn XftFontOpenXlfd (_2: *mut Display, _1: c_int, _0: *const c_char) -> *mut XftFont,
91 pub fn XftFontUnloadGlyphs (_3: *mut Display, _2: *mut XftFont, _1: *const c_uint, _0: c_int) -> (),
92 pub fn XftGetVersion () -> c_int,
93 pub fn XftGlyphExtents (_4: *mut Display, _3: *mut XftFont, _2: *const c_uint, _1: c_int, _0: *mut XGlyphInfo) -> (),
94 pub fn XftGlyphFontSpecRender (_7: *mut Display, _6: c_int, _5: c_ulong, _4: c_ulong, _3: c_int, _2: c_int, _1: *const XftGlyphFontSpec, _0: c_int) -> (),
95 pub fn XftGlyphRender (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uint, _0: c_int) -> (),
96 pub fn XftGlyphSpecRender (_8: *mut Display, _7: c_int, _6: c_ulong, _5: *mut XftFont, _4: c_ulong, _3: c_int, _2: c_int, _1: *const XftGlyphSpec, _0: c_int) -> (),
97 pub fn XftInit (_0: *const c_char) -> c_int,
98 pub fn XftInitFtLibrary () -> c_int,
99 pub fn XftLockFace (_0: *mut XftFont) -> *mut FT_FaceRec,
100 pub fn XftNameParse (_0: *const c_char) -> *mut FcPattern,
101 pub fn XftNameUnparse (_2: *mut FcPattern, _1: *mut c_char, _0: c_int) -> c_int,
102 pub fn XftTextExtents16 (_4: *mut Display, _3: *mut XftFont, _2: *const c_ushort, _1: c_int, _0: *mut XGlyphInfo) -> (),
103 pub fn XftTextExtents32 (_4: *mut Display, _3: *mut XftFont, _2: *const c_uint, _1: c_int, _0: *mut XGlyphInfo) -> (),
104 pub fn XftTextExtents8 (_4: *mut Display, _3: *mut XftFont, _2: *const c_uchar, _1: c_int, _0: *mut XGlyphInfo) -> (),
105 pub fn XftTextExtentsUtf16 (_5: *mut Display, _4: *mut XftFont, _3: *const c_uchar, _2: FcEndian, _1: c_int, _0: *mut XGlyphInfo) -> (),
106 pub fn XftTextExtentsUtf8 (_4: *mut Display, _3: *mut XftFont, _2: *const c_uchar, _1: c_int, _0: *mut XGlyphInfo) -> (),
107 pub fn XftTextRender16 (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_ushort, _0: c_int) -> (),
108 pub fn XftTextRender16BE (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
109 pub fn XftTextRender16LE (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
110 pub fn XftTextRender32 (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uint, _0: c_int) -> (),
111 pub fn XftTextRender32BE (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
112 pub fn XftTextRender32LE (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
113 pub fn XftTextRender8 (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
114 pub fn XftTextRenderUtf16 (_11: *mut Display, _10: c_int, _9: c_ulong, _8: *mut XftFont, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const c_uchar, _1: FcEndian, _0: c_int) -> (),
115 pub fn XftTextRenderUtf8 (_10: *mut Display, _9: c_int, _8: c_ulong, _7: *mut XftFont, _6: c_ulong, _5: c_int, _4: c_int, _3: c_int, _2: c_int, _1: *const c_uchar, _0: c_int) -> (),
116 pub fn XftUnlockFace (_0: *mut XftFont) -> (),
117 pub fn XftXlfdParse (_2: *const c_char, _1: c_int, _0: c_int) -> *mut FcPattern,
118variadic:
119 pub fn XftFontOpen (_1: *mut Display, _0: c_int) -> *mut XftFont,
120 pub fn XftListFonts (_1: *mut Display, _0: c_int) -> *mut XftFontSet,
121globals:
122}
123
124//
125// types
126//
127
128pub enum XftFontInfo {}
129
130#[derive(Debug, Clone, Copy, PartialEq)]
131#[repr(C)]
132pub struct XftFont {
133 pub ascent: c_int,
134 pub descent: c_int,
135 pub height: c_int,
136 pub max_advance_width: c_int,
137 pub charset: *mut FcCharSet,
138 pub pattern: *mut FcPattern,
139}
140
141pub enum XftDraw {}
142
143#[derive(Debug, Clone, Copy, PartialEq)]
144#[repr(C)]
145pub struct XftColor {
146 pub pixel: c_ulong,
147 pub color: XRenderColor,
148}
149
150#[derive(Debug, Clone, Copy, PartialEq)]
151#[repr(C)]
152pub struct XftCharSpec {
153 pub ucs4: FcChar32,
154 pub x: c_short,
155 pub y: c_short,
156}
157
158#[derive(Debug, Clone, Copy, PartialEq)]
159#[repr(C)]
160pub struct XftCharFontSpec {
161 pub font: *mut XftFont,
162 pub ucs4: FcChar32,
163 pub x: c_short,
164 pub y: c_short,
165}
166
167#[derive(Debug, Clone, Copy, PartialEq)]
168#[repr(C)]
169pub struct XftFontSet {
170 pub nfont: c_int,
171 pub sfont: c_int,
172 pub fonts: *mut *mut XftPattern,
173}
174
175#[derive(Debug, Clone, Copy, PartialEq)]
176#[repr(C)]
177pub struct XftGlyphSpec {
178 pub glyph: FT_UInt,
179 pub x: c_short,
180 pub y: c_short,
181}
182
183#[derive(Debug, Clone, Copy, PartialEq)]
184#[repr(C)]
185pub struct XftGlyphFontSpec {
186 pub font: *mut XftFont,
187 pub glyph: FT_UInt,
188 pub x: c_short,
189 pub y: c_short,
190}
191
192pub enum XftPattern {}
193
194//
195// constants
196//
197
198// font attributes
199pub const XFT_FAMILY: &str = "family";
200pub const XFT_STYLE: &str = "style";
201pub const XFT_SLANT: &str = "slant";
202pub const XFT_WEIGHT: &str = "weight";
203pub const XFT_SIZE: &str = "size";
204pub const XFT_PIXEL_SIZE: &str = "pixelsize";
205pub const XFT_SPACING: &str = "spacing";
206pub const XFT_FOUNDRY: &str = "foundry";
207pub const XFT_ANTIALIAS: &str = "antialias";
208
209// slant values
210pub const XFT_SLANT_ROMAN: c_int = 0;
211pub const XFT_SLANT_ITALIC: c_int = 100;
212pub const XFT_SLANT_OBLIQUE: c_int = 110;
213
214// attribute types
215pub const XftTypeVoid: c_int = 0;
216pub const XftTypeInteger: c_int = 1;
217pub const XftTypeDouble: c_int = 2;
218pub const XftTypeString: c_int = 3;
219pub const XftTypeBool: c_int = 4;
220pub const XftTypeMatrix: c_int = 5;
221