1 module directx.dwrite_1; 2 //+-------------------------------------------------------------------------- 3 // 4 // Copyright (c) Microsoft Corporation. All rights reserved. 5 // 6 // Abstract: 7 // DirectX Typography Services public API definitions. 8 // 9 //---------------------------------------------------------------------------- 10 11 public import directx.dwrite; 12 13 /// <summary> 14 /// The overall kind of family. 15 /// </summary> 16 alias DWRITE_PANOSE_FAMILY = int; 17 enum : DWRITE_PANOSE_FAMILY 18 { 19 DWRITE_PANOSE_FAMILY_ANY = 0, 20 DWRITE_PANOSE_FAMILY_NO_FIT = 1, 21 DWRITE_PANOSE_FAMILY_TEXT_DISPLAY = 2, 22 DWRITE_PANOSE_FAMILY_SCRIPT = 3, // or hand written 23 DWRITE_PANOSE_FAMILY_DECORATIVE = 4, 24 DWRITE_PANOSE_FAMILY_SYMBOL = 5, // or symbol 25 DWRITE_PANOSE_FAMILY_PICTORIAL = DWRITE_PANOSE_FAMILY_SYMBOL 26 } 27 28 /// <summary> 29 /// Appearance of the serifs. 30 /// Present for families: 2-text 31 /// </summary> 32 alias DWRITE_PANOSE_SERIF_STYLE = int; 33 enum : DWRITE_PANOSE_SERIF_STYLE 34 { 35 DWRITE_PANOSE_SERIF_STYLE_ANY = 0, 36 DWRITE_PANOSE_SERIF_STYLE_NO_FIT = 1, 37 DWRITE_PANOSE_SERIF_STYLE_COVE = 2, 38 DWRITE_PANOSE_SERIF_STYLE_OBTUSE_COVE = 3, 39 DWRITE_PANOSE_SERIF_STYLE_SQUARE_COVE = 4, 40 DWRITE_PANOSE_SERIF_STYLE_OBTUSE_SQUARE_COVE = 5, 41 DWRITE_PANOSE_SERIF_STYLE_SQUARE = 6, 42 DWRITE_PANOSE_SERIF_STYLE_THIN = 7, 43 DWRITE_PANOSE_SERIF_STYLE_OVAL = 8, 44 DWRITE_PANOSE_SERIF_STYLE_EXAGGERATED = 9, 45 DWRITE_PANOSE_SERIF_STYLE_TRIANGLE = 10, 46 DWRITE_PANOSE_SERIF_STYLE_NORMAL_SANS = 11, 47 DWRITE_PANOSE_SERIF_STYLE_OBTUSE_SANS = 12, 48 DWRITE_PANOSE_SERIF_STYLE_PERPENDICULAR_SANS = 13, 49 DWRITE_PANOSE_SERIF_STYLE_FLARED = 14, 50 DWRITE_PANOSE_SERIF_STYLE_ROUNDED = 15, 51 DWRITE_PANOSE_SERIF_STYLE_SCRIPT = 16, 52 DWRITE_PANOSE_SERIF_STYLE_PERP_SANS = DWRITE_PANOSE_SERIF_STYLE_PERPENDICULAR_SANS, 53 DWRITE_PANOSE_SERIF_STYLE_BONE = DWRITE_PANOSE_SERIF_STYLE_OVAL 54 } 55 56 /// <summary> 57 /// PANOSE font weights. These roughly correspond to the DWRITE_FONT_WEIGHT's 58 /// using (panose_weight - 2) * 100. 59 /// Present for families: 2-text, 3-script, 4-decorative, 5-symbol 60 /// </summary> 61 alias DWRITE_PANOSE_WEIGHT = int; 62 enum : DWRITE_PANOSE_WEIGHT 63 { 64 DWRITE_PANOSE_WEIGHT_ANY = 0, 65 DWRITE_PANOSE_WEIGHT_NO_FIT = 1, 66 DWRITE_PANOSE_WEIGHT_VERY_LIGHT = 2, 67 DWRITE_PANOSE_WEIGHT_LIGHT = 3, 68 DWRITE_PANOSE_WEIGHT_THIN = 4, 69 DWRITE_PANOSE_WEIGHT_BOOK = 5, 70 DWRITE_PANOSE_WEIGHT_MEDIUM = 6, 71 DWRITE_PANOSE_WEIGHT_DEMI = 7, 72 DWRITE_PANOSE_WEIGHT_BOLD = 8, 73 DWRITE_PANOSE_WEIGHT_HEAVY = 9, 74 DWRITE_PANOSE_WEIGHT_BLACK = 10, 75 DWRITE_PANOSE_WEIGHT_EXTRA_BLACK = 11, 76 DWRITE_PANOSE_WEIGHT_NORD = DWRITE_PANOSE_WEIGHT_EXTRA_BLACK 77 } 78 79 /// <summary> 80 /// Proportion of the glyph shape considering additional detail to standard 81 /// characters. 82 /// Present for families: 2-text 83 /// </summary> 84 alias DWORD DWRITE_PANOSE_PROPORTION; 85 enum : DWRITE_PANOSE_PROPORTION 86 { 87 DWRITE_PANOSE_PROPORTION_ANY = 0, 88 DWRITE_PANOSE_PROPORTION_NO_FIT = 1, 89 DWRITE_PANOSE_PROPORTION_OLD_STYLE = 2, 90 DWRITE_PANOSE_PROPORTION_MODERN = 3, 91 DWRITE_PANOSE_PROPORTION_EVEN_WIDTH = 4, 92 DWRITE_PANOSE_PROPORTION_EXPANDED = 5, 93 DWRITE_PANOSE_PROPORTION_CONDENSED = 6, 94 DWRITE_PANOSE_PROPORTION_VERY_EXPANDED = 7, 95 DWRITE_PANOSE_PROPORTION_VERY_CONDENSED = 8, 96 DWRITE_PANOSE_PROPORTION_MONOSPACED = 9 97 } 98 99 /// <summary> 100 /// Ratio between thickest and thinnest point of the stroke for a letter such 101 /// as uppercase 'O'. 102 /// Present for families: 2-text, 3-script, 4-decorative 103 /// </summary> 104 alias DWRITE_PANOSE_CONTRAST = int; 105 enum : DWRITE_PANOSE_CONTRAST 106 { 107 DWRITE_PANOSE_CONTRAST_ANY = 0, 108 DWRITE_PANOSE_CONTRAST_NO_FIT = 1, 109 DWRITE_PANOSE_CONTRAST_NONE = 2, 110 DWRITE_PANOSE_CONTRAST_VERY_LOW = 3, 111 DWRITE_PANOSE_CONTRAST_LOW = 4, 112 DWRITE_PANOSE_CONTRAST_MEDIUM_LOW = 5, 113 DWRITE_PANOSE_CONTRAST_MEDIUM = 6, 114 DWRITE_PANOSE_CONTRAST_MEDIUM_HIGH = 7, 115 DWRITE_PANOSE_CONTRAST_HIGH = 8, 116 DWRITE_PANOSE_CONTRAST_VERY_HIGH = 9, 117 DWRITE_PANOSE_CONTRAST_HORIZONTAL_LOW = 10, 118 DWRITE_PANOSE_CONTRAST_HORIZONTAL_MEDIUM = 11, 119 DWRITE_PANOSE_CONTRAST_HORIZONTAL_HIGH = 12, 120 DWRITE_PANOSE_CONTRAST_BROKEN = 13 121 } 122 123 /// <summary> 124 /// Relationship between thin and thick stems. 125 /// Present for families: 2-text 126 /// </summary> 127 alias DWRITE_PANOSE_STROKE_VARIATION = int; 128 enum : DWRITE_PANOSE_STROKE_VARIATION 129 { 130 DWRITE_PANOSE_STROKE_VARIATION_ANY = 0, 131 DWRITE_PANOSE_STROKE_VARIATION_NO_FIT = 1, 132 DWRITE_PANOSE_STROKE_VARIATION_NO_VARIATION = 2, 133 DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_DIAGONAL = 3, 134 DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_TRANSITIONAL = 4, 135 DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_VERTICAL = 5, 136 DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_HORIZONTAL = 6, 137 DWRITE_PANOSE_STROKE_VARIATION_RAPID_VERTICAL = 7, 138 DWRITE_PANOSE_STROKE_VARIATION_RAPID_HORIZONTAL = 8, 139 DWRITE_PANOSE_STROKE_VARIATION_INSTANT_VERTICAL = 9, 140 DWRITE_PANOSE_STROKE_VARIATION_INSTANT_HORIZONTAL = 10 141 } 142 143 /// <summary> 144 /// Style of termination of stems and rounded letterforms. 145 /// Present for families: 2-text 146 /// </summary> 147 alias DWRITE_PANOSE_ARM_STYLE = int; 148 enum : DWRITE_PANOSE_ARM_STYLE 149 { 150 DWRITE_PANOSE_ARM_STYLE_ANY = 0, 151 DWRITE_PANOSE_ARM_STYLE_NO_FIT = 1, 152 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_HORIZONTAL = 2, 153 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_WEDGE = 3, 154 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_VERTICAL = 4, 155 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_SINGLE_SERIF = 5, 156 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_DOUBLE_SERIF = 6, 157 DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_HORIZONTAL = 7, 158 DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_WEDGE = 8, 159 DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_VERTICAL = 9, 160 DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_SINGLE_SERIF = 10, 161 DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_DOUBLE_SERIF = 11, 162 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_HORZ = DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_HORIZONTAL, 163 DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_VERT = DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_VERTICAL, 164 DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_HORZ = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_HORIZONTAL, 165 DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_WEDGE = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_WEDGE, 166 DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_VERT = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_VERTICAL, 167 DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_SINGLE_SERIF = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_SINGLE_SERIF, 168 DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_DOUBLE_SERIF = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_DOUBLE_SERIF 169 } 170 171 /// <summary> 172 /// Roundness of letterform. 173 /// Present for families: 2-text 174 /// </summary> 175 alias DWRITE_PANOSE_LETTERFORM = int; 176 enum : DWRITE_PANOSE_LETTERFORM 177 { 178 DWRITE_PANOSE_LETTERFORM_ANY = 0, 179 DWRITE_PANOSE_LETTERFORM_NO_FIT = 1, 180 DWRITE_PANOSE_LETTERFORM_NORMAL_CONTACT = 2, 181 DWRITE_PANOSE_LETTERFORM_NORMAL_WEIGHTED = 3, 182 DWRITE_PANOSE_LETTERFORM_NORMAL_BOXED = 4, 183 DWRITE_PANOSE_LETTERFORM_NORMAL_FLATTENED = 5, 184 DWRITE_PANOSE_LETTERFORM_NORMAL_ROUNDED = 6, 185 DWRITE_PANOSE_LETTERFORM_NORMAL_OFF_CENTER = 7, 186 DWRITE_PANOSE_LETTERFORM_NORMAL_SQUARE = 8, 187 DWRITE_PANOSE_LETTERFORM_OBLIQUE_CONTACT = 9, 188 DWRITE_PANOSE_LETTERFORM_OBLIQUE_WEIGHTED = 10, 189 DWRITE_PANOSE_LETTERFORM_OBLIQUE_BOXED = 11, 190 DWRITE_PANOSE_LETTERFORM_OBLIQUE_FLATTENED = 12, 191 DWRITE_PANOSE_LETTERFORM_OBLIQUE_ROUNDED = 13, 192 DWRITE_PANOSE_LETTERFORM_OBLIQUE_OFF_CENTER = 14, 193 DWRITE_PANOSE_LETTERFORM_OBLIQUE_SQUARE = 15 194 } 195 196 /// <summary> 197 /// Placement of midline across uppercase characters and treatment of diagonal 198 /// stem apexes. 199 /// Present for families: 2-text 200 /// </summary> 201 alias DWRITE_PANOSE_MIDLINE = int; 202 enum : DWRITE_PANOSE_MIDLINE 203 { 204 DWRITE_PANOSE_MIDLINE_ANY = 0, 205 DWRITE_PANOSE_MIDLINE_NO_FIT = 1, 206 DWRITE_PANOSE_MIDLINE_STANDARD_TRIMMED = 2, 207 DWRITE_PANOSE_MIDLINE_STANDARD_POINTED = 3, 208 DWRITE_PANOSE_MIDLINE_STANDARD_SERIFED = 4, 209 DWRITE_PANOSE_MIDLINE_HIGH_TRIMMED = 5, 210 DWRITE_PANOSE_MIDLINE_HIGH_POINTED = 6, 211 DWRITE_PANOSE_MIDLINE_HIGH_SERIFED = 7, 212 DWRITE_PANOSE_MIDLINE_CONSTANT_TRIMMED = 8, 213 DWRITE_PANOSE_MIDLINE_CONSTANT_POINTED = 9, 214 DWRITE_PANOSE_MIDLINE_CONSTANT_SERIFED = 10, 215 DWRITE_PANOSE_MIDLINE_LOW_TRIMMED = 11, 216 DWRITE_PANOSE_MIDLINE_LOW_POINTED = 12, 217 DWRITE_PANOSE_MIDLINE_LOW_SERIFED = 13 218 } 219 220 /// <summary> 221 /// Relative size of lowercase letters and treament of diacritic marks 222 /// and uppercase glyphs. 223 /// Present for families: 2-text 224 /// </summary> 225 alias DWRITE_PANOSE_XHEIGHT = int; 226 enum : DWRITE_PANOSE_XHEIGHT 227 { 228 DWRITE_PANOSE_XHEIGHT_ANY = 0, 229 DWRITE_PANOSE_XHEIGHT_NO_FIT = 1, 230 DWRITE_PANOSE_XHEIGHT_CONSTANT_SMALL = 2, 231 DWRITE_PANOSE_XHEIGHT_CONSTANT_STANDARD = 3, 232 DWRITE_PANOSE_XHEIGHT_CONSTANT_LARGE = 4, 233 DWRITE_PANOSE_XHEIGHT_DUCKING_SMALL = 5, 234 DWRITE_PANOSE_XHEIGHT_DUCKING_STANDARD = 6, 235 DWRITE_PANOSE_XHEIGHT_DUCKING_LARGE = 7, 236 DWRITE_PANOSE_XHEIGHT_CONSTANT_STD = DWRITE_PANOSE_XHEIGHT_CONSTANT_STANDARD, 237 DWRITE_PANOSE_XHEIGHT_DUCKING_STD = DWRITE_PANOSE_XHEIGHT_DUCKING_STANDARD 238 } 239 240 /// <summary> 241 /// Kind of tool used to create character forms. 242 /// Present for families: 3-script 243 /// </summary> 244 alias DWRITE_PANOSE_TOOL_KIND = int; 245 enum : DWRITE_PANOSE_TOOL_KIND 246 { 247 DWRITE_PANOSE_TOOL_KIND_ANY = 0, 248 DWRITE_PANOSE_TOOL_KIND_NO_FIT = 1, 249 DWRITE_PANOSE_TOOL_KIND_FLAT_NIB = 2, 250 DWRITE_PANOSE_TOOL_KIND_PRESSURE_POINT = 3, 251 DWRITE_PANOSE_TOOL_KIND_ENGRAVED = 4, 252 DWRITE_PANOSE_TOOL_KIND_BALL = 5, 253 DWRITE_PANOSE_TOOL_KIND_BRUSH = 6, 254 DWRITE_PANOSE_TOOL_KIND_ROUGH = 7, 255 DWRITE_PANOSE_TOOL_KIND_FELT_PEN_BRUSH_TIP = 8, 256 DWRITE_PANOSE_TOOL_KIND_WILD_BRUSH = 9 257 } 258 259 /// <summary> 260 /// Monospace vs proportional. 261 /// Present for families: 3-script, 5-symbol 262 /// </summary> 263 alias DWRITE_PANOSE_SPACING = int; 264 enum : DWRITE_PANOSE_SPACING 265 { 266 DWRITE_PANOSE_SPACING_ANY = 0, 267 DWRITE_PANOSE_SPACING_NO_FIT = 1, 268 DWRITE_PANOSE_SPACING_PROPORTIONAL_SPACED = 2, 269 DWRITE_PANOSE_SPACING_MONOSPACED = 3, 270 } 271 272 /// <summary> 273 /// Ratio between width and height of the face. 274 /// Present for families: 3-script 275 /// </summary> 276 alias DWRITE_PANOSE_ASPECT_RATIO = int; 277 enum : DWRITE_PANOSE_ASPECT_RATIO 278 { 279 DWRITE_PANOSE_ASPECT_RATIO_ANY = 0, 280 DWRITE_PANOSE_ASPECT_RATIO_NO_FIT = 1, 281 DWRITE_PANOSE_ASPECT_RATIO_VERY_CONDENSED = 2, 282 DWRITE_PANOSE_ASPECT_RATIO_CONDENSED = 3, 283 DWRITE_PANOSE_ASPECT_RATIO_NORMAL = 4, 284 DWRITE_PANOSE_ASPECT_RATIO_EXPANDED = 5, 285 DWRITE_PANOSE_ASPECT_RATIO_VERY_EXPANDED = 6 286 } 287 288 /// <summary> 289 /// Topology of letterforms. 290 /// Present for families: 3-script 291 /// </summary> 292 alias DWRITE_PANOSE_SCRIPT_TOPOLOGY = int; 293 enum : DWRITE_PANOSE_SCRIPT_TOPOLOGY 294 { 295 DWRITE_PANOSE_SCRIPT_TOPOLOGY_ANY = 0, 296 DWRITE_PANOSE_SCRIPT_TOPOLOGY_NO_FIT = 1, 297 DWRITE_PANOSE_SCRIPT_TOPOLOGY_ROMAN_DISCONNECTED = 2, 298 DWRITE_PANOSE_SCRIPT_TOPOLOGY_ROMAN_TRAILING = 3, 299 DWRITE_PANOSE_SCRIPT_TOPOLOGY_ROMAN_CONNECTED = 4, 300 DWRITE_PANOSE_SCRIPT_TOPOLOGY_CURSIVE_DISCONNECTED = 5, 301 DWRITE_PANOSE_SCRIPT_TOPOLOGY_CURSIVE_TRAILING = 6, 302 DWRITE_PANOSE_SCRIPT_TOPOLOGY_CURSIVE_CONNECTED = 7, 303 DWRITE_PANOSE_SCRIPT_TOPOLOGY_BLACKLETTER_DISCONNECTED = 8, 304 DWRITE_PANOSE_SCRIPT_TOPOLOGY_BLACKLETTER_TRAILING = 9, 305 DWRITE_PANOSE_SCRIPT_TOPOLOGY_BLACKLETTER_CONNECTED = 10 306 } 307 308 /// <summary> 309 /// General look of the face, considering slope and tails. 310 /// Present for families: 3-script 311 /// </summary> 312 alias DWRITE_PANOSE_SCRIPT_FORM = int; 313 enum : DWRITE_PANOSE_SCRIPT_FORM 314 { 315 DWRITE_PANOSE_SCRIPT_FORM_ANY = 0, 316 DWRITE_PANOSE_SCRIPT_FORM_NO_FIT = 1, 317 DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_NO_WRAPPING = 2, 318 DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_SOME_WRAPPING = 3, 319 DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_MORE_WRAPPING = 4, 320 DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_EXTREME_WRAPPING = 5, 321 DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_NO_WRAPPING = 6, 322 DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_SOME_WRAPPING = 7, 323 DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_MORE_WRAPPING = 8, 324 DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_EXTREME_WRAPPING = 9, 325 DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_NO_WRAPPING = 10, 326 DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_SOME_WRAPPING = 11, 327 DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_MORE_WRAPPING = 12, 328 DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_EXTREME_WRAPPING = 13 329 } 330 331 /// <summary> 332 /// How character ends and miniscule ascenders are treated. 333 /// Present for families: 3-script 334 /// </summary> 335 alias DWRITE_PANOSE_FINIALS = int; 336 enum : DWRITE_PANOSE_FINIALS 337 { 338 DWRITE_PANOSE_FINIALS_ANY = 0, 339 DWRITE_PANOSE_FINIALS_NO_FIT = 1, 340 DWRITE_PANOSE_FINIALS_NONE_NO_LOOPS = 2, 341 DWRITE_PANOSE_FINIALS_NONE_CLOSED_LOOPS = 3, 342 DWRITE_PANOSE_FINIALS_NONE_OPEN_LOOPS = 4, 343 DWRITE_PANOSE_FINIALS_SHARP_NO_LOOPS = 5, 344 DWRITE_PANOSE_FINIALS_SHARP_CLOSED_LOOPS = 6, 345 DWRITE_PANOSE_FINIALS_SHARP_OPEN_LOOPS = 7, 346 DWRITE_PANOSE_FINIALS_TAPERED_NO_LOOPS = 8, 347 DWRITE_PANOSE_FINIALS_TAPERED_CLOSED_LOOPS = 9, 348 DWRITE_PANOSE_FINIALS_TAPERED_OPEN_LOOPS = 10, 349 DWRITE_PANOSE_FINIALS_ROUND_NO_LOOPS = 11, 350 DWRITE_PANOSE_FINIALS_ROUND_CLOSED_LOOPS = 12, 351 DWRITE_PANOSE_FINIALS_ROUND_OPEN_LOOPS = 13 352 } 353 354 /// <summary> 355 /// Relative size of the lowercase letters. 356 /// Present for families: 3-script 357 /// </summary> 358 alias DWRITE_PANOSE_XASCENT = int; 359 enum : DWRITE_PANOSE_XASCENT 360 { 361 DWRITE_PANOSE_XASCENT_ANY = 0, 362 DWRITE_PANOSE_XASCENT_NO_FIT = 1, 363 DWRITE_PANOSE_XASCENT_VERY_LOW = 2, 364 DWRITE_PANOSE_XASCENT_LOW = 3, 365 DWRITE_PANOSE_XASCENT_MEDIUM = 4, 366 DWRITE_PANOSE_XASCENT_HIGH = 5, 367 DWRITE_PANOSE_XASCENT_VERY_HIGH = 6 368 } 369 370 /// <summary> 371 /// General look of the face. 372 /// Present for families: 4-decorative 373 /// </summary> 374 alias DWRITE_PANOSE_DECORATIVE_CLASS = int; 375 enum : DWRITE_PANOSE_DECORATIVE_CLASS 376 { 377 DWRITE_PANOSE_DECORATIVE_CLASS_ANY = 0, 378 DWRITE_PANOSE_DECORATIVE_CLASS_NO_FIT = 1, 379 DWRITE_PANOSE_DECORATIVE_CLASS_DERIVATIVE = 2, 380 DWRITE_PANOSE_DECORATIVE_CLASS_NONSTANDARD_TOPOLOGY = 3, 381 DWRITE_PANOSE_DECORATIVE_CLASS_NONSTANDARD_ELEMENTS = 4, 382 DWRITE_PANOSE_DECORATIVE_CLASS_NONSTANDARD_ASPECT = 5, 383 DWRITE_PANOSE_DECORATIVE_CLASS_INITIALS = 6, 384 DWRITE_PANOSE_DECORATIVE_CLASS_CARTOON = 7, 385 DWRITE_PANOSE_DECORATIVE_CLASS_PICTURE_STEMS = 8, 386 DWRITE_PANOSE_DECORATIVE_CLASS_ORNAMENTED = 9, 387 DWRITE_PANOSE_DECORATIVE_CLASS_TEXT_AND_BACKGROUND = 10, 388 DWRITE_PANOSE_DECORATIVE_CLASS_COLLAGE = 11, 389 DWRITE_PANOSE_DECORATIVE_CLASS_MONTAGE = 12 390 } 391 392 /// <summary> 393 /// Ratio between the width and height of the face. 394 /// Present for families: 4-decorative 395 /// </summary> 396 alias DWRITE_PANOSE_ASPECT = int; 397 enum : DWRITE_PANOSE_ASPECT 398 { 399 DWRITE_PANOSE_ASPECT_ANY = 0, 400 DWRITE_PANOSE_ASPECT_NO_FIT = 1, 401 DWRITE_PANOSE_ASPECT_SUPER_CONDENSED = 2, 402 DWRITE_PANOSE_ASPECT_VERY_CONDENSED = 3, 403 DWRITE_PANOSE_ASPECT_CONDENSED = 4, 404 DWRITE_PANOSE_ASPECT_NORMAL = 5, 405 DWRITE_PANOSE_ASPECT_EXTENDED = 6, 406 DWRITE_PANOSE_ASPECT_VERY_EXTENDED = 7, 407 DWRITE_PANOSE_ASPECT_SUPER_EXTENDED = 8, 408 DWRITE_PANOSE_ASPECT_MONOSPACED = 9 409 } 410 411 /// <summary> 412 /// Type of fill/line (treatment). 413 /// Present for families: 4-decorative 414 /// </summary> 415 alias DWRITE_PANOSE_FILL = int; 416 enum : DWRITE_PANOSE_FILL 417 { 418 DWRITE_PANOSE_FILL_ANY = 0, 419 DWRITE_PANOSE_FILL_NO_FIT = 1, 420 DWRITE_PANOSE_FILL_STANDARD_SOLID_FILL = 2, 421 DWRITE_PANOSE_FILL_NO_FILL = 3, 422 DWRITE_PANOSE_FILL_PATTERNED_FILL = 4, 423 DWRITE_PANOSE_FILL_COMPLEX_FILL = 5, 424 DWRITE_PANOSE_FILL_SHAPED_FILL = 6, 425 DWRITE_PANOSE_FILL_DRAWN_DISTRESSED = 7, 426 } 427 428 /// <summary> 429 /// Outline handling. 430 /// Present for families: 4-decorative 431 /// </summary> 432 alias DWRITE_PANOSE_LINING = int; 433 enum : DWRITE_PANOSE_LINING 434 { 435 DWRITE_PANOSE_LINING_ANY = 0, 436 DWRITE_PANOSE_LINING_NO_FIT = 1, 437 DWRITE_PANOSE_LINING_NONE = 2, 438 DWRITE_PANOSE_LINING_INLINE = 3, 439 DWRITE_PANOSE_LINING_OUTLINE = 4, 440 DWRITE_PANOSE_LINING_ENGRAVED = 5, 441 DWRITE_PANOSE_LINING_SHADOW = 6, 442 DWRITE_PANOSE_LINING_RELIEF = 7, 443 DWRITE_PANOSE_LINING_BACKDROP = 8 444 } 445 446 /// <summary> 447 /// Overall shape characteristics of the font. 448 /// Present for families: 4-decorative 449 /// </summary> 450 alias DWRITE_PANOSE_DECORATIVE_TOPOLOGY = int; 451 enum : DWRITE_PANOSE_DECORATIVE_TOPOLOGY 452 { 453 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_ANY = 0, 454 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_NO_FIT = 1, 455 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_STANDARD = 2, 456 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_SQUARE = 3, 457 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_MULTIPLE_SEGMENT = 4, 458 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_ART_DECO = 5, 459 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_UNEVEN_WEIGHTING = 6, 460 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_DIVERSE_ARMS = 7, 461 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_DIVERSE_FORMS = 8, 462 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_LOMBARDIC_FORMS = 9, 463 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_UPPER_CASE_IN_LOWER_CASE = 10, 464 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_IMPLIED_TOPOLOGY = 11, 465 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_HORSESHOE_E_AND_A = 12, 466 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_CURSIVE = 13, 467 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_BLACKLETTER = 14, 468 DWRITE_PANOSE_DECORATIVE_TOPOLOGY_SWASH_VARIANCE = 15 469 } 470 471 /// <summary> 472 /// Type of characters available in the font. 473 /// Present for families: 4-decorative 474 /// </summary> 475 alias DWRITE_PANOSE_CHARACTER_RANGES = int; 476 enum : DWRITE_PANOSE_CHARACTER_RANGES 477 { 478 DWRITE_PANOSE_CHARACTER_RANGES_ANY = 0, 479 DWRITE_PANOSE_CHARACTER_RANGES_NO_FIT = 1, 480 DWRITE_PANOSE_CHARACTER_RANGES_EXTENDED_COLLECTION = 2, 481 DWRITE_PANOSE_CHARACTER_RANGES_LITERALS = 3, 482 DWRITE_PANOSE_CHARACTER_RANGES_NO_LOWER_CASE = 4, 483 DWRITE_PANOSE_CHARACTER_RANGES_SMALL_CAPS = 5 484 } 485 486 /// <summary> 487 /// Kind of symbol set. 488 /// Present for families: 5-symbol 489 /// </summary> 490 alias DWRITE_PANOSE_SYMBOL_KIND = int; 491 enum : DWRITE_PANOSE_SYMBOL_KIND 492 { 493 DWRITE_PANOSE_SYMBOL_KIND_ANY = 0, 494 DWRITE_PANOSE_SYMBOL_KIND_NO_FIT = 1, 495 DWRITE_PANOSE_SYMBOL_KIND_MONTAGES = 2, 496 DWRITE_PANOSE_SYMBOL_KIND_PICTURES = 3, 497 DWRITE_PANOSE_SYMBOL_KIND_SHAPES = 4, 498 DWRITE_PANOSE_SYMBOL_KIND_SCIENTIFIC = 5, 499 DWRITE_PANOSE_SYMBOL_KIND_MUSIC = 6, 500 DWRITE_PANOSE_SYMBOL_KIND_EXPERT = 7, 501 DWRITE_PANOSE_SYMBOL_KIND_PATTERNS = 8, 502 DWRITE_PANOSE_SYMBOL_KIND_BOARDERS = 9, 503 DWRITE_PANOSE_SYMBOL_KIND_ICONS = 10, 504 DWRITE_PANOSE_SYMBOL_KIND_LOGOS = 11, 505 DWRITE_PANOSE_SYMBOL_KIND_INDUSTRY_SPECIFIC = 12 506 } 507 508 /// <summary> 509 /// Aspect ratio of symbolic characters. 510 /// Present for families: 5-symbol 511 /// </summary> 512 alias DWRITE_PANOSE_SYMBOL_ASPECT_RATIO = int; 513 enum : DWRITE_PANOSE_SYMBOL_ASPECT_RATIO 514 { 515 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_ANY = 0, 516 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NO_FIT = 1, 517 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NO_WIDTH = 2, 518 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_EXCEPTIONALLY_WIDE = 3, 519 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_SUPER_WIDE = 4, 520 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_VERY_WIDE = 5, 521 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_WIDE = 6, 522 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NORMAL = 7, 523 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NARROW = 8, 524 DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_VERY_NARROW = 9 525 } 526 527 /// <summary> 528 /// Specifies the policy used by GetRecommendedRenderingMode to determine whether to 529 /// render glyphs in outline mode. Glyphs are rendered in outline mode by default at 530 /// large sizes for performance reasons, but how large (i.e., the outline threshold) 531 /// depends on the quality of outline rendering. If the graphics system renders anti- 532 /// aliased outlines then a relatively low threshold is used, but if the graphics 533 /// system renders aliased outlines then a much higher threshold is used. 534 /// </summary> 535 alias DWRITE_OUTLINE_THRESHOLD = int; 536 enum : DWRITE_OUTLINE_THRESHOLD 537 { 538 DWRITE_OUTLINE_THRESHOLD_ANTIALIASED, 539 DWRITE_OUTLINE_THRESHOLD_ALIASED 540 } 541 542 /// <summary> 543 /// Baseline for text alignment. 544 /// </summary> 545 alias DWRITE_BASELINE = int; 546 enum : DWRITE_BASELINE 547 { 548 /// <summary> 549 /// The Roman baseline for horizontal, Central baseline for vertical. 550 /// </summary> 551 DWRITE_BASELINE_DEFAULT, 552 553 /// <summary> 554 /// The baseline used by alphabetic scripts such as Latin, Greek, Cyrillic. 555 /// </summary> 556 DWRITE_BASELINE_ROMAN, 557 558 /// <summary> 559 /// Central baseline, generally used for vertical text. 560 /// </summary> 561 DWRITE_BASELINE_CENTRAL, 562 563 /// <summary> 564 /// Mathematical baseline which math characters are centered on. 565 /// </summary> 566 DWRITE_BASELINE_MATH, 567 568 /// <summary> 569 /// Hanging baseline, used in scripts like Devanagari. 570 /// </summary> 571 DWRITE_BASELINE_HANGING, 572 573 /// <summary> 574 /// Ideographic bottom baseline for CJK, left in vertical. 575 /// </summary> 576 DWRITE_BASELINE_IDEOGRAPHIC_BOTTOM, 577 578 /// <summary> 579 /// Ideographic top baseline for CJK, right in vertical. 580 /// </summary> 581 DWRITE_BASELINE_IDEOGRAPHIC_TOP, 582 583 /// <summary> 584 /// The bottom-most extent in horizontal, left-most in vertical. 585 /// </summary> 586 DWRITE_BASELINE_MINIMUM, 587 588 /// <summary> 589 /// The top-most extent in horizontal, right-most in vertical. 590 /// </summary> 591 DWRITE_BASELINE_MAXIMUM, 592 } 593 594 /// <summary> 595 /// The desired kind of glyph orientation for the text. The client specifies 596 /// this to the analyzer as the desired orientation, but note this is the 597 /// client preference, and the constraints of the script will determine the 598 /// final presentation. 599 /// </summary> 600 alias DWRITE_VERTICAL_GLYPH_ORIENTATION = int; 601 enum : DWRITE_VERTICAL_GLYPH_ORIENTATION 602 { 603 /// <summary> 604 /// In vertical layout, naturally horizontal scripts (Latin, Thai, Arabic, 605 /// Devanagari) rotate 90 degrees clockwise, while ideographic scripts 606 /// (Chinese, Japanese, Korean) remain upright, 0 degrees. 607 /// </summary> 608 DWRITE_VERTICAL_GLYPH_ORIENTATION_DEFAULT, 609 610 /// <summary> 611 /// Ideographic scripts and scripts that permit stacking 612 /// (Latin, Hebrew) are stacked in vertical reading layout. 613 /// Connected scripts (Arabic, Syriac, 'Phags-pa, Ogham), 614 /// which would otherwise look broken if glyphs were kept 615 /// at 0 degrees, remain connected and rotate. 616 /// </summary> 617 DWRITE_VERTICAL_GLYPH_ORIENTATION_STACKED, 618 } 619 620 /// <summary> 621 /// How the glyph is oriented to the x-axis. This is an output from the text 622 /// analyzer, dependent on the desired orientation, bidi level, and character 623 /// properties. 624 /// </summary> 625 alias DWRITE_GLYPH_ORIENTATION_ANGLE = int; 626 enum : DWRITE_GLYPH_ORIENTATION_ANGLE 627 { 628 /// <summary> 629 /// Glyph orientation is upright. 630 /// </summary> 631 DWRITE_GLYPH_ORIENTATION_ANGLE_0_DEGREES, 632 633 /// <summary> 634 /// Glyph orientation is rotated 90 clockwise. 635 /// </summary> 636 DWRITE_GLYPH_ORIENTATION_ANGLE_90_DEGREES, 637 638 /// <summary> 639 /// Glyph orientation is upside-down. 640 /// </summary> 641 DWRITE_GLYPH_ORIENTATION_ANGLE_180_DEGREES, 642 643 /// <summary> 644 /// Glyph orientation is rotated 270 clockwise. 645 /// </summary> 646 DWRITE_GLYPH_ORIENTATION_ANGLE_270_DEGREES, 647 } 648 649 650 struct DWRITE_FONT_METRICS1 // : DWRITE_FONT_METRICS 651 { 652 alias dfm this; 653 DWRITE_FONT_METRICS dfm; 654 655 /// <summary> 656 /// Left edge of accumulated bounding blackbox of all glyphs in the font. 657 /// </summary> 658 INT16 glyphBoxLeft; 659 660 /// <summary> 661 /// Top edge of accumulated bounding blackbox of all glyphs in the font. 662 /// </summary> 663 INT16 glyphBoxTop; 664 665 /// <summary> 666 /// Right edge of accumulated bounding blackbox of all glyphs in the font. 667 /// </summary> 668 INT16 glyphBoxRight; 669 670 /// <summary> 671 /// Bottom edge of accumulated bounding blackbox of all glyphs in the font. 672 /// </summary> 673 INT16 glyphBoxBottom; 674 675 /// <summary> 676 /// Horizontal position of the subscript relative to the baseline origin. 677 /// This is typically negative (to the left) in italic/oblique fonts, and 678 /// zero in regular fonts. 679 /// </summary> 680 INT16 subscriptPositionX; 681 682 /// <summary> 683 /// Vertical position of the subscript relative to the baseline. 684 /// This is typically negative. 685 /// </summary> 686 INT16 subscriptPositionY; 687 688 /// <summary> 689 /// Horizontal size of the subscript em box in design units, used to 690 /// scale the simulated subscript relative to the full em box size. 691 /// This the numerator of the scaling ratio where denominator is the 692 /// design units per em. If this member is zero, the font does not specify 693 /// a scale factor, and the client should use its own policy. 694 /// </summary> 695 INT16 subscriptSizeX; 696 697 /// <summary> 698 /// Vertical size of the subscript em box in design units, used to 699 /// scale the simulated subscript relative to the full em box size. 700 /// This the numerator of the scaling ratio where denominator is the 701 /// design units per em. If this member is zero, the font does not specify 702 /// a scale factor, and the client should use its own policy. 703 /// </summary> 704 INT16 subscriptSizeY; 705 706 /// <summary> 707 /// Horizontal position of the superscript relative to the baseline origin. 708 /// This is typically positive (to the right) in italic/oblique fonts, and 709 /// zero in regular fonts. 710 /// </summary> 711 INT16 superscriptPositionX; 712 713 /// <summary> 714 /// Vertical position of the superscript relative to the baseline. 715 /// This is typically positive. 716 /// </summary> 717 INT16 superscriptPositionY; 718 719 /// <summary> 720 /// Horizontal size of the superscript em box in design units, used to 721 /// scale the simulated superscript relative to the full em box size. 722 /// This the numerator of the scaling ratio where denominator is the 723 /// design units per em. If this member is zero, the font does not specify 724 /// a scale factor, and the client should use its own policy. 725 /// </summary> 726 INT16 superscriptSizeX; 727 728 /// <summary> 729 /// Vertical size of the superscript em box in design units, used to 730 /// scale the simulated superscript relative to the full em box size. 731 /// This the numerator of the scaling ratio where denominator is the 732 /// design units per em. If this member is zero, the font does not specify 733 /// a scale factor, and the client should use its own policy. 734 /// </summary> 735 INT16 superscriptSizeY; 736 737 /// <summary> 738 /// Indicates that the ascent, descent, and lineGap are based on newer 739 /// 'typographic' values in the font, rather than legacy values. 740 /// </summary> 741 BOOL hasTypographicMetrics; 742 } 743 744 745 /// <summary> 746 /// Metrics for caret placement in a font. 747 /// </summary> 748 struct DWRITE_CARET_METRICS 749 { 750 /// <summary> 751 /// Vertical rise of the caret. Rise / Run yields the caret angle. 752 /// Rise = 1 for perfectly upright fonts (non-italic). 753 /// </summary> 754 INT16 slopeRise; 755 756 /// <summary> 757 /// Horizontal run of th caret. Rise / Run yields the caret angle. 758 /// Run = 0 for perfectly upright fonts (non-italic). 759 /// </summary> 760 INT16 slopeRun; 761 762 /// <summary> 763 /// Horizontal offset of the caret along the baseline for good appearance. 764 /// Offset = 0 for perfectly upright fonts (non-italic). 765 /// </summary> 766 INT16 offset; 767 } 768 769 770 /// <summary> 771 /// Typeface classification values, used for font selection and matching. 772 /// </summary> 773 /// <remarks> 774 /// Note the family type (index 0) is the only stable entry in the 10-byte 775 /// array, as all the following entries can change dynamically depending on 776 /// context of the first field. 777 /// </remarks> 778 union DWRITE_PANOSE 779 { 780 UINT8[10] values; 781 782 UINT8 familyKind; // this is the only field that never changes meaning 783 784 struct text_ 785 { 786 UINT8 familyKind; // = 2 for text 787 UINT8 serifStyle; 788 UINT8 weight; 789 UINT8 proportion; 790 UINT8 contrast; 791 UINT8 strokeVariation; 792 UINT8 armStyle; 793 UINT8 letterform; 794 UINT8 midline; 795 UINT8 xHeight; 796 } 797 text_ text; 798 799 struct script_ 800 { 801 UINT8 familyKind; // = 3 for script 802 UINT8 toolKind; 803 UINT8 weight; 804 UINT8 spacing; 805 UINT8 aspectRatio; 806 UINT8 contrast; 807 UINT8 scriptTopology; 808 UINT8 scriptForm; 809 UINT8 finials; 810 UINT8 xAscent; 811 } 812 script_ script; 813 814 struct decorative_ 815 { 816 UINT8 familyKind; // = 4 for decorative 817 UINT8 decorativeClass; 818 UINT8 weight; 819 UINT8 aspect; 820 UINT8 contrast; 821 UINT8 serifVariant; 822 UINT8 fill; // treatment 823 UINT8 lining; 824 UINT8 decorativeTopology; 825 UINT8 characterRange; 826 } 827 decorative_ decorative; 828 829 struct symbol_ 830 { 831 UINT8 familyKind; // = 5 for symbol 832 UINT8 symbolKind; 833 UINT8 weight; 834 UINT8 spacing; 835 UINT8 aspectRatioAndContrast; // hard coded to no-fit (1) 836 UINT8 aspectRatio94; 837 UINT8 aspectRatio119; 838 UINT8 aspectRatio157; 839 UINT8 aspectRatio163; 840 UINT8 aspectRatio211; 841 } 842 symbol_ symbol; 843 } 844 845 846 /// <summary> 847 /// Range of Unicode codepoints. 848 /// </summary> 849 struct DWRITE_UNICODE_RANGE 850 { 851 /// <summary> 852 /// The first codepoint in the Unicode range. 853 /// </summary> 854 UINT32 first; 855 856 /// <summary> 857 /// The last codepoint in the Unicode range. 858 /// </summary> 859 UINT32 last; 860 } 861 862 863 /// <summary> 864 /// Script-specific properties for caret navigation and justification. 865 /// </summary> 866 struct DWRITE_SCRIPT_PROPERTIES 867 { 868 align(1): 869 /// <summary> 870 /// The standardized four character code for the given script. 871 /// Note these only include the general Unicode scripts, not any 872 /// additional ISO 15924 scripts for bibliographic distinction 873 /// (for example, Fraktur Latin vs Gaelic Latin). 874 /// http://unicode.org/iso15924/iso15924-codes.html 875 /// </summary> 876 UINT32 isoScriptCode; 877 878 /// <summary> 879 /// The standardized numeric code, ranging 0-999. 880 /// http://unicode.org/iso15924/iso15924-codes.html 881 /// </summary> 882 UINT32 isoScriptNumber; 883 884 /// <summary> 885 /// Number of characters to estimate look-ahead for complex scripts. 886 /// Latin and all Kana are generally 1. Indic scripts are up to 15, 887 /// and most others are 8. Note that combining marks and variation 888 /// selectors can produce clusters longer than these look-aheads, 889 /// so this estimate is considered typical language use. Diacritics 890 /// must be tested explicitly separately. 891 /// </summary> 892 UINT32 clusterLookahead; 893 894 /// <summary> 895 /// Appropriate character to elongate the given script for justification. 896 /// 897 /// Examples: 898 /// Arabic - U+0640 Tatweel 899 /// Ogham - U+1680 Ogham Space Mark 900 /// </summary> 901 UINT32 justificationCharacter; 902 903 UINT32 data_; 904 //TODO: add helper properties for data members below 905 906 /* 907 /// <summary> 908 /// Restrict the caret to whole clusters, like Thai and Devanagari. Scripts 909 /// such as Arabic by default allow navigation between clusters. Others 910 /// like Thai always navigate across whole clusters. 911 /// </summary> 912 UINT32 restrictCaretToClusters : 1; 913 914 /// <summary> 915 /// The language uses dividers between words, such as spaces between Latin 916 /// or the Ethiopic wordspace. 917 /// 918 /// Examples: Latin, Greek, Devanagari, Ethiopic 919 /// Excludes: Chinese, Korean, Thai. 920 /// </summary> 921 UINT32 usesWordDividers : 1; 922 923 /// <summary> 924 /// The characters are discrete units from each other. This includes both 925 /// block scripts and clustered scripts. 926 /// 927 /// Examples: Latin, Greek, Cyrillic, Hebrew, Chinese, Thai 928 /// </summary> 929 UINT32 isDiscreteWriting : 1; 930 931 /// <summary> 932 /// The language is a block script, expanding between characters. 933 /// 934 /// Examples: Chinese, Japanese, Korean, Bopomofo. 935 /// </summary> 936 UINT32 isBlockWriting : 1; 937 938 /// <summary> 939 /// The language is justified within glyph clusters, not just between glyph 940 /// clusters. One such as the character sequence is Thai Lu and Sara Am 941 /// (U+E026, U+E033) which form a single cluster but still expand between 942 /// them. 943 /// 944 /// Examples: Thai, Lao, Khmer 945 /// </summary> 946 UINT32 isDistributedWithinCluster : 1; 947 948 /// <summary> 949 /// The script's clusters are connected to each other (such as the 950 /// baseline-linked Devanagari), and no separation should be added 951 /// between characters. Note that cursively linked scripts like Arabic 952 /// are also connected (but not all connected scripts are 953 /// cursive). 954 /// 955 /// Examples: Devanagari, Arabic, Syriac, Bengali, Gurmukhi, Ogham 956 /// Excludes: Latin, Chinese, Thaana 957 /// </summary> 958 UINT32 isConnectedWriting : 1; 959 960 /// <summary> 961 /// The script is naturally cursive (Arabic/Syriac), meaning it uses other 962 /// justification methods like kashida extension rather than intercharacter 963 /// spacing. Note that although other scripts like Latin and Japanese may 964 /// actually support handwritten cursive forms, they are not considered 965 /// cursive scripts. 966 /// 967 /// Examples: Arabic, Syriac, Mongolian 968 /// Excludes: Thaana, Devanagari, Latin, Chinese 969 /// </summary> 970 UINT32 isCursiveWriting : 1; 971 972 UINT32 reserved : 25; 973 */ 974 } 975 976 977 /// <summary> 978 /// Justification information per glyph. 979 /// </summary> 980 struct DWRITE_JUSTIFICATION_OPPORTUNITY 981 { 982 align(1): 983 /// <summary> 984 /// Minimum amount of expansion to apply to the side of the glyph. 985 /// This may vary from 0 to infinity, typically being zero except 986 /// for kashida. 987 /// </summary> 988 FLOAT expansionMinimum; 989 990 /// <summary> 991 /// Maximum amount of expansion to apply to the side of the glyph. 992 /// This may vary from 0 to infinity, being zero for fixed-size characters 993 /// and connected scripts, and non-zero for discrete scripts, and non-zero 994 /// for cursive scripts at expansion points. 995 /// </summary> 996 FLOAT expansionMaximum; 997 998 /// <summary> 999 /// Maximum amount of compression to apply to the side of the glyph. 1000 /// This may vary from 0 up to the glyph cluster size. 1001 /// </summary> 1002 FLOAT compressionMaximum; 1003 1004 UINT32 data_; 1005 //TODO: add helper properties for data members below 1006 /* 1007 /// <summary> 1008 /// Priority of this expansion point. Larger priorities are applied later, 1009 /// while priority zero does nothing. 1010 /// </summary> 1011 UINT32 expansionPriority : 8; 1012 1013 /// <summary> 1014 /// Priority of this compression point. Larger priorities are applied later, 1015 /// while priority zero does nothing. 1016 /// </summary> 1017 UINT32 compressionPriority : 8; 1018 1019 /// <summary> 1020 /// Allow this expansion point to use up any remaining slack space even 1021 /// after all expansion priorities have been used up. 1022 /// </summary> 1023 UINT32 allowResidualExpansion : 1; 1024 1025 /// <summary> 1026 /// Allow this compression point to use up any remaining space even after 1027 /// all compression priorities have been used up. 1028 /// </summary> 1029 UINT32 allowResidualCompression : 1; 1030 1031 /// <summary> 1032 /// Apply expansion/compression to the leading edge of the glyph. This will 1033 /// be false for connected scripts, fixed-size characters, and diacritics. 1034 /// It is generally false within a multi-glyph cluster, unless the script 1035 /// allows expansion of glyphs within a cluster, like Thai. 1036 /// </summary> 1037 UINT32 applyToLeadingEdge : 1; 1038 1039 /// <summary> 1040 /// Apply expansion/compression to the trailing edge of the glyph. This will 1041 /// be false for connected scripts, fixed-size characters, and diacritics. 1042 /// It is generally false within a multi-glyph cluster, unless the script 1043 /// allows expansion of glyphs within a cluster, like Thai. 1044 /// </summary> 1045 UINT32 applyToTrailingEdge : 1; 1046 1047 UINT32 reserved : 12; 1048 */ 1049 } 1050 1051 1052 1053 1054 /// <summary> 1055 /// The root factory interface for all DWrite objects. 1056 /// </summary> 1057 mixin( uuid!(IDWriteFactory1, "30572f99-dac6-41db-a16e-0486307e606a") ); 1058 interface IDWriteFactory1 : IDWriteFactory 1059 { 1060 extern(Windows): 1061 /// <summary> 1062 /// Gets a font collection representing the set of end-user defined 1063 /// custom fonts. 1064 /// </summary> 1065 /// <param name="fontCollection">Receives a pointer to the EUDC font 1066 /// collection object, or NULL in case of failure.</param> 1067 /// <param name="checkForUpdates">If this parameter is nonzero, the 1068 /// function performs an immediate check for changes to the set of 1069 /// EUDC fonts. If this parameter is FALSE, the function will still 1070 /// detect changes, but there may be some latency. For example, an 1071 /// application might specify TRUE if it has itself just modified a 1072 /// font and wants to be sure the font collection contains that font. 1073 /// </param> 1074 /// <returns> 1075 /// Standard HRESULT error code. Note that if no EUDC is set on the system, 1076 /// the returned collection will be empty, meaning it will return success 1077 /// but GetFontFamilyCount will be zero. 1078 /// </returns> 1079 /// <remarks> 1080 /// Querying via IDWriteFontCollection::FindFamilyName for a specific 1081 /// family (like MS Gothic) will return the matching family-specific EUDC 1082 /// font if one exists. Querying for "" will return the global EUDC font. 1083 /// For example, if you were matching an EUDC character within a run of 1084 /// the base font PMingLiu, you would retrieve the corresponding EUDC font 1085 /// face using GetEudcFontCollection, then FindFamilyName with "PMingLiu", 1086 /// followed by GetFontFamily and CreateFontFace. 1087 /// 1088 /// Be aware that eudcedit.exe can create placeholder empty glyphs that 1089 /// have zero advance width and no glyph outline. Although they are present 1090 /// in the font (HasCharacter returns true), you are best to ignore 1091 /// these and continue on with font fallback in your layout if the metrics 1092 /// for the glyph are zero. 1093 /// </remarks> 1094 HRESULT GetEudcFontCollection( 1095 /*out*/ IDWriteFontCollection* fontCollection, 1096 BOOL checkForUpdates = FALSE 1097 ); 1098 1099 /// <summary> 1100 /// Creates a rendering parameters object with the specified properties. 1101 /// </summary> 1102 /// <param name="gamma">The gamma value used for gamma correction, which must be greater than zero and cannot exceed 256.</param> 1103 /// <param name="enhancedContrast">The amount of contrast enhancement, zero or greater.</param> 1104 /// <param name="enhancedContrastGrayscale">The amount of contrast enhancement to use for grayscale antialiasing, zero or greater.</param> 1105 /// <param name="clearTypeLevel">The degree of ClearType level, from 0.0f (no ClearType) to 1.0f (full ClearType).</param> 1106 /// <param name="pixelGeometry">The geometry of a device pixel.</param> 1107 /// <param name="renderingMode">Method of rendering glyphs. In most cases, this should be DWRITE_RENDERING_MODE_DEFAULT to automatically use an appropriate mode.</param> 1108 /// <param name="renderingParams">Holds the newly created rendering parameters object, or NULL in case of failure.</param> 1109 /// <returns> 1110 /// Standard HRESULT error code. 1111 /// </returns> 1112 HRESULT CreateCustomRenderingParams( 1113 FLOAT gamma, 1114 FLOAT enhancedContrast, 1115 FLOAT enhancedContrastGrayscale, 1116 FLOAT clearTypeLevel, 1117 DWRITE_PIXEL_GEOMETRY pixelGeometry, 1118 DWRITE_RENDERING_MODE renderingMode, 1119 /*out*/ IDWriteRenderingParams1* renderingParams 1120 ); 1121 1122 //using IDWriteFactory::CreateCustomRenderingParams; 1123 } 1124 1125 1126 /// <summary> 1127 /// The interface that represents an absolute reference to a font face. 1128 /// It contains font face type, appropriate file references and face identification data. 1129 /// Various font data such as metrics, names and glyph outlines is obtained from IDWriteFontFace. 1130 /// </summary> 1131 mixin( uuid!(IDWriteFontFace1, "a71efdb4-9fdb-4838-ad90-cfc3be8c3daf") ); 1132 interface IDWriteFontFace1 : IDWriteFontFace 1133 { 1134 extern(Windows): 1135 /// <summary> 1136 /// Gets common metrics for the font in design units. 1137 /// These metrics are applicable to all the glyphs within a font, 1138 /// and are used by applications for layout calculations. 1139 /// </summary> 1140 /// <param name="fontMetrics">Metrics structure to fill in.</param> 1141 void GetMetrics( 1142 /*out*/ DWRITE_FONT_METRICS1* fontMetrics 1143 ); 1144 1145 /// <summary> 1146 /// Gets common metrics for the font in design units. 1147 /// These metrics are applicable to all the glyphs within a font, 1148 /// and are used by applications for layout calculations. 1149 /// </summary> 1150 /// <param name="emSize">Logical size of the font in DIP units. A DIP 1151 /// ("device-independent pixel") equals 1/96 inch.</param> 1152 /// <param name="pixelsPerDip">Number of physical pixels per DIP. For 1153 /// example, if the DPI of the rendering surface is 96 this value is 1154 /// 1.0f. If the DPI is 120, this value is 120.0f/96.</param> 1155 /// <param name="transform">Optional transform applied to the glyphs and 1156 /// their positions. This transform is applied after the scaling 1157 /// specified by the font size and pixelsPerDip.</param> 1158 /// <param name="fontMetrics">Font metrics structure to fill in.</param> 1159 /// <returns> 1160 /// Standard HRESULT error code. 1161 /// </returns> 1162 HRESULT GetGdiCompatibleMetrics( 1163 FLOAT emSize, 1164 FLOAT pixelsPerDip, 1165 const(DWRITE_MATRIX)* transform, 1166 /*out*/ DWRITE_FONT_METRICS1* fontMetrics 1167 ); 1168 1169 /// <summary> 1170 /// Gets caret metrics for the font in design units. These are used by 1171 /// text editors for drawing the correct caret placement/slant. 1172 /// </summary> 1173 /// <param name="caretMetrics">Metrics structure to fill in.</param> 1174 void GetCaretMetrics( 1175 /*out*/ DWRITE_CARET_METRICS* caretMetrics 1176 ); 1177 1178 /// <summary> 1179 /// Returns the list of character ranges supported by the font, which is 1180 /// useful for scenarios like character picking, glyph display, and 1181 /// efficient font selection lookup. This is similar to GDI's 1182 /// GetFontUnicodeRanges, except that it returns the full Unicode range, 1183 /// not just 16-bit UCS-2. 1184 /// </summary> 1185 /// <param name="maxRangeCount">Maximum number of character ranges passed 1186 /// in from the client.</param> 1187 /// <param name="unicodeRanges">Array of character ranges.</param> 1188 /// <param name="actualRangeCount">Actual number of character ranges, 1189 /// regardless of the maximum count.</param> 1190 /// <remarks> 1191 /// These ranges are from the cmap, not the OS/2::ulCodePageRange1. 1192 /// </remarks> 1193 /// <returns> 1194 /// Standard HRESULT error code. 1195 /// </returns> 1196 HRESULT GetUnicodeRanges( 1197 UINT32 maxRangeCount, 1198 /*out*/ DWRITE_UNICODE_RANGE* unicodeRanges, 1199 /*out*/ UINT32* actualRangeCount 1200 ); 1201 1202 /// <summary> 1203 /// Returns true if the font is monospaced, meaning its characters are the 1204 /// same fixed-pitch width (non-proportional). 1205 /// </summary> 1206 BOOL IsMonospacedFont(); 1207 1208 /// <summary> 1209 /// Returns the advances in design units for a sequences of glyphs. 1210 /// </summary> 1211 /// <param name="glyphCount">Number of glyphs to retrieve advances for.</param> 1212 /// <param name="glyphIndices">Array of glyph id's to retrieve advances for.</param> 1213 /// <param name="glyphAdvances">Returned advances in font design units for 1214 /// each glyph.</param> 1215 /// <param name="isSideways">Retrieve the glyph's vertical advance height 1216 /// rather than horizontal advance widths.</param> 1217 /// <remarks> 1218 /// This is equivalent to calling GetGlyphMetrics and using only the 1219 /// advance width/height. 1220 /// </remarks> 1221 /// <returns> 1222 /// Standard HRESULT error code. 1223 /// </returns> 1224 HRESULT GetDesignGlyphAdvances( 1225 UINT32 glyphCount, 1226 const(UINT16)* glyphIndices, 1227 /*out*/ INT32* glyphAdvances, 1228 BOOL isSideways = FALSE 1229 ); 1230 1231 /// <summary> 1232 /// Returns the pixel-aligned advances for a sequences of glyphs, the same 1233 /// as GetGdiCompatibleGlyphMetrics would return. 1234 /// </summary> 1235 /// <param name="emSize">Logical size of the font in DIP units. A DIP 1236 /// ("device-independent pixel") equals 1/96 inch.</param> 1237 /// <param name="pixelsPerDip">Number of physical pixels per DIP. For 1238 /// example, if the DPI of the rendering surface is 96 this value is 1239 /// 1.0f. If the DPI is 120, this value is 120.0f/96.</param> 1240 /// <param name="transform">Optional transform applied to the glyphs and 1241 /// their positions. This transform is applied after the scaling 1242 /// specified by the font size and pixelsPerDip.</param> 1243 /// <param name="useGdiNatural">When FALSE, the metrics are the same as 1244 /// GDI aliased text (DWRITE_MEASURING_MODE_GDI_CLASSIC). When TRUE, 1245 /// the metrics are the same as those measured by GDI using a font 1246 /// using CLEARTYPE_NATURAL_QUALITY (DWRITE_MEASURING_MODE_GDI_NATURAL).</param> 1247 /// <param name="isSideways">Retrieve the glyph's vertical advances rather 1248 /// than horizontal advances.</param> 1249 /// <param name="glyphCount">Total glyphs to retrieve adjustments for.</param> 1250 /// <param name="glyphIndices">Array of glyph id's to retrieve advances.</param> 1251 /// <param name="glyphAdvances">Returned advances in font design units for 1252 /// each glyph.</param> 1253 /// <remarks> 1254 /// This is equivalent to calling GetGdiCompatibleGlyphMetrics and using only 1255 /// the advance width/height. Like GetGdiCompatibleGlyphMetrics, these are in 1256 /// design units, meaning they must be scaled down by 1257 /// DWRITE_FONT_METRICS::designUnitsPerEm. 1258 /// </remarks> 1259 /// <returns> 1260 /// Standard HRESULT error code. 1261 /// </returns> 1262 HRESULT GetGdiCompatibleGlyphAdvances( 1263 FLOAT emSize, 1264 FLOAT pixelsPerDip, 1265 const(DWRITE_MATRIX)* transform, 1266 BOOL useGdiNatural, 1267 BOOL isSideways, 1268 UINT32 glyphCount, 1269 const(UINT16)* glyphIndices, 1270 /*out*/ INT32* glyphAdvances 1271 ); 1272 1273 /// <summary> 1274 /// Retrieves the kerning pair adjustments from the font's kern table. 1275 /// </summary> 1276 /// <param name="glyphCount">Number of glyphs to retrieve adjustments for.</param> 1277 /// <param name="glyphIndices">Array of glyph id's to retrieve adjustments 1278 /// for.</param> 1279 /// <param name="glyphAdvanceAdjustments">Returned advances in font design units for 1280 /// each glyph. The last glyph adjustment is zero.</param> 1281 /// <remarks> 1282 /// This is not a direct replacement for GDI's character based 1283 /// GetKerningPairs, but it serves the same role, without the client 1284 /// needing to cache them locally. It also uses glyph id's directly 1285 /// rather than UCS-2 characters (how the kern table actually stores 1286 /// them) which avoids glyph collapse and ambiguity, such as the dash 1287 /// and hyphen, or space and non-breaking space. 1288 /// </remarks> 1289 /// <remarks> 1290 /// Newer fonts may have only GPOS kerning instead of the legacy pair 1291 /// table kerning. Such fonts, like Gabriola, will only return 0's for 1292 /// adjustments. This function does not virtualize and flatten these 1293 /// GPOS entries into kerning pairs. 1294 /// </remarks> 1295 /// <returns> 1296 /// Standard HRESULT error code. 1297 /// </returns> 1298 HRESULT GetKerningPairAdjustments( 1299 UINT32 glyphCount, 1300 const(UINT16)* glyphIndices, 1301 /*out*/ INT32* glyphAdvanceAdjustments 1302 ); 1303 1304 /// <summary> 1305 /// Returns whether or not the font supports pair-kerning. 1306 /// </summary> 1307 /// <remarks> 1308 /// If the font does not support pair table kerning, there is no need to 1309 /// call GetKerningPairAdjustments (it would be all zeroes). 1310 /// </remarks> 1311 /// <returns> 1312 /// Whether the font supports kerning pairs. 1313 /// </returns> 1314 BOOL HasKerningPairs(); 1315 1316 /// <summary> 1317 /// Determines the recommended text rendering mode to be used based on the 1318 /// font, size, world transform, and measuring mode. 1319 /// </summary> 1320 /// <param name="fontEmSize">Logical font size in DIPs.</param> 1321 /// <param name="dpiX">Number of pixels per logical inch in the horizontal direction.</param> 1322 /// <param name="dpiY">Number of pixels per logical inch in the vertical direction.</param> 1323 /// <param name="transform">Specifies the world transform.</param> 1324 /// <param name="outlineThreshold">Specifies the quality of the graphics system's outline rendering, 1325 /// affects the size threshold above which outline rendering is used.</param> 1326 /// <param name="measuringMode">Specifies the method used to measure during text layout. For proper 1327 /// glyph spacing, the function returns a rendering mode that is compatible with the specified 1328 /// measuring mode.</param> 1329 /// <param name="renderingMode">Receives the recommended rendering mode.</param> 1330 /// <remarks> 1331 /// This method should be used to determine the actual rendering mode in cases where the rendering 1332 /// mode of the rendering params object is DWRITE_RENDERING_MODE_DEFAULT. 1333 /// </remarks> 1334 /// <returns> 1335 /// Standard HRESULT error code. 1336 /// </returns> 1337 HRESULT GetRecommendedRenderingMode( 1338 FLOAT fontEmSize, 1339 FLOAT dpiX, 1340 FLOAT dpiY, 1341 const(DWRITE_MATRIX)* transform, 1342 BOOL isSideways, 1343 DWRITE_OUTLINE_THRESHOLD outlineThreshold, 1344 DWRITE_MEASURING_MODE measuringMode, 1345 /*out*/ DWRITE_RENDERING_MODE* renderingMode 1346 ); 1347 1348 /// <summary> 1349 /// Retrieves the vertical forms of the nominal glyphs retrieved from 1350 /// GetGlyphIndices, using the font's 'vert' table. This is used in 1351 /// CJK vertical layout so the correct characters are shown. 1352 /// </summary> 1353 /// <param name="glyphCount">Number of glyphs to retrieve.</param> 1354 /// <param name="nominalGlyphIndices">Original glyph indices from cmap.</param> 1355 /// <param name="verticalGlyphIndices">The vertical form of glyph indices.</param> 1356 /// <remarks> 1357 /// Call GetGlyphIndices to get the nominal glyph indices, followed by 1358 /// calling this to remap the to the substituted forms, when the run 1359 /// is sideways, and the font has vertical glyph variants. 1360 /// </remarks> 1361 /// <returns> 1362 /// Standard HRESULT error code. 1363 /// </returns> 1364 HRESULT GetVerticalGlyphVariants( 1365 UINT32 glyphCount, 1366 const(UINT16)* nominalGlyphIndices, 1367 /*out*/ UINT16* verticalGlyphIndices 1368 ); 1369 1370 /// <summary> 1371 /// Returns whether or not the font has any vertical glyph variants. 1372 /// </summary> 1373 /// <remarks> 1374 /// For OpenType fonts, this will return true if the font contains a 'vert' 1375 /// feature. 1376 /// </remarks> 1377 /// <returns> 1378 /// True if the font contains vertical glyph variants. 1379 /// </returns> 1380 BOOL HasVerticalGlyphVariants(); 1381 } 1382 1383 1384 /// <summary> 1385 /// The IDWriteFont interface represents a physical font in a font collection. 1386 /// </summary> 1387 mixin( uuid!(IDWriteFont1, "acd16696-8c14-4f5d-877e-fe3fc1d32738") ); 1388 interface IDWriteFont1 : IDWriteFont 1389 { 1390 extern(Windows): 1391 /// <summary> 1392 /// Gets common metrics for the font in design units. 1393 /// These metrics are applicable to all the glyphs within a font, 1394 /// and are used by applications for layout calculations. 1395 /// </summary> 1396 /// <param name="fontMetrics">Metrics structure to fill in.</param> 1397 void GetMetrics( 1398 /*out*/ DWRITE_FONT_METRICS1* fontMetrics 1399 ); 1400 1401 /// <summary> 1402 /// Gets the PANOSE values from the font, used for font selection and 1403 /// matching. 1404 /// </summary> 1405 /// <param name="panose">PANOSE structure to fill in.</param> 1406 /// <remarks> 1407 /// The function does not simulate these, such as substituting a weight or 1408 /// proportion inferred on other values. If the font does not specify them, 1409 /// they are all set to 'any' (0). 1410 /// </remarks> 1411 void GetPanose( 1412 /*out*/ DWRITE_PANOSE* panose 1413 ); 1414 1415 /// <summary> 1416 /// Returns the list of character ranges supported by the font, which is 1417 /// useful for scenarios like character picking, glyph display, and 1418 /// efficient font selection lookup. This is similar to GDI's 1419 /// GetFontUnicodeRanges, except that it returns the full Unicode range, 1420 /// not just 16-bit UCS-2. 1421 /// </summary> 1422 /// <param name="maxRangeCount">Maximum number of character ranges passed 1423 /// in from the client.</param> 1424 /// <param name="unicodeRanges">Array of character ranges.</param> 1425 /// <param name="actualRangeCount">Actual number of character ranges, 1426 /// regardless of the maximum count.</param> 1427 /// <remarks> 1428 /// These ranges are from the cmap, not the OS/2::ulCodePageRange1. 1429 /// </remarks> 1430 /// <returns> 1431 /// Standard HRESULT error code. 1432 /// </returns> 1433 HRESULT GetUnicodeRanges( 1434 UINT32 maxRangeCount, 1435 /*out*/ DWRITE_UNICODE_RANGE* unicodeRanges, 1436 /*out*/ UINT32* actualRangeCount 1437 ); 1438 1439 /// <summary> 1440 /// Returns true if the font is monospaced, meaning its characters are the 1441 /// same fixed-pitch width (non-proportional). 1442 /// </summary> 1443 BOOL IsMonospacedFont(); 1444 } 1445 1446 /// <summary> 1447 /// The interface that represents text rendering settings for glyph rasterization and filtering. 1448 /// </summary> 1449 mixin( uuid!(IDWriteRenderingParams1, "94413cf4-a6fc-4248-8b50-6674348fcad3") ); 1450 interface IDWriteRenderingParams1 : IDWriteRenderingParams 1451 { 1452 extern(Windows): 1453 /// <summary> 1454 /// Gets the amount of contrast enhancement to use for grayscale antialiasing. 1455 /// Valid values are greater than or equal to zero. 1456 /// </summary> 1457 FLOAT GetGrayscaleEnhancedContrast(); 1458 } 1459 1460 /// <summary> 1461 /// Analyzes various text properties for complex script processing. 1462 /// </summary> 1463 mixin( uuid!(IDWriteTextAnalyzer1, "80DAD800-E21F-4E83-96CE-BFCCE500DB7C") ); 1464 interface IDWriteTextAnalyzer1 : IDWriteTextAnalyzer 1465 { 1466 extern(Windows): 1467 /// <summary> 1468 /// Applies spacing between characters, properly adjusting glyph clusters 1469 /// and diacritics. 1470 /// </summary> 1471 /// <param name="leadingSpacing">The spacing before each character, in reading order.</param> 1472 /// <param name="trailingSpacing">The spacing after each character, in reading order.</param> 1473 /// <param name="minimumAdvanceWidth">The minimum advance of each character, 1474 /// to prevent characters from becoming too thin or zero-width. This 1475 /// must be zero or greater.</param> 1476 /// <param name="textLength">The length of the clustermap and original text.</param> 1477 /// <param name="glyphCount">The number of glyphs.</param> 1478 /// <param name="clusterMap">Mapping from character ranges to glyph ranges.</param> 1479 /// <param name="glyphAdvances">The advance width of each glyph.</param> 1480 /// <param name="glyphOffsets">The offset of the origin of each glyph.</param> 1481 /// <param name="glyphProperties">Properties of each glyph, from GetGlyphs.</param> 1482 /// <param name="modifiedGlyphAdvances">The new advance width of each glyph.</param> 1483 /// <param name="modifiedGlyphOffsets">The new offset of the origin of each glyph.</param> 1484 /// <remarks> 1485 /// The input and output advances/offsets are allowed to alias the same array. 1486 /// </remarks> 1487 /// <returns> 1488 /// Standard HRESULT error code. 1489 /// </returns> 1490 HRESULT ApplyCharacterSpacing( 1491 FLOAT leadingSpacing, 1492 FLOAT trailingSpacing, 1493 FLOAT minimumAdvanceWidth, 1494 UINT32 textLength, 1495 UINT32 glyphCount, 1496 const(UINT16)* clusterMap, 1497 const(FLOAT)* glyphAdvances, 1498 const(DWRITE_GLYPH_OFFSET)* glyphOffsets, 1499 const(DWRITE_SHAPING_GLYPH_PROPERTIES)* glyphProperties, 1500 /*out*/ FLOAT* modifiedGlyphAdvances, 1501 /*out*/ DWRITE_GLYPH_OFFSET* modifiedGlyphOffsets 1502 ); 1503 1504 /// <summary> 1505 /// Retrieves the given baseline from the font. 1506 /// </summary> 1507 /// <param name="fontFace">The font face to read.</param> 1508 /// <param name="baseline">The baseline of interest.</param> 1509 /// <param name="isVertical">Whether the baseline is vertical or horizontal.</param> 1510 /// <param name="isSimulationAllowed">Simulate the baseline if it is missing in the font.</param> 1511 /// <param name="scriptAnalysis">Script analysis result from AnalyzeScript.</param> 1512 /// <param name="localeName">The language of the run.</param> 1513 /// <param name="baselineCoordinate">The baseline coordinate value in design units.</param> 1514 /// <param name="exists">Whether the returned baseline exists in the font.</param> 1515 /// <remarks> 1516 /// If the baseline does not exist in the font, it is not considered an 1517 /// error, but the function will return exists = false. You may then use 1518 /// heuristics to calculate the missing base, or, if the flag 1519 /// simulationAllowed is true, the function will compute a reasonable 1520 /// approximation for you. 1521 /// </remarks> 1522 /// <returns> 1523 /// Standard HRESULT error code. 1524 /// </returns> 1525 HRESULT GetBaseline( 1526 IDWriteFontFace fontFace, 1527 DWRITE_BASELINE baseline, 1528 BOOL isVertical, 1529 BOOL isSimulationAllowed, 1530 DWRITE_SCRIPT_ANALYSIS scriptAnalysis, 1531 const(WCHAR)* localeName, 1532 /*out*/ INT32* baselineCoordinate, 1533 /*out*/ BOOL* exists 1534 ); 1535 1536 /// <summary> 1537 /// Analyzes a text range for script orientation, reading text and 1538 /// attributes from the source and reporting results to the sink. 1539 /// </summary> 1540 /// <param name="analysisSource">Source object to analyze.</param> 1541 /// <param name="textPosition">Starting position within the source object.</param> 1542 /// <param name="textLength">Length to analyze.</param> 1543 /// <param name="analysisSink">Callback object.</param> 1544 /// <returns> 1545 /// Standard HRESULT error code. 1546 /// </returns> 1547 /// <remarks> 1548 /// All bidi analysis should be resolved before calling this. 1549 /// </remarks> 1550 HRESULT AnalyzeVerticalGlyphOrientation( 1551 IDWriteTextAnalysisSource1 analysisSource, 1552 UINT32 textPosition, 1553 UINT32 textLength, 1554 IDWriteTextAnalysisSink1 analysisSink 1555 ); 1556 1557 /// <summary> 1558 /// Returns 2x3 transform matrix for the respective angle to draw the 1559 /// glyph run. 1560 /// </summary> 1561 /// <param name="glyphOrientationAngle">The angle reported into 1562 /// SetGlyphOrientation.</param> 1563 /// <param name="isSideways">Whether the run's glyphs are sideways or not.</param> 1564 /// <param name="transform">Returned transform.</param> 1565 /// </remarks> 1566 /// <returns> 1567 /// Standard HRESULT error code. 1568 /// </returns> 1569 /// <remarks> 1570 /// The returned displacement is zero. 1571 /// </remarks> 1572 HRESULT GetGlyphOrientationTransform( 1573 DWRITE_GLYPH_ORIENTATION_ANGLE glyphOrientationAngle, 1574 BOOL isSideways, 1575 /*out*/ DWRITE_MATRIX* transform 1576 ); 1577 1578 /// <summary> 1579 /// Returns the properties for a given script. 1580 /// </summary> 1581 /// <param name="scriptAnalysis">The script for a run of text returned 1582 /// from IDWriteTextAnalyzer::AnalyzeScript.</param> 1583 /// <param name="scriptProperties">Information for the script.</param> 1584 /// <returns> 1585 /// Returns properties for the given script. If the script is invalid, 1586 /// it returns generic properties for the unknown script and E_INVALIDARG. 1587 /// </returns> 1588 HRESULT GetScriptProperties( 1589 DWRITE_SCRIPT_ANALYSIS scriptAnalysis, 1590 /*out*/ DWRITE_SCRIPT_PROPERTIES* scriptProperties 1591 ); 1592 1593 /// <summary> 1594 /// Determines the complexity of text, and whether or not full script 1595 /// shaping needs to be called (GetGlyphs). 1596 /// </summary> 1597 /// <param name="fontFace">The font face to read.</param> 1598 /// <param name="textLength">Length of the text to check.</param> 1599 /// <param name="textString">The text to check for complexity. This string 1600 /// may be UTF-16, but any supplementary characters will be considered 1601 /// complex.</param> 1602 /// <param name="isTextSimple">If true, the text is simple, and the 1603 /// glyphIndices array will already have the nominal glyphs for you. 1604 /// Otherwise you need to call GetGlyphs to properly shape complex 1605 /// scripts and OpenType features. 1606 /// </param> 1607 /// <param name="textLengthRead">The length read of the text run with the 1608 /// same complexity, simple or complex. You may call again from that 1609 /// point onward.</param> 1610 /// <param name="glyphIndices">Optional glyph indices for the text. If the 1611 /// function returned that the text was simple, you already have the 1612 /// glyphs you need. Otherwise the glyph indices are not meaningful, 1613 /// and you should call shaping instead.</param> 1614 /// <remarks> 1615 /// Text is not simple if the characters are part of a script that has 1616 /// complex shaping requirements, require bidi analysis, combine with 1617 /// other characters, reside in the supplementary planes, or have glyphs 1618 /// which participate in standard OpenType features. The length returned 1619 /// will not split combining marks from their base characters. 1620 /// </remarks> 1621 /// <returns> 1622 /// Standard HRESULT error code. 1623 /// </returns> 1624 HRESULT GetTextComplexity( 1625 const(WCHAR)* textString, 1626 UINT32 textLength, 1627 IDWriteFontFace fontFace, 1628 /*out*/ BOOL* isTextSimple, 1629 /*out*/ UINT32* textLengthRead, 1630 /*out*/ UINT16* glyphIndices 1631 ); 1632 1633 /// <summary> 1634 /// Retrieves justification opportunity information for each of the glyphs 1635 /// given the text and shaping glyph properties. 1636 /// </summary> 1637 /// <param name="fontFace">Font face that was used for shaping. This is 1638 /// mainly important for returning correct results of the kashida 1639 /// width.</param> 1640 /// <param name="fontEmSize">Font em size used for the glyph run.</param> 1641 /// <param name="scriptAnalysis">Script of the text from the itemizer.</param> 1642 /// <param name="textLength">Length of the text.</param> 1643 /// <param name="glyphCount">Number of glyphs.</param> 1644 /// <param name="textString">Characters used to produce the glyphs.</param> 1645 /// <param name="clusterMap">Clustermap produced from shaping.</param> 1646 /// <param name="glyphProperties">Glyph properties produced from shaping.</param> 1647 /// <param name="justificationOpportunities">Receives information for the 1648 /// allowed justification expansion/compression for each glyph.</param> 1649 /// <remarks> 1650 /// This function is called per-run, after shaping is done via GetGlyphs(). 1651 /// Note this function only supports natural metrics (DWRITE_MEASURING_MODE_NATURAL). 1652 /// </remarks> 1653 /// <returns> 1654 /// Standard HRESULT error code. 1655 /// </returns> 1656 HRESULT GetJustificationOpportunities( 1657 IDWriteFontFace fontFace, 1658 FLOAT fontEmSize, 1659 DWRITE_SCRIPT_ANALYSIS scriptAnalysis, 1660 UINT32 textLength, 1661 UINT32 glyphCount, 1662 const(WCHAR)* textString, 1663 const(UINT16)* clusterMap, 1664 const(DWRITE_SHAPING_GLYPH_PROPERTIES)* glyphProperties, 1665 /*out*/ DWRITE_JUSTIFICATION_OPPORTUNITY* justificationOpportunities 1666 ); 1667 1668 /// <summary> 1669 /// Justifies an array of glyph advances to fit the line width. 1670 /// </summary> 1671 /// <param name="lineWidth">Width of the line.</param> 1672 /// <param name="glyphCount">Number of glyphs.</param> 1673 /// <param name="justificationOpportunities">Opportunities per glyph. Call 1674 /// GetJustificationOpportunities() to get suitable opportunities 1675 /// according to script.</param> 1676 /// <param name="glyphAdvances">Original glyph advances from shaping.</param> 1677 /// <param name="glyphOffsets">Original glyph offsets from shaping.</param> 1678 /// <param name="justifiedGlyphAdvances">Justified glyph advances.</param> 1679 /// <param name="justifiedGlyphOffsets">Justified glyph offsets.</param> 1680 /// <remarks> 1681 /// This is called after all the opportunities have been collected, and it 1682 /// spans across the entire line. The input and output arrays are allowed 1683 /// to alias each other, permitting in-place update. 1684 /// </remarks> 1685 /// <returns> 1686 /// Standard HRESULT error code. 1687 /// </returns> 1688 HRESULT JustifyGlyphAdvances( 1689 FLOAT lineWidth, 1690 UINT32 glyphCount, 1691 const(DWRITE_JUSTIFICATION_OPPORTUNITY)* justificationOpportunities, 1692 const(FLOAT)* glyphAdvances, 1693 const(DWRITE_GLYPH_OFFSET)* glyphOffsets, 1694 /*out*/ FLOAT* justifiedGlyphAdvances, 1695 /*out*/ DWRITE_GLYPH_OFFSET* justifiedGlyphOffsets 1696 ); 1697 1698 /// <summary> 1699 /// Fills in new glyphs for complex scripts where justification increased 1700 /// the advances of glyphs, such as Arabic with kashida. 1701 /// </summary> 1702 /// <param name="fontFace">Font face used for shaping.</param> 1703 /// <param name="fontEmSize">Font em size used for the glyph run.</param> 1704 /// <param name="scriptAnalysis">Script of the text from the itemizer.</param> 1705 /// <param name="textLength">Length of the text.</param> 1706 /// <param name="glyphCount">Number of glyphs.</param> 1707 /// <param name="maxGlyphCount">Maximum number of output glyphs allocated 1708 /// by caller.</param> 1709 /// <param name="clusterMap">Clustermap produced from shaping.</param> 1710 /// <param name="glyphIndices">Original glyphs produced from shaping.</param> 1711 /// <param name="glyphAdvances">Original glyph advances produced from shaping.</param> 1712 /// <param name="justifiedGlyphAdvances">Justified glyph advances from 1713 /// JustifyGlyphAdvances().</param> 1714 /// <param name="justifiedGlyphOffsets">Justified glyph offsets from 1715 /// JustifyGlyphAdvances().</param> 1716 /// <param name="glyphProperties">Properties of each glyph, from GetGlyphs.</param> 1717 /// <param name="actualGlyphCount">The new glyph count written to the 1718 /// modified arrays, or the needed glyph count if the size is not 1719 /// large enough.</param> 1720 /// <param name="modifiedClusterMap">Updated clustermap.</param> 1721 /// <param name="modifiedGlyphIndices">Updated glyphs with new glyphs 1722 /// inserted where needed.</param> 1723 /// <param name="modifiedGlyphAdvances">Updated glyph advances.</param> 1724 /// <param name="modifiedGlyphOffsets">Updated glyph offsets.</param> 1725 /// <remarks> 1726 /// This is called after the line has been justified, and it is per-run. 1727 /// It only needs to be called if the script has a specific justification 1728 /// character via GetScriptProperties, and it is mainly for cursive scripts 1729 /// like Arabic. If maxGlyphCount is not large enough, the error 1730 /// E_NOT_SUFFICIENT_BUFFER will be returned, with actualGlyphCount holding 1731 /// the final/needed glyph count. 1732 /// </remarks> 1733 /// <returns> 1734 /// Standard HRESULT error code. 1735 /// </returns> 1736 HRESULT GetJustifiedGlyphs( 1737 IDWriteFontFace fontFace, 1738 FLOAT fontEmSize, 1739 DWRITE_SCRIPT_ANALYSIS scriptAnalysis, 1740 UINT32 textLength, 1741 UINT32 glyphCount, 1742 UINT32 maxGlyphCount, 1743 const(UINT16)* clusterMap, 1744 const(UINT16)* glyphIndices, 1745 const(FLOAT)* glyphAdvances, 1746 const(FLOAT)* justifiedGlyphAdvances, 1747 const(DWRITE_GLYPH_OFFSET)* justifiedGlyphOffsets, 1748 const(DWRITE_SHAPING_GLYPH_PROPERTIES)* glyphProperties, 1749 /*out*/ UINT32* actualGlyphCount, 1750 /*out*/ UINT16* modifiedClusterMap, 1751 /*out*/ UINT16* modifiedGlyphIndices, 1752 /*out*/ FLOAT* modifiedGlyphAdvances, 1753 /*out*/ DWRITE_GLYPH_OFFSET* modifiedGlyphOffsets 1754 ); 1755 } 1756 1757 1758 /// <summary> 1759 /// The interface implemented by the client to provide needed information to 1760 /// the text analyzer, such as the text and associated text properties. 1761 /// If any of these callbacks returns an error, the analysis functions will 1762 /// stop prematurely and return a callback error. 1763 /// </summary> 1764 mixin( uuid!(IDWriteTextAnalysisSource1, "639CFAD8-0FB4-4B21-A58A-067920120009") ); 1765 interface IDWriteTextAnalysisSource1 : IDWriteTextAnalysisSource 1766 { 1767 extern(Windows): 1768 /// <summary> 1769 /// The text analyzer calls back to this to get the desired glyph 1770 /// orientation and resolved bidi level, which it uses along with the 1771 /// script properties of the text to determine the actual orientation of 1772 /// each character, which it reports back to the client via the sink 1773 /// SetGlyphOrientation method. 1774 /// </summary> 1775 /// <param name="textPosition">First position of the piece to obtain. All 1776 /// positions are in UTF-16 code-units, not whole characters, which 1777 /// matters when supplementary characters are used.</param> 1778 /// <param name="textLength">Number of UTF-16 units of the retrieved chunk. 1779 /// The returned length is not the length of the block, but the length 1780 /// remaining in the block, from the given position until its end. 1781 /// So querying for a position that is 75 positions into a 100 1782 /// postition block would return 25.</param> 1783 /// <param name="glyphOrientation">The type of glyph orientation the 1784 /// client wants for this range, up to the returned text length.</param> 1785 /// <param name="bidiLevel">The bidi level for this range up to 1786 /// the returned text length, which comes from an earlier 1787 /// bidirectional analysis.</param> 1788 /// <returns> 1789 /// Standard HRESULT error code. Returning an error will abort the 1790 /// analysis. 1791 /// </returns> 1792 HRESULT GetVerticalGlyphOrientation( 1793 UINT32 textPosition, 1794 /*out*/ UINT32* textLength, 1795 /*out*/ DWRITE_VERTICAL_GLYPH_ORIENTATION* glyphOrientation, 1796 /*out*/ UINT8* bidiLevel 1797 ); 1798 } 1799 1800 1801 /// <summary> 1802 /// The interface implemented by the client to receive the 1803 /// output of the text analyzers. 1804 /// </summary> 1805 mixin( uuid!(IDWriteTextAnalysisSink1, "B0D941A0-85E7-4D8B-9FD3-5CED9934482A") ); 1806 interface IDWriteTextAnalysisSink1 : IDWriteTextAnalysisSink 1807 { 1808 extern(Windows): 1809 /// <summary> 1810 /// The text analyzer calls back to this to report the actual orientation 1811 /// of each character for shaping and drawing. 1812 /// </summary> 1813 /// <param name="textPosition">Starting position to report from.</param> 1814 /// <param name="textLength">Number of UTF-16 units of the reported range.</param> 1815 /// <param name="glyphOrientationAngle">Angle of the glyphs within the text 1816 /// range (pass to GetGlyphOrientationTransform to get the world 1817 /// relative transform).</param> 1818 /// <param name="adjustedBidiLevel">The adjusted bidi level to be used by 1819 /// the client layout for reordering runs. This will differ from the 1820 /// resolved bidi level retrieved from the source for cases such as 1821 /// Arabic stacked top-to-bottom, where the glyphs are still shaped 1822 /// as RTL, but the runs are TTB along with any CJK or Latin.</param> 1823 /// <param name="isSideways">Whether the glyphs are rotated on their side, 1824 /// which is the default case for CJK and the case stacked Latin</param> 1825 /// <param name="isRightToLeft">Whether the script should be shaped as 1826 /// right-to-left. For Arabic stacked top-to-bottom, even when the 1827 /// adjusted bidi level is coerced to an even level, this will still 1828 /// be true.</param> 1829 /// <returns> 1830 /// A successful code or error code to abort analysis. 1831 /// </returns> 1832 HRESULT SetGlyphOrientation( 1833 UINT32 textPosition, 1834 UINT32 textLength, 1835 DWRITE_GLYPH_ORIENTATION_ANGLE glyphOrientationAngle, 1836 UINT8 adjustedBidiLevel, 1837 BOOL isSideways, 1838 BOOL isRightToLeft 1839 ); 1840 } 1841 1842 1843 /// <summary> 1844 /// The IDWriteTextLayout1 interface represents a block of text after it has 1845 /// been fully analyzed and formatted. 1846 /// 1847 /// All coordinates are in device independent pixels (DIPs). 1848 /// </summary> 1849 mixin( uuid!(IDWriteTextLayout1, "9064D822-80A7-465C-A986-DF65F78B8FEB") ); 1850 interface IDWriteTextLayout1 : IDWriteTextLayout 1851 { 1852 extern(Windows): 1853 /// <summary> 1854 /// Enables/disables pair-kerning on the given range. 1855 /// </summary> 1856 /// <param name="isPairKerningEnabled">The Boolean flag indicates whether text is pair-kerned.</param> 1857 /// <param name="textRange">Text range to which this change applies.</param> 1858 /// <returns> 1859 /// Standard HRESULT error code. 1860 /// </returns> 1861 HRESULT SetPairKerning( 1862 BOOL isPairKerningEnabled, 1863 DWRITE_TEXT_RANGE textRange 1864 ); 1865 1866 /// <summary> 1867 /// Get whether or not pair-kerning is enabled at given position. 1868 /// </summary> 1869 /// <param name="currentPosition">The current text position.</param> 1870 /// <param name="isPairKerningEnabled">The Boolean flag indicates whether text is pair-kerned.</param> 1871 /// <param name="textRange">The position range of the current format.</param> 1872 /// <returns> 1873 /// Standard HRESULT error code. 1874 /// </returns> 1875 HRESULT GetPairKerning( 1876 UINT32 currentPosition, 1877 /*out*/ BOOL* isPairKerningEnabled, 1878 /*out*/ DWRITE_TEXT_RANGE* textRange = null 1879 ); 1880 1881 /// <summary> 1882 /// Sets the spacing between characters. 1883 /// </summary> 1884 /// <param name="leadingSpacing">The spacing before each character, in reading order.</param> 1885 /// <param name="trailingSpacing">The spacing after each character, in reading order.</param> 1886 /// <param name="minimumAdvanceWidth">The minimum advance of each character, 1887 /// to prevent characters from becoming too thin or zero-width. This 1888 /// must be zero or greater.</param> 1889 /// <param name="textRange">Text range to which this change applies.</param> 1890 /// <returns> 1891 /// Standard HRESULT error code. 1892 /// </returns> 1893 HRESULT SetCharacterSpacing( 1894 FLOAT leadingSpacing, 1895 FLOAT trailingSpacing, 1896 FLOAT minimumAdvanceWidth, 1897 DWRITE_TEXT_RANGE textRange 1898 ); 1899 1900 /// <summary> 1901 /// Gets the spacing between characters. 1902 /// </summary> 1903 /// <param name="currentPosition">The current text position.</param> 1904 /// <param name="leadingSpacing">The spacing before each character, in reading order.</param> 1905 /// <param name="trailingSpacing">The spacing after each character, in reading order.</param> 1906 /// <param name="minimumAdvanceWidth">The minimum advance of each character, 1907 /// to prevent characters from becoming too thin or zero-width. This 1908 /// must be zero or greater.</param> 1909 /// <param name="textRange">The position range of the current format.</param> 1910 /// <returns> 1911 /// Standard HRESULT error code. 1912 /// </returns> 1913 HRESULT GetCharacterSpacing( 1914 UINT32 currentPosition, 1915 /*out*/ FLOAT* leadingSpacing, 1916 /*out*/ FLOAT* trailingSpacing, 1917 /*out*/ FLOAT* minimumAdvanceWidth, 1918 /*out*/ DWRITE_TEXT_RANGE* textRange = null 1919 ); 1920 } 1921 1922 /// <summary> 1923 /// Represents the type of antialiasing to use for text when the rendering mode calls for 1924 /// antialiasing. 1925 /// </summary> 1926 alias DWRITE_TEXT_ANTIALIAS_MODE = int; 1927 enum : DWRITE_TEXT_ANTIALIAS_MODE 1928 { 1929 /// <summary> 1930 /// ClearType antialiasing computes coverage independently for the red, green, and blue 1931 /// color elements of each pixel. This allows for more detail than conventional antialiasing. 1932 /// However, because there is no one alpha value for each pixel, ClearType is not suitable 1933 /// rendering text onto a transparent intermediate bitmap. 1934 /// </summary> 1935 DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE, 1936 1937 /// <summary> 1938 /// Grayscale antialiasing computes one coverage value for each pixel. Because the alpha 1939 /// value of each pixel is well-defined, text can be rendered onto a transparent bitmap, 1940 /// which can then be composited with other content. Note that grayscale rendering with 1941 /// IDWriteBitmapRenderTarget1 uses premultiplied alpha. 1942 /// </summary> 1943 DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE 1944 } 1945 1946 /// <summary> 1947 /// Encapsulates a 32-bit device independent bitmap and device context, which can be used for rendering glyphs. 1948 /// </summary> 1949 mixin( uuid!(IDWriteBitmapRenderTarget1, "791e8298-3ef3-4230-9880-c9bdecc42064") ); 1950 interface IDWriteBitmapRenderTarget1 : IDWriteBitmapRenderTarget 1951 { 1952 extern(Windows): 1953 /// <summary> 1954 /// Gets the current text antialiasing mode of the bitmap render target. 1955 /// </summary> 1956 /// <returns> 1957 /// Returns the antialiasing mode. 1958 /// </returns> 1959 DWRITE_TEXT_ANTIALIAS_MODE GetTextAntialiasMode(); 1960 1961 /// <summary> 1962 /// Sets the current text antialiasing mode of the bitmap render target. 1963 /// </summary> 1964 /// <returns> 1965 /// Returns S_OK if successful, or E_INVALIDARG if the argument is not valid. 1966 /// </returns> 1967 /// <remarks> 1968 /// The antialiasing mode of a newly-created bitmap render target defaults to 1969 /// DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE. An application can change the antialiasing 1970 /// mode by calling SetTextAntialiasMode. For example, an application might specify 1971 /// grayscale antialiasing when rendering text onto a transparent bitmap. 1972 /// </remarks> 1973 HRESULT SetTextAntialiasMode( 1974 DWRITE_TEXT_ANTIALIAS_MODE antialiasMode 1975 ); 1976 }