This file is indexed.

/usr/include/wine-development/windows/dwrite.idl is in libwine-development-dev 1.7.29-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
/*
 * Copyright 2012 Nikolay Sivov for CodeWeavers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

import "unknwn.idl";
import "dcommon.h";

interface IDWriteFactory;
interface IDWriteFontCollection;
interface IDWriteFontFamily;
interface IDWriteFontFace;
interface IDWriteInlineObject;

interface ID2D1SimplifiedGeometrySink;
typedef ID2D1SimplifiedGeometrySink IDWriteGeometrySink;

cpp_quote("#ifndef _WINDEF_")
/* already defined in windef.h but needed for WIDL */
typedef void *HMONITOR;
cpp_quote("#endif /* _WINDEF_ */")

cpp_quote("#ifdef WINE_NO_UNICODE_MACROS")
cpp_quote("#undef GetGlyphIndices")
cpp_quote("#endif")

typedef enum DWRITE_FACTORY_TYPE
{
    DWRITE_FACTORY_TYPE_SHARED,
    DWRITE_FACTORY_TYPE_ISOLATED
} DWRITE_FACTORY_TYPE;

typedef enum DWRITE_FONT_FILE_TYPE
{
    DWRITE_FONT_FILE_TYPE_UNKNOWN,
    DWRITE_FONT_FILE_TYPE_CFF,
    DWRITE_FONT_FILE_TYPE_TRUETYPE,
    DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION,
    DWRITE_FONT_FILE_TYPE_TYPE1_PFM,
    DWRITE_FONT_FILE_TYPE_TYPE1_PFB,
    DWRITE_FONT_FILE_TYPE_VECTOR,
    DWRITE_FONT_FILE_TYPE_BITMAP
} DWRITE_FONT_FILE_TYPE;

typedef enum DWRITE_FONT_FACE_TYPE
{
    DWRITE_FONT_FACE_TYPE_CFF,
    DWRITE_FONT_FACE_TYPE_TRUETYPE,
    DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION,
    DWRITE_FONT_FACE_TYPE_TYPE1,
    DWRITE_FONT_FACE_TYPE_VECTOR,
    DWRITE_FONT_FACE_TYPE_BITMAP,
    DWRITE_FONT_FACE_TYPE_UNKNOWN,
    DWRITE_FONT_FACE_TYPE_RAW_CFF
} DWRITE_FONT_FACE_TYPE;

typedef enum DWRITE_FONT_WEIGHT
{
    DWRITE_FONT_WEIGHT_THIN = 100,
    DWRITE_FONT_WEIGHT_EXTRA_LIGHT = 200,
    DWRITE_FONT_WEIGHT_ULTRA_LIGHT = 200,
    DWRITE_FONT_WEIGHT_LIGHT = 300,
    DWRITE_FONT_WEIGHT_NORMAL = 400,
    DWRITE_FONT_WEIGHT_REGULAR = 400,
    DWRITE_FONT_WEIGHT_MEDIUM = 500,
    DWRITE_FONT_WEIGHT_DEMI_BOLD = 600,
    DWRITE_FONT_WEIGHT_SEMI_BOLD = 600,
    DWRITE_FONT_WEIGHT_BOLD = 700,
    DWRITE_FONT_WEIGHT_EXTRA_BOLD = 800,
    DWRITE_FONT_WEIGHT_ULTRA_BOLD = 800,
    DWRITE_FONT_WEIGHT_BLACK = 900,
    DWRITE_FONT_WEIGHT_HEAVY = 900,
    DWRITE_FONT_WEIGHT_EXTRA_BLACK = 950,
    DWRITE_FONT_WEIGHT_ULTRA_BLACK = 950
} DWRITE_FONT_WEIGHT;

typedef enum DWRITE_FONT_STRETCH
{
    DWRITE_FONT_STRETCH_UNDEFINED = 0,
    DWRITE_FONT_STRETCH_ULTRA_CONDENSED = 1,
    DWRITE_FONT_STRETCH_EXTRA_CONDENSED = 2,
    DWRITE_FONT_STRETCH_CONDENSED = 3,
    DWRITE_FONT_STRETCH_SEMI_CONDENSED = 4,
    DWRITE_FONT_STRETCH_NORMAL = 5,
    DWRITE_FONT_STRETCH_MEDIUM = 5,
    DWRITE_FONT_STRETCH_SEMI_EXPANDED = 6,
    DWRITE_FONT_STRETCH_EXPANDED = 7,
    DWRITE_FONT_STRETCH_EXTRA_EXPANDED = 8,
    DWRITE_FONT_STRETCH_ULTRA_EXPANDED = 9
} DWRITE_FONT_STRETCH;

typedef enum DWRITE_FONT_STYLE
{
    DWRITE_FONT_STYLE_NORMAL,
    DWRITE_FONT_STYLE_OBLIQUE,
    DWRITE_FONT_STYLE_ITALIC
} DWRITE_FONT_STYLE;

typedef enum DWRITE_INFORMATIONAL_STRING_ID
{
    DWRITE_INFORMATIONAL_STRING_NONE,
    DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE,
    DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS,
    DWRITE_INFORMATIONAL_STRING_TRADEMARK,
    DWRITE_INFORMATIONAL_STRING_MANUFACTURER,
    DWRITE_INFORMATIONAL_STRING_DESIGNER,
    DWRITE_INFORMATIONAL_STRING_DESIGNER_URL,
    DWRITE_INFORMATIONAL_STRING_DESCRIPTION,
    DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL,
    DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION,
    DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL,
    DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES,
    DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES,
    DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES,
    DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES,
    DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT,
    DWRITE_INFORMATIONAL_STRING_FULL_NAME,
    DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME,
    DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_CID_NAME
} DWRITE_INFORMATIONAL_STRING_ID;

typedef enum DWRITE_FONT_SIMULATIONS
{
    DWRITE_FONT_SIMULATIONS_NONE,
    DWRITE_FONT_SIMULATIONS_BOLD,
    DWRITE_FONT_SIMULATIONS_OBLIQUE
} DWRITE_FONT_SIMULATIONS;

typedef enum DWRITE_PIXEL_GEOMETRY
{
    DWRITE_PIXEL_GEOMETRY_FLAT,
    DWRITE_PIXEL_GEOMETRY_RGB,
    DWRITE_PIXEL_GEOMETRY_BGR
} DWRITE_PIXEL_GEOMETRY;

typedef enum DWRITE_RENDERING_MODE
{
    DWRITE_RENDERING_MODE_DEFAULT,
    DWRITE_RENDERING_MODE_ALIASED,
    DWRITE_RENDERING_MODE_GDI_CLASSIC,
    DWRITE_RENDERING_MODE_GDI_NATURAL,
    DWRITE_RENDERING_MODE_NATURAL,
    DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC,
    DWRITE_RENDERING_MODE_OUTLINE,
    DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC = DWRITE_RENDERING_MODE_GDI_CLASSIC,
    DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL = DWRITE_RENDERING_MODE_GDI_NATURAL,
    DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL = DWRITE_RENDERING_MODE_NATURAL,
    DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC
} DWRITE_RENDERING_MODE;

typedef enum DWRITE_TEXT_ALIGNMENT
{
    DWRITE_TEXT_ALIGNMENT_LEADING,
    DWRITE_TEXT_ALIGNMENT_TRAILING,
    DWRITE_TEXT_ALIGNMENT_CENTER,
    DWRITE_TEXT_ALIGNMENT_JUSTIFIED
} DWRITE_TEXT_ALIGNMENT;

typedef enum DWRITE_PARAGRAPH_ALIGNMENT
{
    DWRITE_PARAGRAPH_ALIGNMENT_NEAR,
    DWRITE_PARAGRAPH_ALIGNMENT_FAR,
    DWRITE_PARAGRAPH_ALIGNMENT_CENTER
} DWRITE_PARAGRAPH_ALIGNMENT;

typedef enum DWRITE_WORD_WRAPPING
{
    DWRITE_WORD_WRAPPING_WRAP,
    DWRITE_WORD_WRAPPING_NO_WRAP,
    DWRITE_WORD_WRAPPING_EMERGENCY_BREAK,
    DWRITE_WORD_WRAPPING_WHOLE_WORD,
    DWRITE_WORD_WRAPPING_CHARACTER
} DWRITE_WORD_WRAPPING;

typedef enum DWRITE_READING_DIRECTION
{
    DWRITE_READING_DIRECTION_LEFT_TO_RIGHT,
    DWRITE_READING_DIRECTION_RIGHT_TO_LEFT,
    DWRITE_READING_DIRECTION_TOP_TO_BOTTOM,
    DWRITE_READING_DIRECTION_BOTTOM_TO_TOP
} DWRITE_READING_DIRECTION;

typedef enum DWRITE_FLOW_DIRECTION
{
    DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM,
    DWRITE_FLOW_DIRECTION_BOTTOM_TO_TOP,
    DWRITE_FLOW_DIRECTION_LEFT_TO_RIGHT,
    DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT
} DWRITE_FLOW_DIRECTION;

typedef enum DWRITE_TRIMMING_GRANULARITY
{
    DWRITE_TRIMMING_GRANULARITY_NONE,
    DWRITE_TRIMMING_GRANULARITY_CHARACTER,
    DWRITE_TRIMMING_GRANULARITY_WORD
} DWRITE_TRIMMING_GRANULARITY;

typedef enum DWRITE_BREAK_CONDITION
{
    DWRITE_BREAK_CONDITION_NEUTRAL,
    DWRITE_BREAK_CONDITION_CAN_BREAK,
    DWRITE_BREAK_CONDITION_MAY_NOT_BREAK,
    DWRITE_BREAK_CONDITION_MUST_BREAK
} DWRITE_BREAK_CONDITION;

typedef enum DWRITE_LINE_SPACING_METHOD
{
    DWRITE_LINE_SPACING_METHOD_DEFAULT,
    DWRITE_LINE_SPACING_METHOD_UNIFORM
} DWRITE_LINE_SPACING_METHOD;

cpp_quote("#define DWRITE_MAKE_OPENTYPE_TAG(a,b,c,d) ( \\")
cpp_quote("    ((UINT32)(UINT8)(d) << 24) | \\")
cpp_quote("    ((UINT32)(UINT8)(c) << 16) | \\")
cpp_quote("    ((UINT32)(UINT8)(b) <<  8) | \\")
cpp_quote("     (UINT32)(UINT8)(a))")

typedef enum DWRITE_FONT_FEATURE_TAG
{
    DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS           = 0x63726661, /* 'afrc' */
    DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS   = 0x63703263, /* 'c2pc' */
    DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS    = 0x63733263, /* 'c2sc' */
    DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES           = 0x746c6163, /* 'calt' */
    DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS            = 0x65736163, /* 'case' */
    DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION = 0x706d6363, /* 'ccmp' */
    DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES            = 0x67696c63, /* 'clig' */
    DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING                 = 0x70737063, /* 'cpsp' */
    DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH                = 0x68777363, /* 'cswh' */
    DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING             = 0x73727563, /* 'curs' */
    DWRITE_FONT_FEATURE_TAG_DEFAULT                         = 0x746c6664, /* 'dflt' */
    DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES         = 0x67696c64, /* 'dlig' */
    DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS                    = 0x74707865, /* 'expt' */
    DWRITE_FONT_FEATURE_TAG_FRACTIONS                       = 0x63617266, /* 'frac' */
    DWRITE_FONT_FEATURE_TAG_FULL_WIDTH                      = 0x64697766, /* 'fwid' */
    DWRITE_FONT_FEATURE_TAG_HALF_FORMS                      = 0x666c6168, /* 'half' */
    DWRITE_FONT_FEATURE_TAG_HALANT_FORMS                    = 0x6e6c6168, /* 'haln' */
    DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH            = 0x746c6168, /* 'halt' */
    DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS                = 0x74736968, /* 'hist' */
    DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES      = 0x616e6b68, /* 'hkna' */
    DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES            = 0x67696c68, /* 'hlig' */
    DWRITE_FONT_FEATURE_TAG_HALF_WIDTH                      = 0x64697768, /* 'hwid' */
    DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS                = 0x6f6a6f68, /* 'hojo' */
    DWRITE_FONT_FEATURE_TAG_JIS04_FORMS                     = 0x3430706a, /* 'jp04' */
    DWRITE_FONT_FEATURE_TAG_JIS78_FORMS                     = 0x3837706a, /* 'jp78' */
    DWRITE_FONT_FEATURE_TAG_JIS83_FORMS                     = 0x3338706a, /* 'jp83' */
    DWRITE_FONT_FEATURE_TAG_JIS90_FORMS                     = 0x3039706a, /* 'jp90' */
    DWRITE_FONT_FEATURE_TAG_KERNING                         = 0x6e72656b, /* 'kern' */
    DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES              = 0x6167696c, /* 'liga' */
    DWRITE_FONT_FEATURE_TAG_LINING_FIGURES                  = 0x6d756e6c, /* 'lnum' */
    DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS                 = 0x6c636f6c, /* 'locl' */
    DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING                = 0x6b72616d, /* 'mark' */
    DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK              = 0x6b72676d, /* 'mgrk' */
    DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING        = 0x6b6d6b6d, /* 'mkmk' */
    DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS      = 0x746c616e, /* 'nalt' */
    DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS                 = 0x6b636c6e, /* 'nlck' */
    DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES               = 0x6d756e6f, /* 'onum' */
    DWRITE_FONT_FEATURE_TAG_ORDINALS                        = 0x6e64726f, /* 'ordn' */
    DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH    = 0x746c6170, /* 'palt' */
    DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS                 = 0x70616370, /* 'pcap' */
    DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES            = 0x6d756e70, /* 'pnum' */
    DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS             = 0x64697770, /* 'pwid' */
    DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS                  = 0x64697771, /* 'qwid' */
    DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES              = 0x67696c72, /* 'rlig' */
    DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS             = 0x79627572, /* 'ruby' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES            = 0x746c6173, /* 'salt' */
    DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS            = 0x666e6973, /* 'sinf' */
    DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS                  = 0x70636d73, /* 'smcp' */
    DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS                = 0x6c706d73, /* 'smpl' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1                 = 0x31307373, /* 'ss01' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2                 = 0x32307373, /* 'ss02' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3                 = 0x33307373, /* 'ss03' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4                 = 0x34307373, /* 'ss04' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5                 = 0x35307373, /* 'ss05' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6                 = 0x36307373, /* 'ss06' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7                 = 0x37307373, /* 'ss07' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8                 = 0x38307373, /* 'ss08' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9                 = 0x39307373, /* 'ss09' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10                = 0x30317373, /* 'ss10' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11                = 0x31317373, /* 'ss11' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12                = 0x32317373, /* 'ss12' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13                = 0x33317373, /* 'ss13' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14                = 0x34317373, /* 'ss14' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15                = 0x35317373, /* 'ss15' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16                = 0x36317373, /* 'ss16' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17                = 0x37317373, /* 'ss17' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18                = 0x38317373, /* 'ss18' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19                = 0x39317373, /* 'ss19' */
    DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20                = 0x30327373, /* 'ss20' */
    DWRITE_FONT_FEATURE_TAG_SUBSCRIPT                       = 0x73627573, /* 'subs' */
    DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT                     = 0x73707573, /* 'sups' */
    DWRITE_FONT_FEATURE_TAG_SWASH                           = 0x68737773, /* 'swsh' */
    DWRITE_FONT_FEATURE_TAG_TITLING                         = 0x6c746974, /* 'titl' */
    DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS          = 0x6d616e74, /* 'tnam' */
    DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES                 = 0x6d756e74, /* 'tnum' */
    DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS               = 0x64617274, /* 'trad' */
    DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS                    = 0x64697774, /* 'twid' */
    DWRITE_FONT_FEATURE_TAG_UNICASE                         = 0x63696e75, /* 'unic' */
    DWRITE_FONT_FEATURE_TAG_VERTICAL_WRITING                = 0x74726576, /* 'vert' */
    DWRITE_FONT_FEATURE_TAG_VERTICAL_ALTERNATES_AND_ROTATION= 0x32747276, /* 'vrt2' */
    DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO                    = 0x6f72657a, /* 'zero' */
} DWRITE_FONT_FEATURE_TAG;

typedef enum DWRITE_SCRIPT_SHAPES
{
    DWRITE_SCRIPT_SHAPES_DEFAULT = 0,
    DWRITE_SCRIPT_SHAPES_NO_VISUAL = 1
} DWRITE_SCRIPT_SHAPES;

typedef enum DWRITE_NUMBER_SUBSTITUTION_METHOD
{
    DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE,
    DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL,
    DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE,
    DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL,
    DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL
} DWRITE_NUMBER_SUBSTITUTION_METHOD;

typedef enum DWRITE_TEXTURE_TYPE
{
    DWRITE_TEXTURE_ALIASED_1x1,
    DWRITE_TEXTURE_CLEARTYPE_3x1
} DWRITE_TEXTURE_TYPE;

typedef struct DWRITE_FONT_METRICS
{
    UINT16 designUnitsPerEm;
    UINT16 ascent;
    UINT16 descent;
    INT16 lineGap;
    UINT16 capHeight;
    UINT16 xHeight;
    INT16 underlinePosition;
    UINT16 underlineThickness;
    INT16 strikethroughPosition;
    UINT16 strikethroughThickness;
} DWRITE_FONT_METRICS;

typedef struct DWRITE_GLYPH_METRICS
{
    INT32 leftSideBearing;
    UINT32 advanceWidth;
    INT32 rightSideBearing;
    INT32 topSideBearing;
    UINT32 advanceHeight;
    INT32 bottomSideBearing;
    INT32 verticalOriginY;
} DWRITE_GLYPH_METRICS;

typedef struct DWRITE_GLYPH_OFFSET
{
    FLOAT advanceOffset;
    FLOAT ascenderOffset;
} DWRITE_GLYPH_OFFSET;

typedef struct DWRITE_MATRIX
{
    FLOAT m11;
    FLOAT m12;
    FLOAT m21;
    FLOAT m22;
    FLOAT dx;
    FLOAT dy;
} DWRITE_MATRIX;

typedef struct DWRITE_TRIMMING
{
    DWRITE_TRIMMING_GRANULARITY granularity;
    UINT32 delimiter;
    UINT32 delimiterCount;
} DWRITE_TRIMMING;

cpp_quote("#ifndef __d2d1_h__")
typedef struct DWRITE_GLYPH_RUN DWRITE_GLYPH_RUN;
cpp_quote("#endif /* __d2d1_h__ */")

struct DWRITE_GLYPH_RUN
{
    IDWriteFontFace* fontFace;
    FLOAT fontEmSize;
    UINT32 glyphCount;
    UINT16 const* glyphIndices;
    FLOAT const* glyphAdvances;
    DWRITE_GLYPH_OFFSET const* glyphOffsets;
    BOOL isSideways;
    UINT32 bidiLevel;
};

typedef struct DWRITE_GLYPH_RUN_DESCRIPTION
{
    WCHAR const* localeName;
    WCHAR const* string;
    UINT32 stringLength;
    UINT16 const* clusterMap;
    UINT32 textPosition;
} DWRITE_GLYPH_RUN_DESCRIPTION;

typedef struct DWRITE_UNDERLINE
{
    FLOAT width;
    FLOAT thickness;
    FLOAT offset;
    FLOAT runHeight;
    DWRITE_READING_DIRECTION readingDirection;
    DWRITE_FLOW_DIRECTION flowDirection;
    WCHAR const* localeName;
    DWRITE_MEASURING_MODE measuringMode;
} DWRITE_UNDERLINE;

typedef struct DWRITE_STRIKETHROUGH
{
    FLOAT width;
    FLOAT thickness;
    FLOAT offset;
    DWRITE_READING_DIRECTION readingDirection;
    DWRITE_FLOW_DIRECTION flowDirection;
    WCHAR const* localeName;
    DWRITE_MEASURING_MODE measuringMode;
} DWRITE_STRIKETHROUGH;

typedef struct DWRITE_INLINE_OBJECT_METRICS
{
    FLOAT width;
    FLOAT height;
    FLOAT baseline;
    BOOL  supportsSideways;
} DWRITE_INLINE_OBJECT_METRICS;

typedef struct DWRITE_OVERHANG_METRICS
{
    FLOAT left;
    FLOAT top;
    FLOAT right;
    FLOAT bottom;
} DWRITE_OVERHANG_METRICS;

typedef struct DWRITE_FONT_FEATURE
{
    DWRITE_FONT_FEATURE_TAG nameTag;
    UINT32 parameter;
} DWRITE_FONT_FEATURE;

typedef struct DWRITE_TEXT_RANGE
{
    UINT32 startPosition;
    UINT32 length;
} DWRITE_TEXT_RANGE;

typedef struct DWRITE_LINE_METRICS
{
    UINT32 length;
    UINT32 trailingWhitespaceLength;
    UINT32 newlineLength;
    FLOAT height;
    FLOAT baseline;
    BOOL isTrimmed;
} DWRITE_LINE_METRICS;

typedef struct DWRITE_TEXT_METRICS
{
    FLOAT left;
    FLOAT top;
    FLOAT width;
    FLOAT widthIncludingTrailingWhitespace;
    FLOAT height;
    FLOAT layoutWidth;
    FLOAT layoutHeight;
    UINT32 maxBidiReorderingDepth;
    UINT32 lineCount;
} DWRITE_TEXT_METRICS;

typedef struct DWRITE_CLUSTER_METRICS
{
    FLOAT width;
    UINT16 length;
    UINT16 canWrapLineAfter : 1;
    UINT16 isWhitespace : 1;
    UINT16 isNewline : 1;
    UINT16 isSoftHyphen : 1;
    UINT16 isRightToLeft : 1;
    UINT16 padding : 11;
} DWRITE_CLUSTER_METRICS;

typedef struct DWRITE_HIT_TEST_METRICS
{
    UINT32 textPosition;
    UINT32 length;
    FLOAT left;
    FLOAT top;
    FLOAT width;
    FLOAT height;
    UINT32 bidiLevel;
    BOOL isText;
    BOOL isTrimmed;
} DWRITE_HIT_TEST_METRICS;

typedef struct DWRITE_SCRIPT_ANALYSIS
{
    UINT16 script;
    DWRITE_SCRIPT_SHAPES shapes;
} DWRITE_SCRIPT_ANALYSIS;

typedef struct DWRITE_LINE_BREAKPOINT
{
    UINT8 breakConditionBefore : 2;
    UINT8 breakConditionAfter : 2;
    UINT8 isWhitespace : 1;
    UINT8 isSoftHyphen : 1;
    UINT8 padding : 2;
} DWRITE_LINE_BREAKPOINT;

typedef struct DWRITE_TYPOGRAPHIC_FEATURES
{
    DWRITE_FONT_FEATURE* features;
    UINT32 featureCount;
} DWRITE_TYPOGRAPHIC_FEATURES;

typedef struct DWRITE_SHAPING_TEXT_PROPERTIES
{
    UINT16 isShapedAlone : 1;
    UINT16 reserved : 15;
} DWRITE_SHAPING_TEXT_PROPERTIES;

typedef struct DWRITE_SHAPING_GLYPH_PROPERTIES
{
    UINT16 justification : 4;
    UINT16 isClusterStart : 1;
    UINT16 isDiacritic : 1;
    UINT16 isZeroWidthSpace : 1;
    UINT16 reserved : 9;
} DWRITE_SHAPING_GLYPH_PROPERTIES;

[
local,
object,
uuid(6d4865fe-0ab8-4d91-8f62-5dd6be34a3e0)
]
interface IDWriteFontFileStream : IUnknown
{
    HRESULT ReadFileFragment(
        void const **fragment_start,
        UINT64 offset,
        UINT64 fragment_size,
        void **fragment_context);

    void ReleaseFileFragment(void *fragment_context);
    HRESULT GetFileSize(UINT64 *size);
    HRESULT GetLastWriteTime(UINT64 *last_writetime);
}

[
local,
object,
uuid(727cad4e-d6af-4c9e-8a08-d695b11caa49)
]
interface IDWriteFontFileLoader : IUnknown
{
    HRESULT CreateStreamFromKey(
        void const *key,
        UINT32 key_size,
        IDWriteFontFileStream **stream);
}

[
local,
object,
uuid(b2d9f3ec-c9fe-4a11-a2ec-d86208f7c0a2)
]
interface IDWriteLocalFontFileLoader : IDWriteFontFileLoader
{
    HRESULT GetFilePathLengthFromKey(void const *key, UINT32 key_size, UINT32 *length);
    HRESULT GetFilePathFromKey(void const *key, UINT32 key_size, WCHAR *path, UINT32 length);
    HRESULT GetLastWriteTimeFromKey(void const *key, UINT32 key_size, FILETIME *writetime);
}

[
local,
object,
uuid(739d886a-cef5-47dc-8769-1a8b41bebbb0)
]
interface IDWriteFontFile : IUnknown
{
    HRESULT GetReferenceKey(
        void const **key,
        UINT32 *key_size);

    HRESULT GetLoader(IDWriteFontFileLoader **loader);

    HRESULT Analyze(
        BOOL *is_supported_fonttype,
        DWRITE_FONT_FILE_TYPE *file_type,
        DWRITE_FONT_FACE_TYPE *face_type,
        UINT32 *faces_num);
}

[
local,
object,
uuid(72755049-5ff7-435d-8348-4be97cfa6c7c)
]
interface IDWriteFontFileEnumerator : IUnknown
{
    HRESULT MoveNext(BOOL *has_current_file);
    HRESULT GetCurrentFontFile(IDWriteFontFile **font_file);
};

[
local,
object,
uuid(cca920e4-52f0-492b-bfa8-29c72ee0a468)
]
interface IDWriteFontCollectionLoader : IUnknown
{
    HRESULT CreateEnumeratorFromKey(
        IDWriteFactory* factory,
        void const* key,
        UINT32 key_size,
        IDWriteFontFileEnumerator **enumerator);
}

[
local,
object,
uuid(08256209-099a-4b34-b86d-c22b110e7771)
]
interface IDWriteLocalizedStrings : IUnknown
{
    UINT32 GetCount();

    HRESULT FindLocaleName(
        WCHAR const *locale_name,
        UINT32 *index,
        BOOL *exists);

    HRESULT GetLocaleNameLength(UINT32 index, UINT32 *length);
    HRESULT GetLocaleName(UINT32 index, WCHAR *locale_name, UINT32 size);
    HRESULT GetStringLength(UINT32 index, UINT32 *length);
    HRESULT GetString(UINT32 index, WCHAR *buffer, UINT32 size);
}

[
local,
object,
uuid(2f0da53a-2add-47cd-82ee-d9ec34688e75)
]
interface IDWriteRenderingParams : IUnknown
{
    FLOAT GetGamma();
    FLOAT GetEnhancedContrast();
    FLOAT GetClearTypeLevel();
    DWRITE_PIXEL_GEOMETRY GetPixelGeometry();
    DWRITE_RENDERING_MODE GetRenderingMode();
}

[
local,
object,
uuid(5f49804d-7024-4d43-bfa9-d25984f53849)
]
interface IDWriteFontFace : IUnknown
{
    DWRITE_FONT_FACE_TYPE GetType();
    HRESULT GetFiles(UINT32 *number_of_files, IDWriteFontFile **fontfiles);
    UINT32 GetIndex();
    DWRITE_FONT_SIMULATIONS GetSimulations();
    BOOL IsSymbolFont();
    void GetMetrics(DWRITE_FONT_METRICS *metrics);
    UINT16 GetGlyphCount();

    HRESULT GetDesignGlyphMetrics(
        UINT16 const *glyph_indices,
        UINT32 glyph_count,
        DWRITE_GLYPH_METRICS *metrics,
        [defaultvalue(FALSE)] BOOL is_sideways);

    HRESULT GetGlyphIndices(
        UINT32 const *codepoints,
        UINT32 count,
        UINT16 *glyph_indices);

    HRESULT TryGetFontTable(
        UINT32 table_tag,
        const void **table_data,
        UINT32 *table_size,
        void **context,
        BOOL *exists);

    void ReleaseFontTable(void *table_context);

    HRESULT GetGlyphRunOutline(
        FLOAT emSize,
        UINT16 const *glyph_indices,
        FLOAT const* glyph_advances,
        DWRITE_GLYPH_OFFSET const *glyph_offsets,
        UINT32 glyph_count,
        BOOL is_sideways,
        BOOL is_rtl,
        IDWriteGeometrySink *geometrysink);

    HRESULT GetRecommendedRenderingMode(
        FLOAT emSize,
        FLOAT pixels_per_dip,
        DWRITE_MEASURING_MODE mode,
        IDWriteRenderingParams* params,
        DWRITE_RENDERING_MODE* rendering_mode);

    HRESULT GetGdiCompatibleMetrics(
        FLOAT emSize,
        FLOAT pixels_per_dip,
        DWRITE_MATRIX const *transform,
        DWRITE_FONT_METRICS *metrics);

    HRESULT GetGdiCompatibleGlyphMetrics(
        FLOAT emSize,
        FLOAT pixels_per_dip,
        DWRITE_MATRIX const *transform,
        BOOL use_gdi_natural,
        UINT16 const *glyph_indices,
        UINT32 glyph_count,
        DWRITE_GLYPH_METRICS *metrics,
        [defaultvalue(FALSE)] BOOL is_sideways);
}

[
local,
object,
uuid(acd16696-8c14-4f5d-877e-fe3fc1d32737)
]
interface IDWriteFont : IUnknown
{
    HRESULT GetFontFamily(IDWriteFontFamily **family);
    DWRITE_FONT_WEIGHT GetWeight();
    DWRITE_FONT_STRETCH GetStretch();
    DWRITE_FONT_STYLE GetStyle();
    BOOL IsSymbolFont();

    HRESULT GetFaceNames(IDWriteLocalizedStrings **names);
    HRESULT GetInformationalStrings(
        DWRITE_INFORMATIONAL_STRING_ID stringid,
        IDWriteLocalizedStrings **strings,
        BOOL *exists);

    DWRITE_FONT_SIMULATIONS GetSimulations();
    void GetMetrics(DWRITE_FONT_METRICS *metrics);
    HRESULT HasCharacter(UINT32 value, BOOL *exists);
    HRESULT CreateFontFace(IDWriteFontFace **face);
}

[
local,
object,
uuid(1a0d8438-1d97-4ec1-aef9-a2fb86ed6acb)
]
interface IDWriteFontList : IUnknown
{
    HRESULT GetFontCollection(IDWriteFontCollection **collection);
    UINT32 GetFontCount();
    HRESULT GetFont(UINT32 index, IDWriteFont **font);
}

[
local,
object,
uuid(da20d8ef-812a-4c43-9802-62ec4abd7add)
]
interface IDWriteFontFamily : IDWriteFontList
{
    HRESULT GetFamilyNames(IDWriteLocalizedStrings **names);

    HRESULT GetFirstMatchingFont(
        DWRITE_FONT_WEIGHT weight,
        DWRITE_FONT_STRETCH stretch,
        DWRITE_FONT_STYLE style,
        IDWriteFont **font);

    HRESULT GetMatchingFonts(
        DWRITE_FONT_WEIGHT weight,
        DWRITE_FONT_STRETCH stretch,
        DWRITE_FONT_STYLE style,
        IDWriteFontList **fonts);
}

[
local,
object,
uuid(a84cee02-3eea-4eee-a827-87c1a02a0fcc)
]
interface IDWriteFontCollection : IUnknown
{
    UINT32 GetFontFamilyCount();
    HRESULT GetFontFamily(UINT32 index, IDWriteFontFamily **family);
    HRESULT FindFamilyName(WCHAR const *name, UINT32 *index, BOOL *exists);
    HRESULT GetFontFromFontFace(IDWriteFontFace *face, IDWriteFont **font);
}

[
local,
object,
uuid(eaf3a2da-ecf4-4d24-b644-b34f6842024b)
]
interface IDWritePixelSnapping : IUnknown
{
    HRESULT IsPixelSnappingDisabled(
        void *client_drawingcontext,
        BOOL *disabled);

    HRESULT GetCurrentTransform(
        void *client_drawingcontext,
        DWRITE_MATRIX *transform);

    HRESULT GetPixelsPerDip(
        void *client_drawingcontext,
        FLOAT *pixels_per_dip);
}

[
local,
object,
uuid(ef8a8135-5cc6-45fe-8825-c5a0724eb819)
]
interface IDWriteTextRenderer : IDWritePixelSnapping
{
    HRESULT DrawGlyphRun(
        void* client_drawingcontext,
        FLOAT baselineOriginX,
        FLOAT baselineOriginY,
        DWRITE_MEASURING_MODE mode,
        DWRITE_GLYPH_RUN const *glyph_run,
        DWRITE_GLYPH_RUN_DESCRIPTION const *run_descr,
        IUnknown *drawing_effect);

    HRESULT DrawUnderline(
        void *client_drawingcontext,
        FLOAT baselineOriginX,
        FLOAT baselineOriginY,
        DWRITE_UNDERLINE const* underline,
        IUnknown *drawing_effect);

    HRESULT DrawStrikethrough(
        void *client_drawingcontext,
        FLOAT baselineOriginX,
        FLOAT baselineOriginY,
        DWRITE_STRIKETHROUGH const* strikethrough,
        IUnknown *drawing_effect);

    HRESULT DrawInlineObject(
        void *client_drawingcontext,
        FLOAT originX,
        FLOAT originY,
        IDWriteInlineObject *object,
        BOOL is_sideways,
        BOOL is_rtl,
        IUnknown *drawing_effect);
}

[
local,
object,
uuid(8339fde3-106f-47ab-8373-1c6295eb10b3)
]
interface IDWriteInlineObject : IUnknown
{
    HRESULT Draw(
        void* client_drawingontext,
        IDWriteTextRenderer* renderer,
        FLOAT originX,
        FLOAT originY,
        BOOL is_sideways,
        BOOL is_rtl,
        IUnknown *drawing_effect);

    HRESULT GetMetrics(DWRITE_INLINE_OBJECT_METRICS *metrics);
    HRESULT GetOverhangMetrics(DWRITE_OVERHANG_METRICS *overhangs);
    HRESULT GetBreakConditions(
        DWRITE_BREAK_CONDITION* condition_before,
        DWRITE_BREAK_CONDITION* condition_after);
}

[
local,
object,
uuid(9c906818-31d7-4fd3-a151-7c5e225db55a)
]
interface IDWriteTextFormat : IUnknown
{
    HRESULT SetTextAlignment(DWRITE_TEXT_ALIGNMENT alignment);
    HRESULT SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT alignment);
    HRESULT SetWordWrapping(DWRITE_WORD_WRAPPING wrapping);
    HRESULT SetReadingDirection(DWRITE_READING_DIRECTION direction);
    HRESULT SetFlowDirection(DWRITE_FLOW_DIRECTION direction);
    HRESULT SetIncrementalTabStop(FLOAT tabstop);
    HRESULT SetTrimming(DWRITE_TRIMMING const *trimming, IDWriteInlineObject *trimming_sign);
    HRESULT SetLineSpacing(DWRITE_LINE_SPACING_METHOD spacing, FLOAT line_spacing, FLOAT baseline);
    DWRITE_TEXT_ALIGNMENT GetTextAlignment();
    DWRITE_PARAGRAPH_ALIGNMENT GetParagraphAlignment();
    DWRITE_WORD_WRAPPING GetWordWrapping();
    DWRITE_READING_DIRECTION GetReadingDirection();
    DWRITE_FLOW_DIRECTION GetFlowDirection();
    FLOAT GetIncrementalTabStop();
    HRESULT GetTrimming(DWRITE_TRIMMING *options, IDWriteInlineObject **trimming_sign);

    HRESULT GetLineSpacing(
        DWRITE_LINE_SPACING_METHOD *method,
        FLOAT *spacing,
        FLOAT *baseline);

    HRESULT GetFontCollection(IDWriteFontCollection **collection);
    UINT32 GetFontFamilyNameLength();
    HRESULT GetFontFamilyName(WCHAR *name, UINT32 size);
    DWRITE_FONT_WEIGHT GetFontWeight();
    DWRITE_FONT_STYLE GetFontStyle();
    DWRITE_FONT_STRETCH GetFontStretch();
    FLOAT GetFontSize();
    UINT32 GetLocaleNameLength();
    HRESULT GetLocaleName(WCHAR *name, UINT32 size);
}

[
local,
object,
uuid(55f1112b-1dc2-4b3c-9541-f46894ed85b6)
]
interface IDWriteTypography : IUnknown
{
    HRESULT AddFontFeature(DWRITE_FONT_FEATURE feature);
    UINT32 GetFontFeatureCount();
    HRESULT GetFontFeature(UINT32 index, DWRITE_FONT_FEATURE *feature);
}

[
local,
object,
uuid(5e5a32a3-8dff-4773-9ff6-0696eab77267)
]
interface IDWriteBitmapRenderTarget : IUnknown
{
    HRESULT DrawGlyphRun(
        FLOAT baselineOriginX,
        FLOAT baselineOriginY,
        DWRITE_MEASURING_MODE measuring_mode,
        DWRITE_GLYPH_RUN const* glyph_run,
        IDWriteRenderingParams* params,
        COLORREF textColor,
        [defaultvalue(NULL)] RECT *blackbox_rect);

    HDC GetMemoryDC();
    FLOAT GetPixelsPerDip();
    HRESULT SetPixelsPerDip(FLOAT pixels_per_dip);
    HRESULT GetCurrentTransform(DWRITE_MATRIX *transform);
    HRESULT SetCurrentTransform(DWRITE_MATRIX const *transform);
    HRESULT GetSize(SIZE *size);
    HRESULT Resize(UINT32 width, UINT32 height);
}

cpp_quote("#ifndef _WINGDI_")
/* already defined in wingdi.h but needed for WIDL */
#define LF_FACESIZE     32

    typedef struct tagLOGFONTW
    {
        LONG   lfHeight;
        LONG   lfWidth;
        LONG   lfEscapement;
        LONG   lfOrientation;
        LONG   lfWeight;
        BYTE   lfItalic;
        BYTE   lfUnderline;
        BYTE   lfStrikeOut;
        BYTE   lfCharSet;
        BYTE   lfOutPrecision;
        BYTE   lfClipPrecision;
        BYTE   lfQuality;
        BYTE   lfPitchAndFamily;
        WCHAR  lfFaceName[LF_FACESIZE];
    } LOGFONTW, *PLOGFONTW, *LPLOGFONTW;
cpp_quote("#endif /* _WINGDI_ */")

[
local,
object,
uuid(1edd9491-9853-4299-898f-6432983b6f3a)
]
interface IDWriteGdiInterop : IUnknown
{
    HRESULT CreateFontFromLOGFONT(LOGFONTW const *logfont, IDWriteFont **font);
    HRESULT ConvertFontToLOGFONT(
        IDWriteFont* font,
        LOGFONTW* logfont,
        BOOL *is_systemfont);

    HRESULT ConvertFontFaceToLOGFONT(IDWriteFontFace* font, LOGFONTW* logfont);
    HRESULT CreateFontFaceFromHdc(HDC hdc, IDWriteFontFace **fontface);
    HRESULT CreateBitmapRenderTarget(HDC hdc, UINT32 width, UINT32 height, IDWriteBitmapRenderTarget **target);
}

[
local,
object,
uuid(53737037-6d14-410b-9bfe-0b182bb70961)
]
interface IDWriteTextLayout : IDWriteTextFormat
{
    HRESULT SetMaxWidth(FLOAT maxWidth);
    HRESULT SetMaxHeight(FLOAT maxHeight);
    HRESULT SetFontCollection(IDWriteFontCollection* collection, DWRITE_TEXT_RANGE range);
    HRESULT SetFontFamilyName(WCHAR const *name, DWRITE_TEXT_RANGE range);
    HRESULT SetFontWeight(DWRITE_FONT_WEIGHT weight, DWRITE_TEXT_RANGE range);
    HRESULT SetFontStyle(DWRITE_FONT_STYLE style, DWRITE_TEXT_RANGE range);
    HRESULT SetFontStretch(DWRITE_FONT_STRETCH stretch, DWRITE_TEXT_RANGE range);
    HRESULT SetFontSize(FLOAT size, DWRITE_TEXT_RANGE range);
    HRESULT SetUnderline(BOOL underline, DWRITE_TEXT_RANGE range);
    HRESULT SetStrikethrough(BOOL strikethrough, DWRITE_TEXT_RANGE range);
    HRESULT SetDrawingEffect(IUnknown* effect, DWRITE_TEXT_RANGE range);
    HRESULT SetInlineObject(IDWriteInlineObject *object, DWRITE_TEXT_RANGE range);
    HRESULT SetTypography(IDWriteTypography* typography, DWRITE_TEXT_RANGE range);
    HRESULT SetLocaleName(WCHAR const* locale, DWRITE_TEXT_RANGE range);

    FLOAT GetMaxWidth();
    FLOAT GetMaxHeight();
    HRESULT GetFontCollection(
        UINT32 pos,
        IDWriteFontCollection** collection,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT GetFontFamilyNameLength(
        UINT32 pos,
        UINT32* len,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT GetFontFamilyName(
        UINT32 position,
        WCHAR* name,
        UINT32 name_size,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT GetFontWeight(
        UINT32 position,
        DWRITE_FONT_WEIGHT *weight,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT GetFontStyle(
        UINT32 currentPosition,
        DWRITE_FONT_STYLE *style,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT GetFontStretch(
        UINT32 position,
        DWRITE_FONT_STRETCH *stretch,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT GetFontSize(
        UINT32 position,
        FLOAT *size,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT GetUnderline(
        UINT32 position,
        BOOL *has_underline,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT GetStrikethrough(
        UINT32 position,
        BOOL *has_strikethrough,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT GetDrawingEffect(
        UINT32 position,
        IUnknown **effect,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT GetInlineObject(
        UINT32 position,
        IDWriteInlineObject **object,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT GetTypography(
        UINT32 position,
        IDWriteTypography** typography,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT GetLocaleNameLength(
        UINT32 position,
        UINT32* length,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT GetLocaleName(
        UINT32 position,
        WCHAR* name,
        UINT32 name_size,
        [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);

    HRESULT Draw(
        void *context,
        IDWriteTextRenderer* renderer,
        FLOAT originX,
        FLOAT originY);

    HRESULT GetLineMetrics(
        DWRITE_LINE_METRICS *metrics,
        UINT32 max_count,
        UINT32 *actual_count);

    HRESULT GetMetrics(DWRITE_TEXT_METRICS *metrics);
    HRESULT GetOverhangMetrics(DWRITE_OVERHANG_METRICS *overhangs);
    HRESULT GetClusterMetrics(
        DWRITE_CLUSTER_METRICS *metrics,
        UINT32 max_count,
        UINT32* act_count);

    HRESULT DetermineMinWidth(FLOAT* min_width);
    HRESULT HitTestPoint(
        FLOAT pointX,
        FLOAT pointY,
        BOOL* is_trailinghit,
        BOOL* is_inside,
        DWRITE_HIT_TEST_METRICS *metrics);

    HRESULT HitTestTextPosition(
        UINT32 textPosition,
        BOOL is_trailinghit,
        FLOAT* pointX,
        FLOAT* pointY,
        DWRITE_HIT_TEST_METRICS *metrics);

    HRESULT HitTestTextRange(
        UINT32 textPosition,
        UINT32 textLength,
        FLOAT originX,
        FLOAT originY,
        DWRITE_HIT_TEST_METRICS *metrics,
        UINT32 max_metricscount,
        UINT32* actual_metricscount);
}

[
local,
object,
uuid(14885cc9-bab0-4f90-b6ed-5c366a2cd03d)
]
interface IDWriteNumberSubstitution : IUnknown
{
}

[
local,
object,
uuid(688e1a58-5094-47c8-adc8-fbcea60ae92b)
]
interface IDWriteTextAnalysisSource : IUnknown
{
    HRESULT GetTextAtPosition(
        UINT32 position,
        WCHAR const** text,
        UINT32* text_len);

    HRESULT GetTextBeforePosition(
        UINT32 position,
        WCHAR const** text,
        UINT32* text_len);

    DWRITE_READING_DIRECTION GetParagraphReadingDirection();
    HRESULT GetLocaleName(
        UINT32 position,
        UINT32* text_len,
        WCHAR const** locale);

    HRESULT GetNumberSubstitution(
        UINT32 position,
        UINT32* text_len,
        IDWriteNumberSubstitution **substitution);
}

[
local,
object,
uuid(5810cd44-0ca0-4701-b3fa-bec5182ae4f6)
]
interface IDWriteTextAnalysisSink : IUnknown
{
    HRESULT SetScriptAnalysis(
        UINT32 position,
        UINT32 length,
        DWRITE_SCRIPT_ANALYSIS const* scriptanalysis);

    HRESULT SetLineBreakpoints(
        UINT32 position,
        UINT32 length,
        DWRITE_LINE_BREAKPOINT const* breakpoints);

    HRESULT SetBidiLevel(
        UINT32 position,
        UINT32 length,
        UINT8 explicitLevel,
        UINT8 resolvedLevel);

    HRESULT SetNumberSubstitution(
        UINT32 position,
        UINT32 length,
        IDWriteNumberSubstitution* substitution);
}

[
local,
object,
uuid(b7e6163e-7f46-43b4-84b3-e4e6249c365d)
]
interface IDWriteTextAnalyzer : IUnknown
{
    HRESULT AnalyzeScript(
        IDWriteTextAnalysisSource* source,
        UINT32 position,
        UINT32 length,
        IDWriteTextAnalysisSink* sink);

    HRESULT AnalyzeBidi(
        IDWriteTextAnalysisSource* source,
        UINT32 position,
        UINT32 length,
        IDWriteTextAnalysisSink* sink);

    HRESULT AnalyzeNumberSubstitution(
        IDWriteTextAnalysisSource* source,
        UINT32 position,
        UINT32 length,
        IDWriteTextAnalysisSink* sink);

    HRESULT AnalyzeLineBreakpoints(
        IDWriteTextAnalysisSource* source,
        UINT32 position,
        UINT32 length,
        IDWriteTextAnalysisSink* sink);

    HRESULT GetGlyphs(
        WCHAR const* text,
        UINT32 length,
        IDWriteFontFace* font_face,
        BOOL is_sideways,
        BOOL is_rtl,
        DWRITE_SCRIPT_ANALYSIS const* analysis,
        WCHAR const* locale,
        IDWriteNumberSubstitution* substitution,
        DWRITE_TYPOGRAPHIC_FEATURES const** features,
        UINT32 const* feature_range_len,
        UINT32 feature_ranges,
        UINT32 max_glyph_count,
        UINT16* clustermap,
        DWRITE_SHAPING_TEXT_PROPERTIES* text_props,
        UINT16* glyph_indices,
        DWRITE_SHAPING_GLYPH_PROPERTIES* glyph_props,
        UINT32* actual_glyph_count);

    HRESULT GetGlyphPlacements(
        WCHAR const* text,
        UINT16 const* clustermap,
        DWRITE_SHAPING_TEXT_PROPERTIES* props,
        UINT32 text_len,
        UINT16 const* glyph_indices,
        DWRITE_SHAPING_GLYPH_PROPERTIES const* glyph_props,
        UINT32 glyph_count,
        IDWriteFontFace * font_face,
        FLOAT fontEmSize,
        BOOL is_sideways,
        BOOL is_rtl,
        DWRITE_SCRIPT_ANALYSIS const* analysis,
        WCHAR const* locale,
        DWRITE_TYPOGRAPHIC_FEATURES const** features,
        UINT32 const* feature_range_len,
        UINT32 feature_ranges,
        FLOAT* glyph_advances,
        DWRITE_GLYPH_OFFSET* glyph_offsets);

    HRESULT GetGdiCompatibleGlyphPlacements(
        WCHAR const* text,
        UINT16 const* clustermap,
        DWRITE_SHAPING_TEXT_PROPERTIES* props,
        UINT32 text_len,
        UINT16 const* glyph_indices,
        DWRITE_SHAPING_GLYPH_PROPERTIES const* glyph_props,
        UINT32 glyph_count,
        IDWriteFontFace * font_face,
        FLOAT fontEmSize,
        FLOAT pixels_per_dip,
        DWRITE_MATRIX const* transform,
        BOOL use_gdi_natural,
        BOOL is_sideways,
        BOOL is_rtl,
        DWRITE_SCRIPT_ANALYSIS const* analysis,
        WCHAR const* locale,
        DWRITE_TYPOGRAPHIC_FEATURES const** features,
        UINT32 const* feature_range_lengths,
        UINT32 feature_ranges,
        FLOAT* glyph_advances,
        DWRITE_GLYPH_OFFSET* glyph_offsets);
}

[
local,
object,
uuid(7d97dbf7-e085-42d4-81e3-6a883bded118)
]
interface IDWriteGlyphRunAnalysis : IUnknown
{
    HRESULT GetAlphaTextureBounds(DWRITE_TEXTURE_TYPE type, RECT* bounds);
    HRESULT CreateAlphaTexture(DWRITE_TEXTURE_TYPE type, RECT const* bounds, BYTE* alphaValues, UINT32 bufferSize);
    HRESULT GetAlphaBlendParams(
        IDWriteRenderingParams* renderingParams,
        FLOAT* blendGamma,
        FLOAT* blendEnhancedContrast,
        FLOAT* blendClearTypeLevel);
}

[
local,
object,
uuid(b859ee5a-d838-4b5b-a2e8-1adc7d93db48)
]
interface IDWriteFactory : IUnknown
{
    HRESULT GetSystemFontCollection(IDWriteFontCollection **collection,
                                    [defaultvalue(FALSE)] BOOL check_for_updates);

    HRESULT CreateCustomFontCollection(
        IDWriteFontCollectionLoader *loader,
        void const *key,
        UINT32 key_size,
        IDWriteFontCollection **collection);

    HRESULT RegisterFontCollectionLoader(IDWriteFontCollectionLoader *loader);

    HRESULT UnregisterFontCollectionLoader(IDWriteFontCollectionLoader *loader);

    HRESULT CreateFontFileReference(
        WCHAR const *path,
        FILETIME const *writetime,
        IDWriteFontFile **font_file);

    HRESULT CreateCustomFontFileReference(
        void const *reference_key,
        UINT32 key_size,
        IDWriteFontFileLoader *loader,
        IDWriteFontFile **font_file);

    HRESULT CreateFontFace(
        DWRITE_FONT_FACE_TYPE facetype,
        UINT32 files_number,
        IDWriteFontFile* const* font_files,
        UINT32 index,
        DWRITE_FONT_SIMULATIONS sim_flags,
        IDWriteFontFace **font_face);

    HRESULT CreateRenderingParams(IDWriteRenderingParams **params);

    HRESULT CreateMonitorRenderingParams(
        HMONITOR monitor,
        IDWriteRenderingParams **params);

    HRESULT CreateCustomRenderingParams(
        FLOAT gamma,
        FLOAT enhancedContrast,
        FLOAT cleartype_level,
        DWRITE_PIXEL_GEOMETRY geometry,
        DWRITE_RENDERING_MODE mode,
        IDWriteRenderingParams **params);

    HRESULT RegisterFontFileLoader(IDWriteFontFileLoader *loader);

    HRESULT UnregisterFontFileLoader(IDWriteFontFileLoader *loader);

    HRESULT CreateTextFormat(
        WCHAR const* family_name,
        IDWriteFontCollection *collection,
        DWRITE_FONT_WEIGHT weight,
        DWRITE_FONT_STYLE style,
        DWRITE_FONT_STRETCH stretch,
        FLOAT size,
        WCHAR const *locale,
        IDWriteTextFormat **format);

    HRESULT CreateTypography(IDWriteTypography **typography);

    HRESULT GetGdiInterop(IDWriteGdiInterop **gdi_interop);

    HRESULT CreateTextLayout(
        WCHAR const* string,
        UINT32 len,
        IDWriteTextFormat *format,
        FLOAT max_width,
        FLOAT max_height,
        IDWriteTextLayout **layout);

    HRESULT CreateGdiCompatibleTextLayout(
        WCHAR const* string,
        UINT32 len,
        IDWriteTextFormat *format,
        FLOAT layout_width,
        FLOAT layout_height,
        FLOAT pixels_per_dip,
        DWRITE_MATRIX const* transform,
        BOOL use_gdi_natural,
        IDWriteTextLayout **layout);

    HRESULT CreateEllipsisTrimmingSign(
        IDWriteTextFormat *format,
        IDWriteInlineObject **trimming_sign);

    HRESULT CreateTextAnalyzer(IDWriteTextAnalyzer **analyzer);

    HRESULT CreateNumberSubstitution(
        DWRITE_NUMBER_SUBSTITUTION_METHOD method,
        WCHAR const* locale,
        BOOL ignore_user_override,
        IDWriteNumberSubstitution **substitution);

    HRESULT CreateGlyphRunAnalysis(
        DWRITE_GLYPH_RUN const *glyph_run,
        FLOAT pixels_per_dip,
        DWRITE_MATRIX const* transform,
        DWRITE_RENDERING_MODE rendering_mode,
        DWRITE_MEASURING_MODE measuring_mode,
        FLOAT baseline_x,
        FLOAT baseline_y,
        IDWriteGlyphRunAnalysis **analysis);
}

cpp_quote("HRESULT WINAPI DWriteCreateFactory(DWRITE_FACTORY_TYPE,REFIID,IUnknown**);")

/* error codes */
cpp_quote("#define FACILITY_DWRITE 0x898")
cpp_quote("#define DWRITE_ERR_BASE 0x5000")
cpp_quote("#define MAKE_DWRITE_HR(severity, code) MAKE_HRESULT(severity, FACILITY_DWRITE, (DWRITE_ERR_BASE + code))")
cpp_quote("#define MAKE_DWRITE_HR_ERR(code) MAKE_DWRITE_HR(SEVERITY_ERROR, code)")