1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
// x11-rs: Rust bindings for X11 libraries
// The X11 libraries are available under the MIT license.
// These bindings are public domain.

use std::os::raw::*;

use xlib::{Display, Region, Visual, XRectangle};
use xrender::{XGlyphInfo, XRenderColor};


//
// external types
//


// freetype
pub enum FT_FaceRec {}
pub type FT_UInt = c_uint;

// fontconfig
pub type FcChar32 = c_uint;
pub enum FcCharSet {}
pub enum FcPattern {}

#[repr(C)]
pub enum FcEndian { Big, Little }

#[repr(C)]
pub enum FcResult { Match, NoMatch, TypeMismatch, NoId, OutOfMemory }


//
// functions
//


x11_link! { Xft, xft, ["libXft.so.2", "libXft.so"], 77,
    pub fn XftCharExists (_2: *mut Display, _1: *mut XftFont, _0: c_uint) -> c_int,
    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) -> (),
    pub fn XftCharIndex (_2: *mut Display, _1: *mut XftFont, _0: c_uint) -> c_uint,
    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) -> (),
    pub fn XftColorAllocName (_4: *mut Display, _3: *const Visual, _2: c_ulong, _1: *const c_char, _0: *mut XftColor) -> c_int,
    pub fn XftColorAllocValue (_4: *mut Display, _3: *mut Visual, _2: c_ulong, _1: *const XRenderColor, _0: *mut XftColor) -> c_int,
    pub fn XftColorFree (_3: *mut Display, _2: *mut Visual, _1: c_ulong, _0: *mut XftColor) -> (),
    pub fn XftDefaultHasRender (_0: *mut Display) -> c_int,
    pub fn XftDefaultSet (_1: *mut Display, _0: *mut FcPattern) -> c_int,
    pub fn XftDefaultSubstitute (_2: *mut Display, _1: c_int, _0: *mut FcPattern) -> (),
    pub fn XftDrawChange (_1: *mut XftDraw, _0: c_ulong) -> (),
    pub fn XftDrawCharFontSpec (_3: *mut XftDraw, _2: *const XftColor, _1: *const XftCharFontSpec, _0: c_int) -> (),
    pub fn XftDrawCharSpec (_4: *mut XftDraw, _3: *const XftColor, _2: *mut XftFont, _1: *const XftCharSpec, _0: c_int) -> (),
    pub fn XftDrawColormap (_0: *mut XftDraw) -> c_ulong,
    pub fn XftDrawCreate (_3: *mut Display, _2: c_ulong, _1: *mut Visual, _0: c_ulong) -> *mut XftDraw,
    pub fn XftDrawCreateAlpha (_2: *mut Display, _1: c_ulong, _0: c_int) -> *mut XftDraw,
    pub fn XftDrawCreateBitmap (_1: *mut Display, _0: c_ulong) -> *mut XftDraw,
    pub fn XftDrawDestroy (_0: *mut XftDraw) -> (),
    pub fn XftDrawDisplay (_0: *mut XftDraw) -> *mut Display,
    pub fn XftDrawDrawable (_0: *mut XftDraw) -> c_ulong,
    pub fn XftDrawGlyphFontSpec (_3: *mut XftDraw, _2: *const XftColor, _1: *const XftGlyphFontSpec, _0: c_int) -> (),
    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) -> (),
    pub fn XftDrawGlyphSpec (_4: *mut XftDraw, _3: *const XftColor, _2: *mut XftFont, _1: *const XftGlyphSpec, _0: c_int) -> (),
    pub fn XftDrawPicture (_0: *mut XftDraw) -> c_ulong,
    pub fn XftDrawRect (_5: *mut XftDraw, _4: *const XftColor, _3: c_int, _2: c_int, _1: c_uint, _0: c_uint) -> (),
    pub fn XftDrawSetClip (_1: *mut XftDraw, _0: Region) -> c_int,
    pub fn XftDrawSetClipRectangles (_4: *mut XftDraw, _3: c_int, _2: c_int, _1: *const XRectangle, _0: c_int) -> c_int,
    pub fn XftDrawSetSubwindowMode (_1: *mut XftDraw, _0: c_int) -> (),
    pub fn XftDrawSrcPicture (_1: *mut XftDraw, _0: *const XftColor) -> c_ulong,
    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) -> (),
    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) -> (),
    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) -> (),
    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) -> (),
    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) -> (),
    pub fn XftDrawVisual (_0: *mut XftDraw) -> *mut Visual,
    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,
    pub fn XftFontClose (_1: *mut Display, _0: *mut XftFont) -> (),
    pub fn XftFontCopy (_1: *mut Display, _0: *mut XftFont) -> *mut XftFont,
    pub fn XftFontInfoCreate (_1: *mut Display, _0: *const FcPattern) -> *mut XftFontInfo,
    pub fn XftFontInfoDestroy (_1: *mut Display, _0: *mut XftFontInfo) -> (),
    pub fn XftFontInfoEqual (_1: *const XftFontInfo, _0: *const XftFontInfo) -> c_int,
    pub fn XftFontInfoHash (_0: *const XftFontInfo) -> c_uint,
    pub fn XftFontLoadGlyphs (_4: *mut Display, _3: *mut XftFont, _2: c_int, _1: *const c_uint, _0: c_int) -> (),
    pub fn XftFontMatch (_3: *mut Display, _2: c_int, _1: *const FcPattern, _0: *mut FcResult) -> *mut FcPattern,
    pub fn XftFontOpenInfo (_2: *mut Display, _1: *mut FcPattern, _0: *mut XftFontInfo) -> *mut XftFont,
    pub fn XftFontOpenName (_2: *mut Display, _1: c_int, _0: *const c_char) -> *mut XftFont,
    pub fn XftFontOpenPattern (_1: *mut Display, _0: *mut FcPattern) -> *mut XftFont,
    pub fn XftFontOpenXlfd (_2: *mut Display, _1: c_int, _0: *const c_char) -> *mut XftFont,
    pub fn XftFontUnloadGlyphs (_3: *mut Display, _2: *mut XftFont, _1: *const c_uint, _0: c_int) -> (),
    pub fn XftGetVersion () -> c_int,
    pub fn XftGlyphExtents (_4: *mut Display, _3: *mut XftFont, _2: *const c_uint, _1: c_int, _0: *mut XGlyphInfo) -> (),
    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) -> (),
    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) -> (),
    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) -> (),
    pub fn XftInit (_0: *const c_char) -> c_int,
    pub fn XftInitFtLibrary () -> c_int,
    pub fn XftLockFace (_0: *mut XftFont) -> *mut FT_FaceRec,
    pub fn XftNameParse (_0: *const c_char) -> *mut FcPattern,
    pub fn XftNameUnparse (_2: *mut FcPattern, _1: *mut c_char, _0: c_int) -> c_int,
    pub fn XftTextExtents16 (_4: *mut Display, _3: *mut XftFont, _2: *const c_ushort, _1: c_int, _0: *mut XGlyphInfo) -> (),
    pub fn XftTextExtents32 (_4: *mut Display, _3: *mut XftFont, _2: *const c_uint, _1: c_int, _0: *mut XGlyphInfo) -> (),
    pub fn XftTextExtents8 (_4: *mut Display, _3: *mut XftFont, _2: *const c_uchar, _1: c_int, _0: *mut XGlyphInfo) -> (),
    pub fn XftTextExtentsUtf16 (_5: *mut Display, _4: *mut XftFont, _3: *const c_uchar, _2: FcEndian, _1: c_int, _0: *mut XGlyphInfo) -> (),
    pub fn XftTextExtentsUtf8 (_4: *mut Display, _3: *mut XftFont, _2: *const c_uchar, _1: c_int, _0: *mut XGlyphInfo) -> (),
    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) -> (),
    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) -> (),
    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) -> (),
    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) -> (),
    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) -> (),
    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) -> (),
    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) -> (),
    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) -> (),
    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) -> (),
    pub fn XftUnlockFace (_0: *mut XftFont) -> (),
    pub fn XftXlfdParse (_2: *const c_char, _1: c_int, _0: c_int) -> *mut FcPattern,
variadic:
    pub fn XftFontOpen (_1: *mut Display, _0: c_int) -> *mut XftFont,
    pub fn XftListFonts (_1: *mut Display, _0: c_int) -> *mut XftFontSet,
globals:
}


//
// types
//


pub enum XftFontInfo {}

#[derive(Clone, Copy, PartialEq)]
#[repr(C)]
pub struct XftFont {
    pub ascent: c_int,
    pub descent: c_int,
    pub height: c_int,
    pub max_advance_width: c_int,
    pub charset: *mut FcCharSet,
    pub pattern: *mut FcPattern,
}

pub enum XftDraw {}

#[derive(Clone, Copy, PartialEq)]
#[repr(C)]
pub struct XftColor {
    pub pixel: c_ulong,
    pub color: XRenderColor,
}

#[derive(Clone, Copy, PartialEq)]
#[repr(C)]
pub struct XftCharSpec {
    pub ucs4: FcChar32,
    pub x: c_short,
    pub y: c_short,
}

#[derive(Clone, Copy, PartialEq)]
#[repr(C)]
pub struct XftCharFontSpec {
    pub font: *mut XftFont,
    pub ucs4: FcChar32,
    pub x: c_short,
    pub y: c_short,
}

#[derive(Clone, Copy, PartialEq)]
#[repr(C)]
pub struct XftFontSet {
    pub nfont: c_int,
    pub sfont: c_int,
    pub fonts: *mut *mut XftPattern,
}

#[derive(Clone, Copy, PartialEq)]
#[repr(C)]
pub struct XftGlyphSpec {
    pub glyph: FT_UInt,
    pub x: c_short,
    pub y: c_short,
}

#[derive(Clone, Copy, PartialEq)]
#[repr(C)]
pub struct XftGlyphFontSpec {
    pub font: *mut XftFont,
    pub glyph: FT_UInt,
    pub x: c_short,
    pub y: c_short,
}

pub enum XftPattern {}


//
// constants
//


// font attributes
pub const XFT_FAMILY: &'static str = "family";
pub const XFT_STYLE: &'static str = "style";
pub const XFT_SLANT: &'static str = "slant";
pub const XFT_WEIGHT: &'static str = "weight";
pub const XFT_SIZE: &'static str = "size";
pub const XFT_PIXEL_SIZE: &'static str = "pixelsize";
pub const XFT_SPACING: &'static str = "spacing";
pub const XFT_FOUNDRY: &'static str = "foundry";
pub const XFT_ANTIALIAS: &'static str = "antialias";

// slant values
pub const XFT_SLANT_ROMAN: c_int = 0;
pub const XFT_SLANT_ITALIC: c_int = 100;
pub const XFT_SLANT_OBLIQUE: c_int = 110;

// attribute types
pub const XftTypeVoid: c_int = 0;
pub const XftTypeInteger: c_int = 1;
pub const XftTypeDouble: c_int = 2;
pub const XftTypeString: c_int = 3;
pub const XftTypeBool: c_int = 4;
pub const XftTypeMatrix: c_int = 5;