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