1 module fontconfig.fctypes; 2 3 import std.string : toStringz, fromStringz, toLower; 4 import std.algorithm : endsWith; 5 6 alias FcChar8 = char; 7 alias FcChar16 = wchar; 8 alias FcChar32 = dchar; 9 alias FcBool = int; 10 11 enum : int { 12 FcFalse = 0, 13 FcTrue = 1 14 } 15 16 struct FcMatrix { 17 double xx, xy, yx, yy; 18 } 19 20 struct FcCharSet {} 21 22 struct FcLangSet {} 23 24 struct FcConfig {} 25 26 enum : int { 27 FcTypeUnknown = -1, 28 FcTypeVoid, 29 FcTypeInteger, 30 FcTypeDouble, 31 FcTypeString, 32 FcTypeBool, 33 FcTypeMatrix, 34 FcTypeCharSet, 35 FcTypeFTFace, 36 FcTypeLangSet, 37 FcTypeRange 38 } 39 40 alias FcType = int; 41 42 enum : int { 43 FcResultMatch, 44 FcResultNoMatch, 45 FcResultTypeMismatch, 46 FcResultNoId, 47 FcResultOutOfMemory 48 } 49 50 alias FcResult = int; 51 52 struct FcValue { 53 FcType type; 54 union { 55 const FcChar8 *s; 56 int i; 57 FcBool b; 58 double d; 59 const FcMatrix *m; 60 const FcCharSet *c; 61 void *f; 62 const FcLangSet *l; 63 const FcRange *r; 64 } 65 } 66 67 enum FcMatchKind { 68 FcMatchPattern, 69 FcMatchFont, 70 FcMatchScan 71 } 72 73 enum FcLangResult { 74 FcLangEqual = 0, 75 FcLangDifferentCountry = 1, 76 FcLangDifferentTerritory = 1, 77 FcLangDifferentLang = 2 78 } 79 80 enum FcSetName { 81 FcSetSystem = 0, 82 FcSetApplication = 1 83 } 84 85 enum FcEndian { 86 FcEndianBig, 87 FcEndianLittle 88 } 89 90 struct FcFontSet { 91 int nfont; 92 int sfont; 93 FcPattern **fonts; 94 } 95 96 struct FcObjectSet { 97 int nobject; 98 int sobject; 99 const char **objects; 100 } 101 102 struct FcPattern {} 103 104 struct FcRange {} 105 106 enum { 107 FC_WEIGHT_THIN = 0, 108 FC_WEIGHT_EXTRALIGHT = 40, 109 FC_WEIGHT_ULTRALIGHT = FC_WEIGHT_EXTRALIGHT, 110 FC_WEIGHT_LIGHT = 50, 111 FC_WEIGHT_DEMILIGHT = 55, 112 FC_WEIGHT_SEMILIGHT = FC_WEIGHT_DEMILIGHT, 113 FC_WEIGHT_BOOK = 75, 114 FC_WEIGHT_REGULAR = 80, 115 FC_WEIGHT_NORMAL = FC_WEIGHT_REGULAR, 116 FC_WEIGHT_MEDIUM = 100, 117 FC_WEIGHT_DEMIBOLD = 180, 118 FC_WEIGHT_SEMIBOLD = FC_WEIGHT_DEMIBOLD, 119 FC_WEIGHT_BOLD = 200, 120 FC_WEIGHT_EXTRABOLD = 205, 121 FC_WEIGHT_ULTRABOLD = FC_WEIGHT_EXTRABOLD, 122 FC_WEIGHT_BLACK = 210, 123 FC_WEIGHT_HEAVY = FC_WEIGHT_BLACK, 124 FC_WEIGHT_EXTRABLACK = 215, 125 FC_WEIGHT_ULTRABLACK = FC_WEIGHT_EXTRABLACK 126 } 127 128 enum { 129 FC_SLANT_ROMAN =0, 130 FC_SLANT_ITALIC =100, 131 FC_SLANT_OBLIQUE =110 132 } 133 134 enum { 135 FC_WIDTH_ULTRACONDENSED =50, 136 FC_WIDTH_EXTRACONDENSED =63, 137 FC_WIDTH_CONDENSED =75, 138 FC_WIDTH_SEMICONDENSED =87, 139 FC_WIDTH_NORMAL =100, 140 FC_WIDTH_SEMIEXPANDED =113, 141 FC_WIDTH_EXPANDED =125, 142 FC_WIDTH_EXTRAEXPANDED =150, 143 FC_WIDTH_ULTRAEXPANDED =200 144 } 145 146 enum { 147 FC_PROPORTIONAL =0, 148 FC_DUAL =90, 149 FC_MONO =100, 150 FC_CHARCELL =110 151 } 152 153 const FC_FAMILY = "family"; /* String */ 154 const FC_STYLE = "style"; /* String */ 155 const FC_SLANT = "slant"; /* Int */ 156 const FC_WEIGHT = "weight"; /* Int */ 157 const FC_SIZE = "size"; /* Range (double) */ 158 const FC_ASPECT = "aspect"; /* Double */ 159 const FC_PIXEL_SIZE = "pixelsize"; /* Double */ 160 const FC_SPACING = "spacing"; /* Int */ 161 const FC_FOUNDRY = "foundry"; /* String */ 162 const FC_ANTIALIAS = "antialias"; /* Bool (depends) */ 163 const FC_HINTING = "hinting"; /* Bool (true) */ 164 const FC_HINT_STYLE = "hintstyle"; /* Int */ 165 const FC_VERTICAL_LAYOUT = "verticallayout"; /* Bool (false) */ 166 const FC_AUTOHINT = "autohint"; /* Bool (false) */ 167 const FC_GLOBAL_ADVANCE = "globaladvance"; /* Bool (true) */ 168 const FC_WIDTH = "width"; /* Int */ 169 const FC_FILE = "file"; /* String */ 170 const FC_INDEX = "index"; /* Int */ 171 const FC_FT_FACE = "ftface"; /* FT_Face */ 172 const FC_RASTERIZER = "rasterizer"; /* String (deprecated) */ 173 const FC_OUTLINE = "outline"; /* Bool */ 174 const FC_SCALABLE = "scalable"; /* Bool */ 175 const FC_COLOR = "color"; /* Bool */ 176 const FC_SCALE = "scale"; /* double */ 177 const FC_DPI = "dpi"; /* double */ 178 const FC_RGBA = "rgba"; /* Int */ 179 const FC_MINSPACE = "minspace"; /* Bool use minimum line spacing */ 180 const FC_SOURCE = "source"; /* String (deprecated) */ 181 const FC_CHARSET = "charset"; /* CharSet */ 182 const FC_LANG = "lang"; /* String RFC 3066 langs */ 183 const FC_FONTVERSION = "fontversion"; /* Int from 'head' table */ 184 const FC_FULLNAME = "fullname"; /* String */ 185 const FC_FAMILYLANG = "familylang"; /* String RFC 3066 langs */ 186 const FC_STYLELANG = "stylelang"; /* String RFC 3066 langs */ 187 const FC_FULLNAMELANG = "fullnamelang"; /* String RFC 3066 langs */ 188 const FC_CAPABILITY = "capability"; /* String */ 189 const FC_FONTFORMAT = "fontformat"; /* String */ 190 const FC_EMBOLDEN = "embolden"; /* Bool - true if emboldening needed*/ 191 const FC_EMBEDDED_BITMAP = "embeddedbitmap"; /* Bool - true to enable embedded bitmaps */ 192 const FC_DECORATIVE = "decorative"; /* Bool - true if style is a decorative variant */ 193 const FC_LCD_FILTER = "lcdfilter"; /* Int */ 194 const FC_FONT_FEATURES = "fontfeatures"; /* String */ 195 const FC_NAMELANG = "namelang"; /* String RFC 3866 langs */ 196 const FC_PRGNAME = "prgname"; /* String */ 197 const FC_HASH = "hash"; /* String (deprecated) */ 198 const FC_POSTSCRIPT_NAME = "postscriptname"; /* String */ 199 200