unit DX12.DWrite;

{$MODE delphi}{$H+}

interface

{$Z4}

uses
    Windows, DX12.DCommon, DX12.D3DCommon, DX12.DXGI;

const
    DWRITE_DLL = 'DWrite.dll';
    DWRITE_ALPHA_MAX = 255;

const
    IID_IDWriteFontFileLoader: TGUID = '{727cad4e-d6af-4c9e-8a08-d695b11caa49}';
    IID_IDWriteLocalFontFileLoader: TGUID = '{b2d9f3ec-c9fe-4a11-a2ec-d86208f7c0a2}';
    IID_IDWriteFontFileStream: TGUID = '{6d4865fe-0ab8-4d91-8f62-5dd6be34a3e0}';
    IID_IDWriteFontFile: TGUID = '{739d886a-cef5-47dc-8769-1a8b41bebbb0}';
    IID_IDWriteRenderingParams: TGUID = '{2f0da53a-2add-47cd-82ee-d9ec34688e75}';
    IID_IDWriteFontFace: TGUID = '{5f49804d-7024-4d43-bfa9-d25984f53849}';
    IID_IDWriteFontCollectionLoader: TGUID = '{cca920e4-52f0-492b-bfa8-29c72ee0a468}';
    IID_IDWriteFontFileEnumerator: TGUID = '{72755049-5ff7-435d-8348-4be97cfa6c7c}';
    IID_IDWriteLocalizedStrings: TGUID = '{08256209-099a-4b34-b86d-c22b110e7771}';
    IID_IDWriteFontCollection: TGUID = '{a84cee02-3eea-4eee-a827-87c1a02a0fcc}';
    IID_IDWriteFontList: TGUID = '{1a0d8438-1d97-4ec1-aef9-a2fb86ed6acb}';
    IID_IDWriteFontFamily: TGUID = '{da20d8ef-812a-4c43-9802-62ec4abd7add}';
    IID_IDWriteFont: TGUID = '{acd16696-8c14-4f5d-877e-fe3fc1d32737}';
    IID_IDWriteTextFormat: TGUID = '{9c906818-31d7-4fd3-a151-7c5e225db55a}';
    IID_IDWriteTypography: TGUID = '{55f1112b-1dc2-4b3c-9541-f46894ed85b6}';
    IID_IDWriteNumberSubstitution: TGUID = '{14885CC9-BAB0-4f90-B6ED-5C366A2CD03D}';
    IID_IDWriteTextAnalysisSource: TGUID = '{688e1a58-5094-47c8-adc8-fbcea60ae92b}';
    IID_IDWriteTextAnalysisSink: TGUID = '{5810cd44-0ca0-4701-b3fa-bec5182ae4f6}';
    IID_IDWriteTextAnalyzer: TGUID = '{b7e6163e-7f46-43b4-84b3-e4e6249c365d}';
    IID_IDWriteInlineObject: TGUID = '{8339FDE3-106F-47ab-8373-1C6295EB10B3}';
    IID_IDWritePixelSnapping: TGUID = '{eaf3a2da-ecf4-4d24-b644-b34f6842024b}';
    IID_IDWriteTextRenderer: TGUID = '{ef8a8135-5cc6-45fe-8825-c5a0724eb819}';
    IID_IDWriteTextLayout: TGUID = '{53737037-6d14-410b-9bfe-0b182bb70961}';
    IID_IDWriteBitmapRenderTarget: TGUID = '{5e5a32a3-8dff-4773-9ff6-0696eab77267}';
    IID_IDWriteGdiInterop: TGUID = '{1edd9491-9853-4299-898f-6432983b6f3a}';
    IID_IDWriteGlyphRunAnalysis: TGUID = '{7d97dbf7-e085-42d4-81e3-6a883bded118}';
    IID_IDWriteFactory: TGUID = '{b859ee5a-d838-4b5b-a2e8-1adc7d93db48}';


const
    {DWrite1.h}
    IID_IDWriteFactory1: TGUID = '{30572f99-dac6-41db-a16e-0486307e606a}';
    IID_IDWriteFontFace1: TGUID = '{a71efdb4-9fdb-4838-ad90-cfc3be8c3daf}';
    IID_IDWriteFont1: TGUID = '{acd16696-8c14-4f5d-877e-fe3fc1d32738}';
    IID_IDWriteRenderingParams1: TGUID = '{94413cf4-a6fc-4248-8b50-6674348fcad3}';
    IID_IDWriteTextAnalyzer1: TGUID = '{80DAD800-E21F-4E83-96CE-BFCCE500DB7C}';
    IID_IDWriteTextAnalysisSource1: TGUID = '{639CFAD8-0FB4-4B21-A58A-067920120009}';
    IID_IDWriteTextAnalysisSink1: TGUID = '{B0D941A0-85E7-4D8B-9FD3-5CED9934482A}';
    IID_IDWriteTextLayout1: TGUID = '{9064D822-80A7-465C-A986-DF65F78B8FEB}';
    IID_IDWriteBitmapRenderTarget1: TGUID = '{791e8298-3ef3-4230-9880-c9bdecc42064}';


const
    {DWrite2.h}
    IID_IDWriteTextRenderer1: TGUID = '{D3E0E934-22A0-427E-AAE4-7D9574B59DB1}';
    IID_IDWriteTextFormat1: TGUID = '{5F174B49-0D8B-4CFB-8BCA-F1CCE9D06C67}';
    IID_IDWriteTextLayout2: TGUID = '{1093C18F-8D5E-43F0-B064-0917311B525E}';
    IID_IDWriteTextAnalyzer2: TGUID = '{553A9FF3-5693-4DF7-B52B-74806F7F2EB9}';
    IID_IDWriteFontFallback: TGUID = '{EFA008F9-F7A1-48BF-B05C-F224713CC0FF}';
    IID_IDWriteFontFallbackBuilder: TGUID = '{FD882D06-8ABA-4FB8-B849-8BE8B73E14DE}';
    IID_IDWriteFont2: TGUID = '{29748ed6-8c9c-4a6a-be0b-d912e8538944}';
    IID_IDWriteFontFace2: TGUID = '{d8b768ff-64bc-4e66-982b-ec8e87f693f7}';
    IID_IDWriteColorGlyphRunEnumerator: TGUID = '{d31fbe17-f157-41a2-8d24-cb779e0560e8}';
    IID_IDWriteRenderingParams2: TGUID = '{F9D711C3-9777-40AE-87E8-3E5AF9BF0948}';
    IID_IDWriteFactory2: TGUID = '{0439fc60-ca44-4994-8dee-3a9af7b732ec}';




type
    {$IFNDEF FPC}
    LONG = longint;
    SIZE_T = ULONG_PTR;
    HMONITOR = THANDLE;
    pUInt16 = PWord;
    pUInt32 = PDWord;
    pInt32 = PLongint;
    pUInt8 = PByte;
    {$ENDIF}


    TDWRITE_FONT_FILE_TYPE = (DWRITE_FONT_FILE_TYPE_UNKNOWN, DWRITE_FONT_FILE_TYPE_CFF, DWRITE_FONT_FILE_TYPE_TRUETYPE,
        DWRITE_FONT_FILE_TYPE_OPENTYPE_COLLECTION,
        DWRITE_FONT_FILE_TYPE_TYPE1_PFM, DWRITE_FONT_FILE_TYPE_TYPE1_PFB, DWRITE_FONT_FILE_TYPE_VECTOR,
        DWRITE_FONT_FILE_TYPE_BITMAP,
        // The following name is obsolete, but kept as an alias to avoid breaking existing code.
        DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION = DWRITE_FONT_FILE_TYPE_OPENTYPE_COLLECTION);

    TDWRITE_FONT_FACE_TYPE = (DWRITE_FONT_FACE_TYPE_CFF, DWRITE_FONT_FACE_TYPE_TRUETYPE, DWRITE_FONT_FACE_TYPE_OPENTYPE_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,
        // The following name is obsolete, but kept as an alias to avoid breaking existing code.
        DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION = DWRITE_FONT_FACE_TYPE_OPENTYPE_COLLECTION);

    TDWRITE_FONT_SIMULATIONS = (DWRITE_FONT_SIMULATIONS_NONE = $0000, DWRITE_FONT_SIMULATIONS_BOLD = $0001, DWRITE_FONT_SIMULATIONS_OBLIQUE = $0002);


    TDWRITE_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_SEMI_LIGHT = 350, 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);

    TDWRITE_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);

    TDWRITE_FONT_STYLE = (DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STYLE_OBLIQUE, DWRITE_FONT_STYLE_ITALIC);

    TDWRITE_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_TYPOGRAPHIC_FAMILY_NAMES,
        DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_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_WEIGHT_STRETCH_STYLE_FAMILY_NAME, DWRITE_INFORMATIONAL_STRING_DESIGN_SCRIPT_LANGUAGE_TAG,
        DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG,

        // Obsolete aliases kept to avoid breaking existing code.
        DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES = DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_FAMILY_NAMES,
        DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES = DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_SUBFAMILY_NAMES,
        DWRITE_INFORMATIONAL_STRING_WWS_FAMILY_NAME = DWRITE_INFORMATIONAL_STRING_WEIGHT_STRETCH_STYLE_FAMILY_NAME

        );

    TDWRITE_FONT_METRICS = record
        designUnitsPerEm: UINT16;
        ascent: UINT16;
        descent: UINT16;
        lineGap: INT16;
        capHeight: UINT16;
        xHeight: UINT16;
        underlinePosition: INT16;
        underlineThickness: UINT16;
        strikethroughPosition: INT16;
        strikethroughThickness: UINT16;
    end;

    TDWRITE_GLYPH_METRICS = record
        leftSideBearing: INT32;
        advanceWidth: UINT32;
        rightSideBearing: INT32;
        topSideBearing: INT32;
        advanceHeight: UINT32;
        bottomSideBearing: INT32;
        verticalOriginY: INT32;
    end;
    PDWRITE_GLYPH_METRICS = ^TDWRITE_GLYPH_METRICS;

    TDWRITE_GLYPH_OFFSET = record
        advanceOffset: single;
        ascenderOffset: single;
    end;
    PDWRITE_GLYPH_OFFSET = ^TDWRITE_GLYPH_OFFSET;

    TDWRITE_FACTORY_TYPE = (DWRITE_FACTORY_TYPE_SHARED, DWRITE_FACTORY_TYPE_ISOLATED);


    TDWRITE_PIXEL_GEOMETRY = (
        DWRITE_PIXEL_GEOMETRY_FLAT,
        DWRITE_PIXEL_GEOMETRY_RGB,
        DWRITE_PIXEL_GEOMETRY_BGR);


    TDWRITE_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);

    TDWRITE_MATRIX = record
        m11: single;
        m12: single;
        m21: single;
        m22: single;
        dx: single;
        dy: single;
    end;
    PDWRITE_MATRIX = ^TDWRITE_MATRIX;

    TDWRITE_READING_DIRECTION = (
        DWRITE_READING_DIRECTION_LEFT_TO_RIGHT = 0,
        DWRITE_READING_DIRECTION_RIGHT_TO_LEFT = 1,
        DWRITE_READING_DIRECTION_TOP_TO_BOTTOM = 2,
        DWRITE_READING_DIRECTION_BOTTOM_TO_TOP = 3);


    TDWRITE_FLOW_DIRECTION = (
        DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM = 0,
        DWRITE_FLOW_DIRECTION_BOTTOM_TO_TOP = 1,
        DWRITE_FLOW_DIRECTION_LEFT_TO_RIGHT = 2,
        DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT = 3);

    TDWRITE_TEXT_ALIGNMENT = (
        DWRITE_TEXT_ALIGNMENT_LEADING,
        DWRITE_TEXT_ALIGNMENT_TRAILING,
        DWRITE_TEXT_ALIGNMENT_CENTER,
        DWRITE_TEXT_ALIGNMENT_JUSTIFIED);

    TDWRITE_PARAGRAPH_ALIGNMENT = (
        DWRITE_PARAGRAPH_ALIGNMENT_NEAR,
        DWRITE_PARAGRAPH_ALIGNMENT_FAR,
        DWRITE_PARAGRAPH_ALIGNMENT_CENTER);

    TDWRITE_WORD_WRAPPING = (
        DWRITE_WORD_WRAPPING_WRAP = 0,
        DWRITE_WORD_WRAPPING_NO_WRAP = 1,
        DWRITE_WORD_WRAPPING_EMERGENCY_BREAK = 2,
        DWRITE_WORD_WRAPPING_WHOLE_WORD = 3,
        DWRITE_WORD_WRAPPING_CHARACTER = 4);

    TDWRITE_LINE_SPACING_METHOD = (
        DWRITE_LINE_SPACING_METHOD_DEFAULT,
        DWRITE_LINE_SPACING_METHOD_UNIFORM);

    TDWRITE_TRIMMING_GRANULARITY = (

        DWRITE_TRIMMING_GRANULARITY_NONE,
        DWRITE_TRIMMING_GRANULARITY_CHARACTER,
        DWRITE_TRIMMING_GRANULARITY_WORD);


    TDWRITE_FONT_FEATURE_TAG = (
        DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS = $63726661, // 'afrc'
        DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS = $63703263, // 'c2pc'
        DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS = $63733263, // 'c2sc'
        DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES = $746c6163, // 'calt'
        DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS = $65736163, // 'case'
        DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION = $706d6363, // 'ccmp'
        DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES = $67696c63, // 'clig'
        DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING = $70737063, // 'cpsp'
        DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH = $68777363, // 'cswh'
        DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING = $73727563, // 'curs'
        DWRITE_FONT_FEATURE_TAG_DEFAULT = $746c6664, // 'dflt'
        DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES = $67696c64, // 'dlig'
        DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS = $74707865, // 'expt'
        DWRITE_FONT_FEATURE_TAG_FRACTIONS = $63617266, // 'frac'
        DWRITE_FONT_FEATURE_TAG_FULL_WIDTH = $64697766, // 'fwid'
        DWRITE_FONT_FEATURE_TAG_HALF_FORMS = $666c6168, // 'half'
        DWRITE_FONT_FEATURE_TAG_HALANT_FORMS = $6e6c6168, // 'haln'
        DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH = $746c6168, // 'halt'
        DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS = $74736968, // 'hist'
        DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES = $616e6b68, // 'hkna'
        DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES = $67696c68, // 'hlig'
        DWRITE_FONT_FEATURE_TAG_HALF_WIDTH = $64697768, // 'hwid'
        DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS = $6f6a6f68, // 'hojo'
        DWRITE_FONT_FEATURE_TAG_JIS04_FORMS = $3430706a, // 'jp04'
        DWRITE_FONT_FEATURE_TAG_JIS78_FORMS = $3837706a, // 'jp78'
        DWRITE_FONT_FEATURE_TAG_JIS83_FORMS = $3338706a, // 'jp83'
        DWRITE_FONT_FEATURE_TAG_JIS90_FORMS = $3039706a, // 'jp90'
        DWRITE_FONT_FEATURE_TAG_KERNING = $6e72656b, // 'kern'
        DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES = $6167696c, // 'liga'
        DWRITE_FONT_FEATURE_TAG_LINING_FIGURES = $6d756e6c, // 'lnum'
        DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS = $6c636f6c, // 'locl'
        DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING = $6b72616d, // 'mark'
        DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK = $6b72676d, // 'mgrk'
        DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING = $6b6d6b6d, // 'mkmk'
        DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS = $746c616e, // 'nalt'
        DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS = $6b636c6e, // 'nlck'
        DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES = $6d756e6f, // 'onum'
        DWRITE_FONT_FEATURE_TAG_ORDINALS = $6e64726f, // 'ordn'
        DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH = $746c6170, // 'palt'
        DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS = $70616370, // 'pcap'
        DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES = $6d756e70, // 'pnum'
        DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS = $64697770, // 'pwid'
        DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS = $64697771, // 'qwid'
        DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES = $67696c72, // 'rlig'
        DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS = $79627572, // 'ruby'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES = $746c6173, // 'salt'
        DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS = $666e6973, // 'sinf'
        DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS = $70636d73, // 'smcp'
        DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS = $6c706d73, // 'smpl'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1 = $31307373, // 'ss01'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2 = $32307373, // 'ss02'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3 = $33307373, // 'ss03'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4 = $34307373, // 'ss04'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5 = $35307373, // 'ss05'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6 = $36307373, // 'ss06'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7 = $37307373, // 'ss07'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8 = $38307373, // 'ss08'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9 = $39307373, // 'ss09'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10 = $30317373, // 'ss10'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11 = $31317373, // 'ss11'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12 = $32317373, // 'ss12'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13 = $33317373, // 'ss13'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14 = $34317373, // 'ss14'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15 = $35317373, // 'ss15'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16 = $36317373, // 'ss16'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17 = $37317373, // 'ss17'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18 = $38317373, // 'ss18'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19 = $39317373, // 'ss19'
        DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20 = $30327373, // 'ss20'
        DWRITE_FONT_FEATURE_TAG_SUBSCRIPT = $73627573, // 'subs'
        DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT = $73707573, // 'sups'
        DWRITE_FONT_FEATURE_TAG_SWASH = $68737773, // 'swsh'
        DWRITE_FONT_FEATURE_TAG_TITLING = $6c746974, // 'titl'
        DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS = $6d616e74, // 'tnam'
        DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES = $6d756e74, // 'tnum'
        DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS = $64617274, // 'trad'
        DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS = $64697774, // 'twid'
        DWRITE_FONT_FEATURE_TAG_UNICASE = $63696e75, // 'unic'
        DWRITE_FONT_FEATURE_TAG_VERTICAL_WRITING = $74726576, // 'vert'
        DWRITE_FONT_FEATURE_TAG_VERTICAL_ALTERNATES_AND_ROTATION = $32747276, // 'vrt2'
        DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO = $6f72657a // 'zero'
        );

    PDWRITE_FONT_FEATURE_TAG = ^TDWRITE_FONT_FEATURE_TAG;

    TDWRITE_TEXT_RANGE = record
        startPosition: UINT32;
        length: UINT32;
    end;

    PDWRITE_TEXT_RANGE = ^TDWRITE_TEXT_RANGE;


    TDWRITE_FONT_FEATURE = record
        nameTag: TDWRITE_FONT_FEATURE_TAG;
        parameter: UINT32;
    end;

    PDWRITE_FONT_FEATURE = TDWRITE_FONT_FEATURE;


    TDWRITE_TYPOGRAPHIC_FEATURES = record
        features: PDWRITE_FONT_FEATURE;
        featureCount: UINT32;
    end;
    PDWRITE_TYPOGRAPHIC_FEATURES = ^TDWRITE_TYPOGRAPHIC_FEATURES;

    TDWRITE_TRIMMING = record
        granularity: TDWRITE_TRIMMING_GRANULARITY;
        delimiter: UINT32;
        delimiterCount: UINT32;
    end;

    PDWRITE_TRIMMING = ^TDWRITE_TRIMMING;


    TDWRITE_SCRIPT_SHAPES = (
        DWRITE_SCRIPT_SHAPES_DEFAULT = 0,
        DWRITE_SCRIPT_SHAPES_NO_VISUAL = 1);

    TDWRITE_SCRIPT_ANALYSIS = record
        script: UINT16;
        shapes: TDWRITE_SCRIPT_SHAPES;
    end;

    PDWRITE_SCRIPT_ANALYSIS = ^TDWRITE_SCRIPT_ANALYSIS;

    TDWRITE_BREAK_CONDITION = (
        DWRITE_BREAK_CONDITION_NEUTRAL,
        DWRITE_BREAK_CONDITION_CAN_BREAK,
        DWRITE_BREAK_CONDITION_MAY_NOT_BREAK,
        DWRITE_BREAK_CONDITION_MUST_BREAK);


    TDWRITE_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);


    {DWrite1.h}
    TDWRITE_PANOSE_FAMILY = (
        DWRITE_PANOSE_FAMILY_ANY = 0,
        DWRITE_PANOSE_FAMILY_NO_FIT = 1,
        DWRITE_PANOSE_FAMILY_TEXT_DISPLAY = 2,
        DWRITE_PANOSE_FAMILY_SCRIPT = 3, // or hand written
        DWRITE_PANOSE_FAMILY_DECORATIVE = 4,
        DWRITE_PANOSE_FAMILY_SYMBOL = 5, // or symbol
        DWRITE_PANOSE_FAMILY_PICTORIAL = DWRITE_PANOSE_FAMILY_SYMBOL);


    TDWRITE_PANOSE_SERIF_STYLE = (
        DWRITE_PANOSE_SERIF_STYLE_ANY = 0,
        DWRITE_PANOSE_SERIF_STYLE_NO_FIT = 1,
        DWRITE_PANOSE_SERIF_STYLE_COVE = 2,
        DWRITE_PANOSE_SERIF_STYLE_OBTUSE_COVE = 3,
        DWRITE_PANOSE_SERIF_STYLE_SQUARE_COVE = 4,
        DWRITE_PANOSE_SERIF_STYLE_OBTUSE_SQUARE_COVE = 5,
        DWRITE_PANOSE_SERIF_STYLE_SQUARE = 6,
        DWRITE_PANOSE_SERIF_STYLE_THIN = 7,
        DWRITE_PANOSE_SERIF_STYLE_OVAL = 8,
        DWRITE_PANOSE_SERIF_STYLE_EXAGGERATED = 9,
        DWRITE_PANOSE_SERIF_STYLE_TRIANGLE = 10,
        DWRITE_PANOSE_SERIF_STYLE_NORMAL_SANS = 11,
        DWRITE_PANOSE_SERIF_STYLE_OBTUSE_SANS = 12,
        DWRITE_PANOSE_SERIF_STYLE_PERPENDICULAR_SANS = 13,
        DWRITE_PANOSE_SERIF_STYLE_FLARED = 14,
        DWRITE_PANOSE_SERIF_STYLE_ROUNDED = 15,
        DWRITE_PANOSE_SERIF_STYLE_SCRIPT = 16,
        DWRITE_PANOSE_SERIF_STYLE_PERP_SANS = DWRITE_PANOSE_SERIF_STYLE_PERPENDICULAR_SANS,
        DWRITE_PANOSE_SERIF_STYLE_BONE = DWRITE_PANOSE_SERIF_STYLE_OVAL);

    TDWRITE_PANOSE_WEIGHT = (
        DWRITE_PANOSE_WEIGHT_ANY = 0,
        DWRITE_PANOSE_WEIGHT_NO_FIT = 1,
        DWRITE_PANOSE_WEIGHT_VERY_LIGHT = 2,
        DWRITE_PANOSE_WEIGHT_LIGHT = 3,
        DWRITE_PANOSE_WEIGHT_THIN = 4,
        DWRITE_PANOSE_WEIGHT_BOOK = 5,
        DWRITE_PANOSE_WEIGHT_MEDIUM = 6,
        DWRITE_PANOSE_WEIGHT_DEMI = 7,
        DWRITE_PANOSE_WEIGHT_BOLD = 8,
        DWRITE_PANOSE_WEIGHT_HEAVY = 9,
        DWRITE_PANOSE_WEIGHT_BLACK = 10,
        DWRITE_PANOSE_WEIGHT_EXTRA_BLACK = 11,
        DWRITE_PANOSE_WEIGHT_NORD = DWRITE_PANOSE_WEIGHT_EXTRA_BLACK);


    TDWRITE_PANOSE_PROPORTION = (
        DWRITE_PANOSE_PROPORTION_ANY = 0,
        DWRITE_PANOSE_PROPORTION_NO_FIT = 1,
        DWRITE_PANOSE_PROPORTION_OLD_STYLE = 2,
        DWRITE_PANOSE_PROPORTION_MODERN = 3,
        DWRITE_PANOSE_PROPORTION_EVEN_WIDTH = 4,
        DWRITE_PANOSE_PROPORTION_EXPANDED = 5,
        DWRITE_PANOSE_PROPORTION_CONDENSED = 6,
        DWRITE_PANOSE_PROPORTION_VERY_EXPANDED = 7,
        DWRITE_PANOSE_PROPORTION_VERY_CONDENSED = 8,
        DWRITE_PANOSE_PROPORTION_MONOSPACED = 9);
    TDWRITE_PANOSE_CONTRAST = (
        DWRITE_PANOSE_CONTRAST_ANY = 0,
        DWRITE_PANOSE_CONTRAST_NO_FIT = 1,
        DWRITE_PANOSE_CONTRAST_NONE = 2,
        DWRITE_PANOSE_CONTRAST_VERY_LOW = 3,
        DWRITE_PANOSE_CONTRAST_LOW = 4,
        DWRITE_PANOSE_CONTRAST_MEDIUM_LOW = 5,
        DWRITE_PANOSE_CONTRAST_MEDIUM = 6,
        DWRITE_PANOSE_CONTRAST_MEDIUM_HIGH = 7,
        DWRITE_PANOSE_CONTRAST_HIGH = 8,
        DWRITE_PANOSE_CONTRAST_VERY_HIGH = 9,
        DWRITE_PANOSE_CONTRAST_HORIZONTAL_LOW = 10,
        DWRITE_PANOSE_CONTRAST_HORIZONTAL_MEDIUM = 11,
        DWRITE_PANOSE_CONTRAST_HORIZONTAL_HIGH = 12,
        DWRITE_PANOSE_CONTRAST_BROKEN = 13);


    TDWRITE_PANOSE_STROKE_VARIATION = (
        DWRITE_PANOSE_STROKE_VARIATION_ANY = 0,
        DWRITE_PANOSE_STROKE_VARIATION_NO_FIT = 1,
        DWRITE_PANOSE_STROKE_VARIATION_NO_VARIATION = 2,
        DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_DIAGONAL = 3,
        DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_TRANSITIONAL = 4,
        DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_VERTICAL = 5,
        DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_HORIZONTAL = 6,
        DWRITE_PANOSE_STROKE_VARIATION_RAPID_VERTICAL = 7,
        DWRITE_PANOSE_STROKE_VARIATION_RAPID_HORIZONTAL = 8,
        DWRITE_PANOSE_STROKE_VARIATION_INSTANT_VERTICAL = 9,
        DWRITE_PANOSE_STROKE_VARIATION_INSTANT_HORIZONTAL = 10);

    TDWRITE_PANOSE_ARM_STYLE = (
        DWRITE_PANOSE_ARM_STYLE_ANY = 0,
        DWRITE_PANOSE_ARM_STYLE_NO_FIT = 1,
        DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_HORIZONTAL = 2,
        DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_WEDGE = 3,
        DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_VERTICAL = 4,
        DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_SINGLE_SERIF = 5,
        DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_DOUBLE_SERIF = 6,
        DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_HORIZONTAL = 7,
        DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_WEDGE = 8,
        DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_VERTICAL = 9,
        DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_SINGLE_SERIF = 10,
        DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_DOUBLE_SERIF = 11,
        DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_HORZ = DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_HORIZONTAL,
        DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_VERT = DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_VERTICAL,
        DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_HORZ = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_HORIZONTAL,
        DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_WEDGE = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_WEDGE,
        DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_VERT = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_VERTICAL,
        DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_SINGLE_SERIF = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_SINGLE_SERIF,
        DWRITE_PANOSE_ARM_STYLE_BENT_ARMS_DOUBLE_SERIF = DWRITE_PANOSE_ARM_STYLE_NONSTRAIGHT_ARMS_DOUBLE_SERIF);


    TDWRITE_PANOSE_LETTERFORM = (
        DWRITE_PANOSE_LETTERFORM_ANY = 0,
        DWRITE_PANOSE_LETTERFORM_NO_FIT = 1,
        DWRITE_PANOSE_LETTERFORM_NORMAL_CONTACT = 2,
        DWRITE_PANOSE_LETTERFORM_NORMAL_WEIGHTED = 3,
        DWRITE_PANOSE_LETTERFORM_NORMAL_BOXED = 4,
        DWRITE_PANOSE_LETTERFORM_NORMAL_FLATTENED = 5,
        DWRITE_PANOSE_LETTERFORM_NORMAL_ROUNDED = 6,
        DWRITE_PANOSE_LETTERFORM_NORMAL_OFF_CENTER = 7,
        DWRITE_PANOSE_LETTERFORM_NORMAL_SQUARE = 8,
        DWRITE_PANOSE_LETTERFORM_OBLIQUE_CONTACT = 9,
        DWRITE_PANOSE_LETTERFORM_OBLIQUE_WEIGHTED = 10,
        DWRITE_PANOSE_LETTERFORM_OBLIQUE_BOXED = 11,
        DWRITE_PANOSE_LETTERFORM_OBLIQUE_FLATTENED = 12,
        DWRITE_PANOSE_LETTERFORM_OBLIQUE_ROUNDED = 13,
        DWRITE_PANOSE_LETTERFORM_OBLIQUE_OFF_CENTER = 14,
        DWRITE_PANOSE_LETTERFORM_OBLIQUE_SQUARE = 15);
    TDWRITE_PANOSE_MIDLINE = (
        DWRITE_PANOSE_MIDLINE_ANY = 0,
        DWRITE_PANOSE_MIDLINE_NO_FIT = 1,
        DWRITE_PANOSE_MIDLINE_STANDARD_TRIMMED = 2,
        DWRITE_PANOSE_MIDLINE_STANDARD_POINTED = 3,
        DWRITE_PANOSE_MIDLINE_STANDARD_SERIFED = 4,
        DWRITE_PANOSE_MIDLINE_HIGH_TRIMMED = 5,
        DWRITE_PANOSE_MIDLINE_HIGH_POINTED = 6,
        DWRITE_PANOSE_MIDLINE_HIGH_SERIFED = 7,
        DWRITE_PANOSE_MIDLINE_CONSTANT_TRIMMED = 8,
        DWRITE_PANOSE_MIDLINE_CONSTANT_POINTED = 9,
        DWRITE_PANOSE_MIDLINE_CONSTANT_SERIFED = 10,
        DWRITE_PANOSE_MIDLINE_LOW_TRIMMED = 11,
        DWRITE_PANOSE_MIDLINE_LOW_POINTED = 12,
        DWRITE_PANOSE_MIDLINE_LOW_SERIFED = 13);

    TDWRITE_PANOSE_XHEIGHT = (
        DWRITE_PANOSE_XHEIGHT_ANY = 0,
        DWRITE_PANOSE_XHEIGHT_NO_FIT = 1,
        DWRITE_PANOSE_XHEIGHT_CONSTANT_SMALL = 2,
        DWRITE_PANOSE_XHEIGHT_CONSTANT_STANDARD = 3,
        DWRITE_PANOSE_XHEIGHT_CONSTANT_LARGE = 4,
        DWRITE_PANOSE_XHEIGHT_DUCKING_SMALL = 5,
        DWRITE_PANOSE_XHEIGHT_DUCKING_STANDARD = 6,
        DWRITE_PANOSE_XHEIGHT_DUCKING_LARGE = 7,
        DWRITE_PANOSE_XHEIGHT_CONSTANT_STD = DWRITE_PANOSE_XHEIGHT_CONSTANT_STANDARD,
        DWRITE_PANOSE_XHEIGHT_DUCKING_STD = DWRITE_PANOSE_XHEIGHT_DUCKING_STANDARD);


    TDWRITE_PANOSE_TOOL_KIND = (
        DWRITE_PANOSE_TOOL_KIND_ANY = 0,
        DWRITE_PANOSE_TOOL_KIND_NO_FIT = 1,
        DWRITE_PANOSE_TOOL_KIND_FLAT_NIB = 2,
        DWRITE_PANOSE_TOOL_KIND_PRESSURE_POINT = 3,
        DWRITE_PANOSE_TOOL_KIND_ENGRAVED = 4,
        DWRITE_PANOSE_TOOL_KIND_BALL = 5,
        DWRITE_PANOSE_TOOL_KIND_BRUSH = 6,
        DWRITE_PANOSE_TOOL_KIND_ROUGH = 7,
        DWRITE_PANOSE_TOOL_KIND_FELT_PEN_BRUSH_TIP = 8,
        DWRITE_PANOSE_TOOL_KIND_WILD_BRUSH = 9);


    TDWRITE_PANOSE_SPACING = (
        DWRITE_PANOSE_SPACING_ANY = 0,
        DWRITE_PANOSE_SPACING_NO_FIT = 1,
        DWRITE_PANOSE_SPACING_PROPORTIONAL_SPACED = 2,
        DWRITE_PANOSE_SPACING_MONOSPACED = 3);

    TDWRITE_PANOSE_ASPECT_RATIO = (
        DWRITE_PANOSE_ASPECT_RATIO_ANY = 0,
        DWRITE_PANOSE_ASPECT_RATIO_NO_FIT = 1,
        DWRITE_PANOSE_ASPECT_RATIO_VERY_CONDENSED = 2,
        DWRITE_PANOSE_ASPECT_RATIO_CONDENSED = 3,
        DWRITE_PANOSE_ASPECT_RATIO_NORMAL = 4,
        DWRITE_PANOSE_ASPECT_RATIO_EXPANDED = 5,
        DWRITE_PANOSE_ASPECT_RATIO_VERY_EXPANDED = 6);

    TDWRITE_PANOSE_SCRIPT_TOPOLOGY = (
        DWRITE_PANOSE_SCRIPT_TOPOLOGY_ANY = 0,
        DWRITE_PANOSE_SCRIPT_TOPOLOGY_NO_FIT = 1,
        DWRITE_PANOSE_SCRIPT_TOPOLOGY_ROMAN_DISCONNECTED = 2,
        DWRITE_PANOSE_SCRIPT_TOPOLOGY_ROMAN_TRAILING = 3,
        DWRITE_PANOSE_SCRIPT_TOPOLOGY_ROMAN_CONNECTED = 4,
        DWRITE_PANOSE_SCRIPT_TOPOLOGY_CURSIVE_DISCONNECTED = 5,
        DWRITE_PANOSE_SCRIPT_TOPOLOGY_CURSIVE_TRAILING = 6,
        DWRITE_PANOSE_SCRIPT_TOPOLOGY_CURSIVE_CONNECTED = 7,
        DWRITE_PANOSE_SCRIPT_TOPOLOGY_BLACKLETTER_DISCONNECTED = 8,
        DWRITE_PANOSE_SCRIPT_TOPOLOGY_BLACKLETTER_TRAILING = 9,
        DWRITE_PANOSE_SCRIPT_TOPOLOGY_BLACKLETTER_CONNECTED = 10);

    TDWRITE_PANOSE_SCRIPT_FORM = (
        DWRITE_PANOSE_SCRIPT_FORM_ANY = 0,
        DWRITE_PANOSE_SCRIPT_FORM_NO_FIT = 1,
        DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_NO_WRAPPING = 2,
        DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_SOME_WRAPPING = 3,
        DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_MORE_WRAPPING = 4,
        DWRITE_PANOSE_SCRIPT_FORM_UPRIGHT_EXTREME_WRAPPING = 5,
        DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_NO_WRAPPING = 6,
        DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_SOME_WRAPPING = 7,
        DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_MORE_WRAPPING = 8,
        DWRITE_PANOSE_SCRIPT_FORM_OBLIQUE_EXTREME_WRAPPING = 9,
        DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_NO_WRAPPING = 10,
        DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_SOME_WRAPPING = 11,
        DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_MORE_WRAPPING = 12,
        DWRITE_PANOSE_SCRIPT_FORM_EXAGGERATED_EXTREME_WRAPPING = 13);

    TDWRITE_PANOSE_FINIALS = (
        DWRITE_PANOSE_FINIALS_ANY = 0,
        DWRITE_PANOSE_FINIALS_NO_FIT = 1,
        DWRITE_PANOSE_FINIALS_NONE_NO_LOOPS = 2,
        DWRITE_PANOSE_FINIALS_NONE_CLOSED_LOOPS = 3,
        DWRITE_PANOSE_FINIALS_NONE_OPEN_LOOPS = 4,
        DWRITE_PANOSE_FINIALS_SHARP_NO_LOOPS = 5,
        DWRITE_PANOSE_FINIALS_SHARP_CLOSED_LOOPS = 6,
        DWRITE_PANOSE_FINIALS_SHARP_OPEN_LOOPS = 7,
        DWRITE_PANOSE_FINIALS_TAPERED_NO_LOOPS = 8,
        DWRITE_PANOSE_FINIALS_TAPERED_CLOSED_LOOPS = 9,
        DWRITE_PANOSE_FINIALS_TAPERED_OPEN_LOOPS = 10,
        DWRITE_PANOSE_FINIALS_ROUND_NO_LOOPS = 11,
        DWRITE_PANOSE_FINIALS_ROUND_CLOSED_LOOPS = 12,
        DWRITE_PANOSE_FINIALS_ROUND_OPEN_LOOPS = 13);


    TDWRITE_PANOSE_XASCENT = (
        DWRITE_PANOSE_XASCENT_ANY = 0,
        DWRITE_PANOSE_XASCENT_NO_FIT = 1,
        DWRITE_PANOSE_XASCENT_VERY_LOW = 2,
        DWRITE_PANOSE_XASCENT_LOW = 3,
        DWRITE_PANOSE_XASCENT_MEDIUM = 4,
        DWRITE_PANOSE_XASCENT_HIGH = 5,
        DWRITE_PANOSE_XASCENT_VERY_HIGH = 6);


    TDWRITE_PANOSE_DECORATIVE_CLASS = (
        DWRITE_PANOSE_DECORATIVE_CLASS_ANY = 0,
        DWRITE_PANOSE_DECORATIVE_CLASS_NO_FIT = 1,
        DWRITE_PANOSE_DECORATIVE_CLASS_DERIVATIVE = 2,
        DWRITE_PANOSE_DECORATIVE_CLASS_NONSTANDARD_TOPOLOGY = 3,
        DWRITE_PANOSE_DECORATIVE_CLASS_NONSTANDARD_ELEMENTS = 4,
        DWRITE_PANOSE_DECORATIVE_CLASS_NONSTANDARD_ASPECT = 5,
        DWRITE_PANOSE_DECORATIVE_CLASS_INITIALS = 6,
        DWRITE_PANOSE_DECORATIVE_CLASS_CARTOON = 7,
        DWRITE_PANOSE_DECORATIVE_CLASS_PICTURE_STEMS = 8,
        DWRITE_PANOSE_DECORATIVE_CLASS_ORNAMENTED = 9,
        DWRITE_PANOSE_DECORATIVE_CLASS_TEXT_AND_BACKGROUND = 10,
        DWRITE_PANOSE_DECORATIVE_CLASS_COLLAGE = 11,
        DWRITE_PANOSE_DECORATIVE_CLASS_MONTAGE = 12);


    TDWRITE_PANOSE_ASPECT = (
        DWRITE_PANOSE_ASPECT_ANY = 0,
        DWRITE_PANOSE_ASPECT_NO_FIT = 1,
        DWRITE_PANOSE_ASPECT_SUPER_CONDENSED = 2,
        DWRITE_PANOSE_ASPECT_VERY_CONDENSED = 3,
        DWRITE_PANOSE_ASPECT_CONDENSED = 4,
        DWRITE_PANOSE_ASPECT_NORMAL = 5,
        DWRITE_PANOSE_ASPECT_EXTENDED = 6,
        DWRITE_PANOSE_ASPECT_VERY_EXTENDED = 7,
        DWRITE_PANOSE_ASPECT_SUPER_EXTENDED = 8,
        DWRITE_PANOSE_ASPECT_MONOSPACED = 9);

    TDWRITE_PANOSE_FILL = (
        DWRITE_PANOSE_FILL_ANY = 0,
        DWRITE_PANOSE_FILL_NO_FIT = 1,
        DWRITE_PANOSE_FILL_STANDARD_SOLID_FILL = 2,
        DWRITE_PANOSE_FILL_NO_FILL = 3,
        DWRITE_PANOSE_FILL_PATTERNED_FILL = 4,
        DWRITE_PANOSE_FILL_COMPLEX_FILL = 5,
        DWRITE_PANOSE_FILL_SHAPED_FILL = 6,
        DWRITE_PANOSE_FILL_DRAWN_DISTRESSED = 7);


    TDWRITE_PANOSE_LINING = (
        DWRITE_PANOSE_LINING_ANY = 0,
        DWRITE_PANOSE_LINING_NO_FIT = 1,
        DWRITE_PANOSE_LINING_NONE = 2,
        DWRITE_PANOSE_LINING_INLINE = 3,
        DWRITE_PANOSE_LINING_OUTLINE = 4,
        DWRITE_PANOSE_LINING_ENGRAVED = 5,
        DWRITE_PANOSE_LINING_SHADOW = 6,
        DWRITE_PANOSE_LINING_RELIEF = 7,
        DWRITE_PANOSE_LINING_BACKDROP = 8);

    TDWRITE_PANOSE_DECORATIVE_TOPOLOGY = (
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_ANY = 0,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_NO_FIT = 1,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_STANDARD = 2,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_SQUARE = 3,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_MULTIPLE_SEGMENT = 4,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_ART_DECO = 5,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_UNEVEN_WEIGHTING = 6,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_DIVERSE_ARMS = 7,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_DIVERSE_FORMS = 8,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_LOMBARDIC_FORMS = 9,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_UPPER_CASE_IN_LOWER_CASE = 10,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_IMPLIED_TOPOLOGY = 11,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_HORSESHOE_E_AND_A = 12,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_CURSIVE = 13,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_BLACKLETTER = 14,
        DWRITE_PANOSE_DECORATIVE_TOPOLOGY_SWASH_VARIANCE = 15);


    TDWRITE_PANOSE_CHARACTER_RANGES = (
        DWRITE_PANOSE_CHARACTER_RANGES_ANY = 0,
        DWRITE_PANOSE_CHARACTER_RANGES_NO_FIT = 1,
        DWRITE_PANOSE_CHARACTER_RANGES_EXTENDED_COLLECTION = 2,
        DWRITE_PANOSE_CHARACTER_RANGES_LITERALS = 3,
        DWRITE_PANOSE_CHARACTER_RANGES_NO_LOWER_CASE = 4,
        DWRITE_PANOSE_CHARACTER_RANGES_SMALL_CAPS = 5);


    TDWRITE_PANOSE_SYMBOL_KIND = (
        DWRITE_PANOSE_SYMBOL_KIND_ANY = 0,
        DWRITE_PANOSE_SYMBOL_KIND_NO_FIT = 1,
        DWRITE_PANOSE_SYMBOL_KIND_MONTAGES = 2,
        DWRITE_PANOSE_SYMBOL_KIND_PICTURES = 3,
        DWRITE_PANOSE_SYMBOL_KIND_SHAPES = 4,
        DWRITE_PANOSE_SYMBOL_KIND_SCIENTIFIC = 5,
        DWRITE_PANOSE_SYMBOL_KIND_MUSIC = 6,
        DWRITE_PANOSE_SYMBOL_KIND_EXPERT = 7,
        DWRITE_PANOSE_SYMBOL_KIND_PATTERNS = 8,
        DWRITE_PANOSE_SYMBOL_KIND_BOARDERS = 9,
        DWRITE_PANOSE_SYMBOL_KIND_ICONS = 10,
        DWRITE_PANOSE_SYMBOL_KIND_LOGOS = 11,
        DWRITE_PANOSE_SYMBOL_KIND_INDUSTRY_SPECIFIC = 12);


    TDWRITE_PANOSE_SYMBOL_ASPECT_RATIO = (
        DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_ANY = 0,
        DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NO_FIT = 1,
        DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NO_WIDTH = 2,
        DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_EXCEPTIONALLY_WIDE = 3,
        DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_SUPER_WIDE = 4,
        DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_VERY_WIDE = 5,
        DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_WIDE = 6,
        DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NORMAL = 7,
        DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_NARROW = 8,
        DWRITE_PANOSE_SYMBOL_ASPECT_RATIO_VERY_NARROW = 9);



    TDWRITE_OUTLINE_THRESHOLD = (
        DWRITE_OUTLINE_THRESHOLD_ANTIALIASED,
        DWRITE_OUTLINE_THRESHOLD_ALIASED);

    TDWRITE_BASELINE = (
        DWRITE_BASELINE_DEFAULT,
        DWRITE_BASELINE_ROMAN,
        DWRITE_BASELINE_CENTRAL,
        DWRITE_BASELINE_MATH,
        DWRITE_BASELINE_HANGING,
        DWRITE_BASELINE_IDEOGRAPHIC_BOTTOM,
        DWRITE_BASELINE_IDEOGRAPHIC_TOP,
        DWRITE_BASELINE_MINIMUM,
        DWRITE_BASELINE_MAXIMUM);

    TDWRITE_VERTICAL_GLYPH_ORIENTATION = (
        DWRITE_VERTICAL_GLYPH_ORIENTATION_DEFAULT,
        DWRITE_VERTICAL_GLYPH_ORIENTATION_STACKED);

    TDWRITE_GLYPH_ORIENTATION_ANGLE = (
        DWRITE_GLYPH_ORIENTATION_ANGLE_0_DEGREES,
        DWRITE_GLYPH_ORIENTATION_ANGLE_90_DEGREES,
        DWRITE_GLYPH_ORIENTATION_ANGLE_180_DEGREES,
        DWRITE_GLYPH_ORIENTATION_ANGLE_270_DEGREES);



    TDWRITE_CARET_METRICS = record

        slopeRise: INT16;

        slopeRun: INT16;


        offset: INT16;
    end;

    PDWRITE_CARET_METRICS = ^TDWRITE_CARET_METRICS;



    TDWRITE_UNICODE_RANGE = record
        First: UINT32;
        last: UINT32;
    end;
    PDWRITE_UNICODE_RANGE = ^TDWRITE_UNICODE_RANGE;



    TDWRITE_SCRIPT_PROPERTIES = {bitpacked} record
        isoScriptCode: UINT32;
        isoScriptNumber: UINT32;
        clusterLookahead: UINT32;
        justificationCharacter: UINT32;
        restrictCaretToClusters: Unsigned_Bits1;
        usesWordDividers: Unsigned_Bits1;
        isDiscreteWriting: Unsigned_Bits1;
        isBlockWriting: Unsigned_Bits1;
        isDistributedWithinCluster: Unsigned_Bits1;
        isConnectedWriting: Unsigned_Bits1;
        isCursiveWriting: Unsigned_Bits1;
        reserved: Unsigned_Bits25;
    end;
    PDWRITE_SCRIPT_PROPERTIES = ^TDWRITE_SCRIPT_PROPERTIES;


    TDWRITE_JUSTIFICATION_OPPORTUNITY = {bitpacked} record
        expansionMinimum: single;
        expansionMaximum: single;
        compressionMaximum: single;
        expansionPriority: Unsigned_Bits8;
        compressionPriority: Unsigned_Bits8;
        allowResidualExpansion: Unsigned_Bits1;
        allowResidualCompression: Unsigned_Bits1;
        applyToLeadingEdge: Unsigned_Bits1;
        applyToTrailingEdge: Unsigned_Bits1;
        reserved: Unsigned_Bits12;
    end;

    PDWRITE_JUSTIFICATION_OPPORTUNITY = ^TDWRITE_JUSTIFICATION_OPPORTUNITY;


    TDWRITE_FONT_METRICS1 = record
        {TDWRITE_FONT_METRICS}
        designUnitsPerEm: UINT16;
        ascent: UINT16;
        descent: UINT16;
        lineGap: INT16;
        capHeight: UINT16;
        xHeight: UINT16;
        underlinePosition: INT16;
        underlineThickness: UINT16;
        strikethroughPosition: INT16;
        strikethroughThickness: UINT16;


        glyphBoxLeft: INT16;

        glyphBoxTop: INT16;

        glyphBoxRight: INT16;
        glyphBoxBottom: INT16;
        subscriptPositionX: INT16;
        subscriptPositionY: INT16;
        subscriptSizeX: INT16;
        subscriptSizeY: INT16;
        superscriptPositionX: INT16;
        superscriptPositionY: INT16;
        superscriptSizeX: INT16;
        superscriptSizeY: INT16;
        hasTypographicMetrics: longbool;
    end;

    PDWRITE_FONT_METRICS1 = ^TDWRITE_FONT_METRICS1;

    TDWRITE_TEXT_ANTIALIAS_MODE = (
        DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE,
        DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE);

    TDWRITE_PANOSE = record
        { Todo}
    end;
    PDWRITE_PANOSE = ^TDWRITE_PANOSE;
    {DWrite2.h}



    TDWRITE_OPTICAL_ALIGNMENT = (
        DWRITE_OPTICAL_ALIGNMENT_NONE,
        DWRITE_OPTICAL_ALIGNMENT_NO_SIDE_BEARINGS);


    TDWRITE_GRID_FIT_MODE = (
        DWRITE_GRID_FIT_MODE_DEFAULT,
        DWRITE_GRID_FIT_MODE_DISABLED,
        DWRITE_GRID_FIT_MODE_ENABLED);


    TDWRITE_TEXT_METRICS1 = record

        left: single;
        top: single;
        Width: single;
        widthIncludingTrailingWhitespace: single;
        Height: single;
        layoutWidth: single;
        layoutHeight: single;
        maxBidiReorderingDepth: UINT32;
        lineCount: UINT32;
        heightIncludingTrailingWhitespace: single;
    end;

    PDWRITE_TEXT_METRICS1 = ^TDWRITE_TEXT_METRICS1;

    TDWRITE_COLOR_F = TD3DCOLORVALUE;
    PDWRITE_COLOR_F = ^TDWRITE_COLOR_F;




    {DWrite.h}

    IDWriteFontFileStream = interface(IUnknown)
        ['{6d4865fe-0ab8-4d91-8f62-5dd6be34a3e0}']
        function ReadFileFragment(out fragmentStart: Pointer; fileOffset: UINT64; fragmentSize: UINT64;
            out fragmentContext: Pointer): HResult; stdcall;
        procedure ReleaseFileFragment(fragmentContext: Pointer); stdcall;
        function GetFileSize(out fileSize: UINT64): HResult; stdcall;
        function GetLastWriteTime(out lastWriteTime: UINT64): HResult; stdcall;
    end;


    IDWriteFontFileLoader = interface(IUnknown)
        ['{727cad4e-d6af-4c9e-8a08-d695b11caa49}']
        function CreateStreamFromKey(fontFileReferenceKey: Pointer; fontFileReferenceKeySize: UINT32;
            out fontFileStream: IDWriteFontFileStream): HResult; stdcall;
    end;


    IDWriteLocalFontFileLoader = interface(IDWriteFontFileLoader)
        ['{b2d9f3ec-c9fe-4a11-a2ec-d86208f7c0a2}']
        function GetFilePathLengthFromKey(fontFileReferenceKey: Pointer; fontFileReferenceKeySize: UINT32;
            out filePathLength: UINT32): HResult; stdcall;
        function GetFilePathFromKey(fontFileReferenceKey: Pointer; fontFileReferenceKeySize: UINT32;
            filePath: PWideChar; filePathSize: UINT32): HResult; stdcall;
        function GetLastWriteTimeFromKey(fontFileReferenceKey: Pointer; fontFileReferenceKeySize: UINT32;
            out lastWriteTime: TFILETIME): HResult; stdcall;
    end;


    IDWriteFontFile = interface(IUnknown)
        ['{739d886a-cef5-47dc-8769-1a8b41bebbb0}']
        function GetReferenceKey(out fontFileReferenceKey: pointer; out fontFileReferenceKeySize: UINT32): HResult; stdcall;
        function GetLoader(out fontFileLoader: IDWriteFontFileLoader): HResult; stdcall;
        function Analyze(out isSupportedFontType: longbool; out fontFileType: TDWRITE_FONT_FILE_TYPE;
            out fontFaceType: TDWRITE_FONT_FACE_TYPE; out numberOfFaces: UINT32): HResult; stdcall;
    end;

    PIDWriteFontFile = ^IDWriteFontFile;


    IDWriteRenderingParams = interface(IUnknown)
        ['{2f0da53a-2add-47cd-82ee-d9ec34688e75}']
        function GetGamma(): single; stdcall;
        function GetEnhancedContrast(): single; stdcall;
        function GetClearTypeLevel(): single; stdcall;
        function GetPixelGeometry(): TDWRITE_PIXEL_GEOMETRY; stdcall;
        function GetRenderingMode(): TDWRITE_RENDERING_MODE; stdcall;
    end;


    IDWriteFontFace = interface(IUnknown)
        ['{5f49804d-7024-4d43-bfa9-d25984f53849}']
        function GetType(): TDWRITE_FONT_FACE_TYPE; stdcall;
        function GetFiles(var numberOfFiles: UINT32; out fontFiles: PIDWriteFontFile): HResult; stdcall;
        function GetIndex(): UINT32; stdcall;
        function GetSimulations(): TDWRITE_FONT_SIMULATIONS; stdcall;
        function IsSymbolFont(): longbool; stdcall;
        procedure GetMetrics(out fontFaceMetrics: TDWRITE_FONT_METRICS); stdcall;
        function GetGlyphCount(): UINT16; stdcall;
        function GetDesignGlyphMetrics(glyphIndices: PUINT16; glyphCount: UINT32; out glyphMetrics: PDWRITE_GLYPH_METRICS;
            isSideways: longbool = False): HResult; stdcall;
        function GetGlyphIndices(codePoints: PUINT32; codePointCount: UINT32; out glyphIndices: PUINT16): HResult; stdcall;
        function TryGetFontTable(openTypeTableTag: UINT32; out tableData: Pointer; out tableSize: UINT32;
            out tableContext: pointer; out exists: longbool): HResult; stdcall;
        procedure ReleaseFontTable(tableContext: pointer); stdcall;
        function GetGlyphRunOutline(emSize: single; glyphIndices: pUINT16; glyphAdvances: PSingle;
            glyphOffsets: PDWRITE_GLYPH_OFFSET; glyphCount: UINT32; isSideways: longbool; isRightToLeft: longbool;
            geometrySink: {IDWriteGeometrySink} IUnknown): HResult; stdcall;
        function GetRecommendedRenderingMode(emSize: single; pixelsPerDip: single; measuringMode: TDWRITE_MEASURING_MODE;
            renderingParams: IDWriteRenderingParams; out renderingMode: TDWRITE_RENDERING_MODE): HResult; stdcall;
        function GetGdiCompatibleMetrics(emSize: single; pixelsPerDip: single; transform: PDWRITE_MATRIX;
            out fontFaceMetrics: TDWRITE_FONT_METRICS): HResult; stdcall;
        function GetGdiCompatibleGlyphMetrics(emSize: single; pixelsPerDip: single; transform: PDWRITE_MATRIX;
            useGdiNatural: longbool; glyphIndices: PUINT16; glyphCount: UINT32; out glyphMetrics: PDWRITE_GLYPH_METRICS;
            isSideways: longbool = False): HResult; stdcall;
    end;


    TDWRITE_GLYPH_RUN = record
        fontFace: IDWriteFontFace;
        fontEmSize: single;
        glyphCount: UINT32;
        glyphIndices: PUINT16;
        glyphAdvances: PSingle;
        glyphOffsets: PDWRITE_GLYPH_OFFSET;
        isSideways: longbool;
        bidiLevel: UINT32;
    end;
    PDWRITE_GLYPH_RUN = ^TDWRITE_GLYPH_RUN;

    TDWRITE_GLYPH_RUN_DESCRIPTION = record
        localeName: PWideChar;
        _string: PWideChar;
        stringLength: UINT32;
        clusterMap: PUINT16;
        textPosition: UINT32;
    end;
    PDWRITE_GLYPH_RUN_DESCRIPTION = ^TDWRITE_GLYPH_RUN_DESCRIPTION;

    TDWRITE_UNDERLINE = record
        Width: single;
        thickness: single;
        offset: single;
        runHeight: single;
        readingDirection: TDWRITE_READING_DIRECTION;
        flowDirection: TDWRITE_FLOW_DIRECTION;
        localeName: PWideChar;
        measuringMode: TDWRITE_MEASURING_MODE;
    end;
    PDWRITE_UNDERLINE = ^TDWRITE_UNDERLINE;

    TDWRITE_STRIKETHROUGH = record
        Width: single;
        thickness: single;
        offset: single;
        readingDirection: TDWRITE_READING_DIRECTION;
        flowDirection: TDWRITE_FLOW_DIRECTION;
        localeName: PWideChar;
        measuringMode: TDWRITE_MEASURING_MODE;
    end;

    PDWRITE_STRIKETHROUGH = ^TDWRITE_STRIKETHROUGH;

    TDWRITE_LINE_METRICS = record
        length: UINT32;
        trailingWhitespaceLength: UINT32;
        newlineLength: UINT32;
        Height: single;
        baseline: single;
        isTrimmed: longbool;
    end;
    PDWRITE_LINE_METRICS = ^TDWRITE_LINE_METRICS;

    IDWriteFontFileEnumerator = interface(IUnknown)
        ['{72755049-5ff7-435d-8348-4be97cfa6c7c}']
        function MoveNext(out hasCurrentFile: longbool): HResult; stdcall;
        function GetCurrentFontFile(out fontFile: IDWriteFontFile): HResult; stdcall;
    end;

    IDWriteFactory = interface;

    IDWriteFontCollectionLoader = interface(IUnknown)
        ['{cca920e4-52f0-492b-bfa8-29c72ee0a468}']
        function CreateEnumeratorFromKey(factory: IDWriteFactory; collectionKey: pointer; collectionKeySize: UINT32;
            out fontFileEnumerator: IDWriteFontFileEnumerator): HResult; stdcall;
    end;


    IDWriteLocalizedStrings = interface(IUnknown)
        ['{08256209-099a-4b34-b86d-c22b110e7771}']
        function GetCount(): UINT32; stdcall;
        function FindLocaleName(localeName: PWideChar; out index: UINT32; out exists: longbool): HResult; stdcall;
        function GetLocaleNameLength(index: UINT32; out length: UINT32): HResult; stdcall;
        function GetLocaleName(index: UINT32; out localeName: PWideChar; size: UINT32): HResult; stdcall;
        function GetStringLength(index: UINT32; out length: UINT32): HResult; stdcall;
        function GetString(index: UINT32; out stringBuffer: PWideChar; size: UINT32): HResult; stdcall;
    end;


    IDWriteFontFamily = interface;
    IDWriteFont = interface;


    IDWriteFontCollection = interface(IUnknown)
        ['{a84cee02-3eea-4eee-a827-87c1a02a0fcc}']
        function GetFontFamilyCount(): UINT32; stdcall;
        function GetFontFamily(index: UINT32; out fontFamily: IDWriteFontFamily): HResult; stdcall;
        function FindFamilyName(familyName: PWideChar; out index: UINT32; out exists: longbool): HResult; stdcall;
        function GetFontFromFontFace(fontFace: IDWriteFontFace; out font: IDWriteFont): HResult; stdcall;
    end;


    IDWriteFontList = interface(IUnknown)
        ['{1a0d8438-1d97-4ec1-aef9-a2fb86ed6acb}']
        function GetFontCollection(out fontCollection: IDWriteFontCollection): HResult; stdcall;
        function GetFontCount(): UINT32; stdcall;
        function GetFont(index: UINT32; out font: IDWriteFont): HResult; stdcall;
    end;


    IDWriteFontFamily = interface(IDWriteFontList)
        ['{da20d8ef-812a-4c43-9802-62ec4abd7add}']
        function GetFamilyNames(out names: IDWriteLocalizedStrings): HResult; stdcall;
        function GetFirstMatchingFont(weight: TDWRITE_FONT_WEIGHT; stretch: TDWRITE_FONT_STRETCH; style: TDWRITE_FONT_STYLE;
            out matchingFont: IDWriteFont): HResult; stdcall;
        function GetMatchingFonts(weight: TDWRITE_FONT_WEIGHT; stretch: TDWRITE_FONT_STRETCH; style: TDWRITE_FONT_STYLE;
            out matchingFonts: IDWriteFontList): HResult; stdcall;
    end;


    IDWriteFont = interface(IUnknown)
        ['{acd16696-8c14-4f5d-877e-fe3fc1d32737}']
        function GetFontFamily(out fontFamily: IDWriteFontFamily): HResult; stdcall;
        function GetWeight(): TDWRITE_FONT_WEIGHT; stdcall;
        function GetStretch(): TDWRITE_FONT_STRETCH; stdcall;
        function GetStyle(): TDWRITE_FONT_STYLE; stdcall;
        function IsSymbolFont(): longbool; stdcall;
        function GetFaceNames(out names: IDWriteLocalizedStrings): HResult; stdcall;
        function GetInformationalStrings(informationalStringID: TDWRITE_INFORMATIONAL_STRING_ID;
            out informationalStrings: IDWriteLocalizedStrings; out exists: longbool): HResult; stdcall;
        function GetSimulations(): TDWRITE_FONT_SIMULATIONS; stdcall;
        procedure GetMetrics(out fontMetrics: TDWRITE_FONT_METRICS); stdcall;
        function HasCharacter(unicodeValue: UINT32; out exists: longbool): HResult; stdcall;
        function CreateFontFace(out fontFace: IDWriteFontFace): HResult; stdcall;
    end;


    IDWriteTypography = interface;
    IDWriteInlineObject = interface;


    IDWriteTextFormat = interface(IUnknown)
        ['{9c906818-31d7-4fd3-a151-7c5e225db55a}']
        function SetTextAlignment(textAlignment: TDWRITE_TEXT_ALIGNMENT): HResult; stdcall;
        function SetParagraphAlignment(paragraphAlignment: TDWRITE_PARAGRAPH_ALIGNMENT): HResult; stdcall;
        function SetWordWrapping(wordWrapping: TDWRITE_WORD_WRAPPING): HResult; stdcall;
        function SetReadingDirection(readingDirection: TDWRITE_READING_DIRECTION): HResult; stdcall;
        function SetFlowDirection(flowDirection: TDWRITE_FLOW_DIRECTION): HResult; stdcall;
        function SetIncrementalTabStop(incrementalTabStop: single): HResult; stdcall;
        function SetTrimming(trimmingOptions: PDWRITE_TRIMMING; trimmingSign: IDWriteInlineObject): HResult; stdcall;
        function SetLineSpacing(lineSpacingMethod: TDWRITE_LINE_SPACING_METHOD; lineSpacing: single; baseline: single): HResult; stdcall;
        function GetTextAlignment(): TDWRITE_TEXT_ALIGNMENT; stdcall;
        function GetParagraphAlignment(): TDWRITE_PARAGRAPH_ALIGNMENT; stdcall;
        function GetWordWrapping(): TDWRITE_WORD_WRAPPING; stdcall;
        function GetReadingDirection(): TDWRITE_READING_DIRECTION; stdcall;
        function GetFlowDirection(): TDWRITE_FLOW_DIRECTION; stdcall;
        function GetIncrementalTabStop(): single; stdcall;
        function GetTrimming(out trimmingOptions: TDWRITE_TRIMMING; out trimmingSign: IDWriteInlineObject): HResult; stdcall;
        function GetLineSpacing(out lineSpacingMethod: TDWRITE_LINE_SPACING_METHOD; out lineSpacing: single;
            out baseline: single): HResult; stdcall;
        function GetFontCollection(out fontCollection: IDWriteFontCollection): HResult; stdcall;
        function GetFontFamilyNameLength(): HResult; stdcall;
        function GetFontFamilyName(out fontFamilyName: PWideChar; nameSize: UINT32): UINT32; stdcall;
        function GetFontWeight(): TDWRITE_FONT_WEIGHT; stdcall;
        function GetFontStyle(): TDWRITE_FONT_STYLE; stdcall;
        function GetFontStretch(): TDWRITE_FONT_STRETCH; stdcall;
        function GetFontSize(): single; stdcall;
        function GetLocaleNameLength(): HResult; stdcall;
        function GetLocaleName(out localeName: PWideChar; nameSize: UINT32): UINT32; stdcall;
    end;


    IDWriteTypography = interface(IUnknown)
        ['{55f1112b-1dc2-4b3c-9541-f46894ed85b6}']
        function AddFontFeature(fontFeature: TDWRITE_FONT_FEATURE): HResult; stdcall;
        function GetFontFeatureCount(): UINT32; stdcall;
        function GetFontFeature(fontFeatureIndex: UINT32; out fontFeature: TDWRITE_FONT_FEATURE): HResult; stdcall;
    end;


{$IFDEF FPC}
    TDWRITE_LINE_BREAKPOINT = {bitpacked} record
        breakConditionBefore: Unsigned_Bits2;
        breakConditionAfter: Unsigned_Bits2;
        isWhitespace: Unsigned_Bits1;
        isSoftHyphen: Unsigned_Bits1;
        padding: Unsigned_Bits2;
    end;


    TDWRITE_SHAPING_TEXT_PROPERTIES = {bitpacked} record
        isShapedAlone: Unsigned_Bits1;
        reserved1: Unsigned_Bits1; // Reserved for use by shaping engine.
        canBreakShapingAfter: Unsigned_Bits1;
        reserved: Unsigned_Bits13;
    end;

    TDWRITE_SHAPING_GLYPH_PROPERTIES ={bitpacked}  record
        justification: Unsigned_Bits4;
        isClusterStart: Unsigned_Bits1;
        isDiacritic: Unsigned_Bits1;
        isZeroWidthSpace: Unsigned_Bits1;
        reserved: Unsigned_Bits9;
    end;

{$ELSE}
    TDWRITE_LINE_BREAKPOINT = record
        Value: UINT8;
    end;

    TDWRITE_SHAPING_TEXT_PROPERTIES = record
        Value: UINT16;
    end;

    TDWRITE_SHAPING_GLYPH_PROPERTIES = record
        Value: UINT16;
    end;
{$ENDIF}

    PDWRITE_LINE_BREAKPOINT = ^TDWRITE_LINE_BREAKPOINT;
    PDWRITE_SHAPING_TEXT_PROPERTIES = ^TDWRITE_SHAPING_TEXT_PROPERTIES;
    PDWRITE_SHAPING_GLYPH_PROPERTIES = ^TDWRITE_SHAPING_GLYPH_PROPERTIES;

    IDWriteNumberSubstitution = interface(IUnknown)
        ['{14885CC9-BAB0-4f90-B6ED-5C366A2CD03D}']
    end;


    IDWriteTextAnalysisSource = interface(IUnknown)
        ['{688e1a58-5094-47c8-adc8-fbcea60ae92b}']
        function GetTextAtPosition(textPosition: UINT32; out textString: PWideChar; out textLength: UINT32): HResult; stdcall;
        function GetTextBeforePosition(textPosition: UINT32; out textString: PWideChar; out textLength: UINT32): HResult; stdcall;
        function GetParagraphReadingDirection(): TDWRITE_READING_DIRECTION; stdcall;
        function GetLocaleName(textPosition: UINT32; out textLength: UINT32; out localeName: PWideChar): HResult; stdcall;
        function GetNumberSubstitution(textPosition: UINT32; out textLength: UINT32;
            out numberSubstitution: IDWriteNumberSubstitution): HResult; stdcall;
    end;


    IDWriteTextAnalysisSink = interface(IUnknown)
        ['{5810cd44-0ca0-4701-b3fa-bec5182ae4f6}']
        function SetScriptAnalysis(textPosition: UINT32; textLength: UINT32; scriptAnalysis: PDWRITE_SCRIPT_ANALYSIS): HResult; stdcall;
        function SetLineBreakpoints(textPosition: UINT32; textLength: UINT32; lineBreakpoints: PDWRITE_LINE_BREAKPOINT): HResult; stdcall;
        function SetBidiLevel(textPosition: UINT32; textLength: UINT32; explicitLevel: UINT8; resolvedLevel: UINT8): HResult; stdcall;
        function SetNumberSubstitution(textPosition: UINT32; textLength: UINT32;
            numberSubstitution: IDWriteNumberSubstitution): HResult; stdcall;
    end;


    IDWriteTextAnalyzer = interface(IUnknown)
        ['{b7e6163e-7f46-43b4-84b3-e4e6249c365d}']
        function AnalyzeScript(analysisSource: IDWriteTextAnalysisSource; textPosition: UINT32; textLength: UINT32;
            analysisSink: IDWriteTextAnalysisSink): HResult; stdcall;
        function AnalyzeBidi(analysisSource: IDWriteTextAnalysisSource; textPosition: UINT32; textLength: UINT32;
            analysisSink: IDWriteTextAnalysisSink): HResult; stdcall;
        function AnalyzeNumberSubstitution(analysisSource: IDWriteTextAnalysisSource; textPosition: UINT32;
            textLength: UINT32; analysisSink: IDWriteTextAnalysisSink): HResult; stdcall;
        function AnalyzeLineBreakpoints(analysisSource: IDWriteTextAnalysisSource; textPosition: UINT32;
            textLength: UINT32; analysisSink: IDWriteTextAnalysisSink): HResult; stdcall;
        function GetGlyphs(textString: PWideChar; textLength: UINT32; fontFace: IDWriteFontFace; isSideways: longbool;
            isRightToLeft: longbool; scriptAnalysis: PDWRITE_SCRIPT_ANALYSIS; localeName: PWideChar;
            numberSubstitution: IDWriteNumberSubstitution; features: PDWRITE_TYPOGRAPHIC_FEATURES; featureRangeLengths: PUINT32;
            featureRanges: UINT32; maxGlyphCount: UINT32; out clusterMap: PUINT16; out textProps: PDWRITE_SHAPING_TEXT_PROPERTIES;
            out glyphIndices: PUINT16; out glyphProps: PDWRITE_SHAPING_GLYPH_PROPERTIES; out actualGlyphCount: UINT32): HResult; stdcall;
        function GetGlyphPlacements(textString: PWideChar; clusterMap: PUINT16; textProps: PDWRITE_SHAPING_TEXT_PROPERTIES;
            textLength: UINT32; glyphIndices: UINT16; glyphProps: PDWRITE_SHAPING_GLYPH_PROPERTIES; glyphCount: UINT32;
            fontFace: IDWriteFontFace; fontEmSize: single; isSideways: longbool; isRightToLeft: longbool;
            scriptAnalysis: PDWRITE_SCRIPT_ANALYSIS; localeName: PWideChar; features: PDWRITE_TYPOGRAPHIC_FEATURES;
            featureRangeLengths: PUINT32; featureRanges: UINT32; out glyphAdvances: PSingle;
            out glyphOffsets: PDWRITE_GLYPH_OFFSET): HResult; stdcall;
        function GetGdiCompatibleGlyphPlacements(textString: PWideChar; clusterMap: PUINT16;
            textProps: PDWRITE_SHAPING_TEXT_PROPERTIES; textLength: UINT32; glyphIndices: PUINT16;
            glyphProps: PDWRITE_SHAPING_GLYPH_PROPERTIES; glyphCount: UINT32; fontFace: IDWriteFontFace;
            fontEmSize: single; pixelsPerDip: single; transform: PDWRITE_MATRIX; useGdiNatural: longbool;
            isSideways: longbool; isRightToLeft: longbool; scriptAnalysis: PDWRITE_SCRIPT_ANALYSIS; localeName: PWideChar;
            features: PDWRITE_TYPOGRAPHIC_FEATURES; featureRangeLengths: PUINT32; featureRanges: UINT32;
            out glyphAdvances: PSingle; out glyphOffsets: PDWRITE_GLYPH_OFFSET): HResult; stdcall;
    end;


{$IFDEF FPC}
    TDWRITE_CLUSTER_METRICS = {bitpacked}record
        Width: single;
        length: UINT16;
        canWrapLineAfter: Unsigned_Bits1;
        isWhitespace: Unsigned_Bits1;
        isNewline: Unsigned_Bits1;
        isSoftHyphen: Unsigned_Bits1;
        isRightToLeft: Unsigned_Bits1;
        padding: Unsigned_Bits11;
    end;
{$ELSE}
    TDWRITE_CLUSTER_METRICS = record
        Width: single;
        length: UINT16;
        Value: UINT16;
    end;
{$ENDIF}

    PDWRITE_CLUSTER_METRICS = ^TDWRITE_CLUSTER_METRICS;

    TDWRITE_TEXT_METRICS = record
        left: single;
        top: single;
        Width: single;
        widthIncludingTrailingWhitespace: single;
        Height: single;
        layoutWidth: single;
        layoutHeight: single;
        maxBidiReorderingDepth: UINT32;
        lineCount: UINT32;
    end;

    PDWRITE_TEXT_METRICS = ^TDWRITE_TEXT_METRICS;

    TDWRITE_INLINE_OBJECT_METRICS = record
        Width: single;
        Height: single;
        baseline: single;
        supportsSideways: longbool;
    end;
    PDWRITE_INLINE_OBJECT_METRICS = ^TDWRITE_INLINE_OBJECT_METRICS;

    TDWRITE_OVERHANG_METRICS = record
        left: single;
        top: single;
        right: single;
        bottom: single;
    end;
    PDWRITE_OVERHANG_METRICS = ^TDWRITE_OVERHANG_METRICS;

    TDWRITE_HIT_TEST_METRICS = record
        textPosition: UINT32;
        length: UINT32;
        left: single;
        top: single;
        Width: single;
        Height: single;
        bidiLevel: UINT32;
        isText: longbool;
        isTrimmed: longbool;
    end;
    PDWRITE_HIT_TEST_METRICS = ^TDWRITE_HIT_TEST_METRICS;


    IDWriteTextRenderer = interface;

    IDWriteInlineObject = interface(IUnknown)
        ['{8339FDE3-106F-47ab-8373-1C6295EB10B3}']


        function Draw(clientDrawingContext: Pointer; renderer: IDWriteTextRenderer; originX: single; originY: single;
            isSideways: longbool; isRightToLeft: longbool; clientDrawingEffect: IUnknown): HResult; stdcall;


        function GetMetrics(out metrics: TDWRITE_INLINE_OBJECT_METRICS): HResult; stdcall;


        function GetOverhangMetrics(out overhangs: TDWRITE_OVERHANG_METRICS): HResult; stdcall;

        function GetBreakConditions(out breakConditionBefore: TDWRITE_BREAK_CONDITION;
            out breakConditionAfter: TDWRITE_BREAK_CONDITION): HResult; stdcall;
    end;


    IDWritePixelSnapping = interface(IUnknown)
        ['{eaf3a2da-ecf4-4d24-b644-b34f6842024b}']

        function IsPixelSnappingDisabled(clientDrawingContext: Pointer; out isDisabled: longbool): HResult; stdcall;

        function GetCurrentTransform(clientDrawingContext: Pointer; out transform: TDWRITE_MATRIX): HResult; stdcall;


        function GetPixelsPerDip(clientDrawingContext: Pointer; out pixelsPerDip: single): HResult; stdcall;
    end;


    IDWriteTextRenderer = interface(IDWritePixelSnapping)
        ['{ef8a8135-5cc6-45fe-8825-c5a0724eb819}']
        function DrawGlyphRun(clientDrawingContext: Pointer; baselineOriginX: single; baselineOriginY: single;
            measuringMode: TDWRITE_MEASURING_MODE; glyphRun: PDWRITE_GLYPH_RUN; glyphRunDescription: PDWRITE_GLYPH_RUN_DESCRIPTION;
            clientDrawingEffect: IUnknown): HResult; stdcall;

        function DrawUnderline(clientDrawingContext: Pointer; baselineOriginX: single; baselineOriginY: single;
            underline: PDWRITE_UNDERLINE; clientDrawingEffect: IUnknown): HResult; stdcall;

        function DrawStrikethrough(clientDrawingContext: Pointer; baselineOriginX: single; baselineOriginY: single;
            strikethrough: PDWRITE_STRIKETHROUGH; clientDrawingEffect: IUnknown): HResult; stdcall;

        function DrawInlineObject(clientDrawingContext: POinter; originX: single; originY: single;
            inlineObject: IDWriteInlineObject; isSideways: longbool; isRightToLeft: longbool;
            clientDrawingEffect: IUnknown): HResult; stdcall;
    end;


    IDWriteTextLayout = interface(IDWriteTextFormat)
        ['{53737037-6d14-410b-9bfe-0b182bb70961}']
        function SetMaxWidth(maxWidth: single): HResult; stdcall;
        function SetMaxHeight(maxHeight: single): HResult; stdcall;
        function SetFontCollection(fontCollection: IDWriteFontCollection; textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function SetFontFamilyName(fontFamilyName: PWideChar; textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function SetFontWeight(fontWeight: TDWRITE_FONT_WEIGHT; textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function SetFontStyle(fontStyle: TDWRITE_FONT_STYLE; textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function SetFontStretch(fontStretch: TDWRITE_FONT_STRETCH; textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function SetFontSize(fontSize: single; textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function SetUnderline(hasUnderline: longbool; textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function SetStrikethrough(hasStrikethrough: longbool; textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function SetDrawingEffect(drawingEffect: IUnknown; textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function SetInlineObject(inlineObject: IDWriteInlineObject; textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function SetTypography(typography: IDWriteTypography; textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function SetLocaleName(localeName: PWideChar; textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetMaxWidth(): single; stdcall;
        function GetMaxHeight(): single; stdcall;
        function GetFontCollection(currentPosition: UINT32; out fontCollection: IDWriteFontCollection;
            out textRange: TDWRITE_TEXT_RANGE): HResult; overload; stdcall; //=== ct9999 =====
        function GetFontFamilyNameLength(currentPosition: UINT32; out nameLength: UINT32;
            out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetFontFamilyName(currentPosition: UINT32; out fontFamilyName: PWideChar; nameSize: UINT32;
            out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetFontWeight(currentPosition: UINT32; out fontWeight: TDWRITE_FONT_WEIGHT;
            out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetFontStyle(currentPosition: UINT32; out fontStyle: TDWRITE_FONT_STYLE;
            out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetFontStretch(currentPosition: UINT32; out fontStretch: TDWRITE_FONT_STRETCH;
            out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetFontSize(currentPosition: UINT32; out fontSize: single; out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetUnderline(currentPosition: UINT32; out hasUnderline: longbool; out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetStrikethrough(currentPosition: UINT32; out hasStrikethrough: longbool;
            out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetDrawingEffect(currentPosition: UINT32; out drawingEffect: IUnknown;
            out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetInlineObject(currentPosition: UINT32; out inlineObject: IDWriteInlineObject;
            out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetTypography(currentPosition: UINT32; out typography: IDWriteTypography;
            out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetLocaleNameLength(currentPosition: UINT32; out nameLength: UINT32;
            out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetLocaleName(currentPosition: UINT32; out localeName: PWideChar; nameSize: UINT32;
            out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function Draw(clientDrawingContext: Pointer; renderer: IDWriteTextRenderer; originX: single; originY: single): HResult; stdcall;
        function GetLineMetrics(out lineMetrics: PDWRITE_LINE_METRICS; maxLineCount: UINT32;
            out actualLineCount: UINT32): HResult; stdcall;
        function GetMetrics(out textMetrics: TDWRITE_TEXT_METRICS): HResult; stdcall;
        function GetOverhangMetrics(out overhangs: TDWRITE_OVERHANG_METRICS): HResult; stdcall;
        function GetClusterMetrics(out clusterMetrics: PDWRITE_CLUSTER_METRICS; maxClusterCount: UINT32;
            out actualClusterCount: UINT32): HResult; stdcall;
        function DetermineMinWidth(out minWidth: single): HResult; stdcall;
        function HitTestPoint(pointX: single; pointY: single; out isTrailingHit: longbool; out isInside: longbool;
            out hitTestMetrics: TDWRITE_HIT_TEST_METRICS): HResult; stdcall;
        function HitTestTextPosition(textPosition: UINT32; isTrailingHit: longbool; out pointX: single;
            out pointY: single; out hitTestMetrics: TDWRITE_HIT_TEST_METRICS): HResult; stdcall;
        function HitTestTextRange(textPosition: UINT32; textLength: UINT32; originX: single; originY: single;
            out hitTestMetrics: PDWRITE_HIT_TEST_METRICS; maxHitTestMetricsCount: UINT32; out actualHitTestMetricsCount: UINT32): HResult; stdcall;
    end;


    IDWriteBitmapRenderTarget = interface(IUnknown)
        ['{5e5a32a3-8dff-4773-9ff6-0696eab77267}']
        function DrawGlyphRun(baselineOriginX: single; baselineOriginY: single; measuringMode: TDWRITE_MEASURING_MODE;
            glyphRun: PDWRITE_GLYPH_RUN; renderingParams: IDWriteRenderingParams; textColor: TCOLORREF;
            out blackBoxRect: TRECT): HResult; stdcall;
        function GetMemoryDC(): HDC; stdcall;
        function GetPixelsPerDip(): single; stdcall;
        function SetPixelsPerDip(pixelsPerDip: single): HResult; stdcall;
        function GetCurrentTransform(out transform: TDWRITE_MATRIX): HResult; stdcall;
        function SetCurrentTransform(transform: PDWRITE_MATRIX): HResult; stdcall;
        function GetSize(out size: TSIZE): HResult; stdcall;
        function Resize(Width: UINT32; Height: UINT32): HResult; stdcall;
    end;


    IDWriteGdiInterop = interface(IUnknown)
        ['{1edd9491-9853-4299-898f-6432983b6f3a}']
        function CreateFontFromLOGFONT(logFont: PLOGFONTW; out font: IDWriteFont): HResult; stdcall;
        function ConvertFontToLOGFONT(font: IDWriteFont; out logFont: TLOGFONTW; out isSystemFont: longbool): HResult; stdcall;
        function ConvertFontFaceToLOGFONT(font: IDWriteFontFace; out logFont: LOGFONTW): HResult; stdcall;
        function CreateFontFaceFromHdc(hdc: HDC; out fontFace: IDWriteFontFace): HResult; stdcall;
        function CreateBitmapRenderTarget(hdc: HDC; Width: UINT32; Height: UINT32;
            out renderTarget: IDWriteBitmapRenderTarget): HResult; stdcall;
    end;


    TDWRITE_TEXTURE_TYPE = (
        DWRITE_TEXTURE_ALIASED_1x1,
        DWRITE_TEXTURE_CLEARTYPE_3x1);


    IDWriteGlyphRunAnalysis = interface(IUnknown)
        ['{7d97dbf7-e085-42d4-81e3-6a883bded118}']
        function GetAlphaTextureBounds(textureType: TDWRITE_TEXTURE_TYPE; out textureBounds: TRECT): HResult; stdcall;
        function CreateAlphaTexture(textureType: TDWRITE_TEXTURE_TYPE; textureBounds: PRECT; out alphaValues: PBYTE;
            bufferSize: UINT32): HResult; stdcall;
        function GetAlphaBlendParams(renderingParams: IDWriteRenderingParams; out blendGamma: single;
            out blendEnhancedContrast: single; out blendClearTypeLevel: single): HResult; stdcall;
    end;


    IDWriteFactory = interface(IUnknown)
        ['{b859ee5a-d838-4b5b-a2e8-1adc7d93db48}']
        function GetSystemFontCollection(out fontCollection: IDWriteFontCollection; checkForUpdates: longbool = False): HResult; stdcall;
        function CreateCustomFontCollection(collectionLoader: IDWriteFontCollectionLoader; collectionKey: pointer;
            collectionKeySize: UINT32; out fontCollection: IDWriteFontCollection): HResult; stdcall;
        function RegisterFontCollectionLoader(fontCollectionLoader: IDWriteFontCollectionLoader): HResult; stdcall;
        function UnregisterFontCollectionLoader(fontCollectionLoader: IDWriteFontCollectionLoader): HResult; stdcall;
        function CreateFontFileReference(filePath: PWideChar; lastWriteTime: PFILETIME; out fontFile: IDWriteFontFile): HResult; stdcall;
        function CreateCustomFontFileReference(fontFileReferenceKey: Pointer; fontFileReferenceKeySize: UINT32;
            fontFileLoader: IDWriteFontFileLoader; out fontFile: IDWriteFontFile): HResult; stdcall;
        function CreateFontFace(fontFaceType: TDWRITE_FONT_FACE_TYPE; numberOfFiles: UINT32; fontFiles: PIDWriteFontFile;
            faceIndex: UINT32; fontFaceSimulationFlags: TDWRITE_FONT_SIMULATIONS; out fontFace: IDWriteFontFace): HResult; stdcall;
        function CreateRenderingParams(out renderingParams: IDWriteRenderingParams): HResult; stdcall;
        function CreateMonitorRenderingParams(monitor: HMONITOR; out renderingParams: IDWriteRenderingParams): HResult; stdcall;
        function CreateCustomRenderingParams(gamma: single; enhancedContrast: single; clearTypeLevel: single;
            pixelGeometry: TDWRITE_PIXEL_GEOMETRY; renderingMode: TDWRITE_RENDERING_MODE; out renderingParams: IDWriteRenderingParams): HResult;
            stdcall;
        function RegisterFontFileLoader(fontFileLoader: IDWriteFontFileLoader): HResult; stdcall;
        function UnregisterFontFileLoader(fontFileLoader: IDWriteFontFileLoader): HResult; stdcall;
        function CreateTextFormat(fontFamilyName: PWideChar; fontCollection: IDWriteFontCollection;
            fontWeight: TDWRITE_FONT_WEIGHT; fontStyle: TDWRITE_FONT_STYLE; fontStretch: TDWRITE_FONT_STRETCH;
            fontSize: single; localeName: PWideChar; out textFormat: IDWriteTextFormat): HResult; stdcall;
        function CreateTypography(out typography: IDWriteTypography): HResult; stdcall;
        function GetGdiInterop(out gdiInterop: IDWriteGdiInterop): HResult; stdcall;
        function CreateTextLayout(_string: PWideChar; stringLength: UINT32; textFormat: IDWriteTextFormat;
            maxWidth: single; maxHeight: single; out textLayout: IDWriteTextLayout): HResult; stdcall;
        function CreateGdiCompatibleTextLayout(_string: PWideChar; stringLength: UINT32; textFormat: IDWriteTextFormat;
            layoutWidth: single; layoutHeight: single; pixelsPerDip: single; transform: PDWRITE_MATRIX; useGdiNatural: longbool;
            out textLayout: IDWriteTextLayout): HResult; stdcall;
        function CreateEllipsisTrimmingSign(textFormat: IDWriteTextFormat; out trimmingSign: IDWriteInlineObject): HResult; stdcall;
        function CreateTextAnalyzer(out textAnalyzer: IDWriteTextAnalyzer): HResult; stdcall;
        function CreateNumberSubstitution(substitutionMethod: TDWRITE_NUMBER_SUBSTITUTION_METHOD; localeName: PWideChar;
            ignoreUserOverride: longbool; out numberSubstitution: IDWriteNumberSubstitution): HResult;
            stdcall;
        function CreateGlyphRunAnalysis(glyphRun: PDWRITE_GLYPH_RUN; pixelsPerDip: single; transform: PDWRITE_MATRIX;
            renderingMode: TDWRITE_RENDERING_MODE; measuringMode: TDWRITE_MEASURING_MODE; baselineOriginX: single;
            baselineOriginY: single; out glyphRunAnalysis: IDWriteGlyphRunAnalysis): HResult;
            stdcall;
    end;

    {DWrite1.h}

    IDWriteTextAnalysisSource1 = interface;
    IDWriteTextAnalysisSink1 = interface;
    IDWriteRenderingParams1 = interface;

    IDWriteFactory1 = interface(IDWriteFactory)
        ['{30572f99-dac6-41db-a16e-0486307e606a}']
        function GetEudcFontCollection(out fontCollection: IDWriteFontCollection; checkForUpdates: longbool = False): HResult; stdcall;
        function CreateCustomRenderingParams(gamma: single; enhancedContrast: single; enhancedContrastGrayscale: single;
            clearTypeLevel: single; pixelGeometry: TDWRITE_PIXEL_GEOMETRY; renderingMode: TDWRITE_RENDERING_MODE;
            out renderingParams: IDWriteRenderingParams1): HResult; stdcall;
    end;


    IDWriteFontFace1 = interface(IDWriteFontFace)
        ['{a71efdb4-9fdb-4838-ad90-cfc3be8c3daf}']
        procedure GetMetrics(out fontMetrics: TDWRITE_FONT_METRICS1); stdcall;
        function GetGdiCompatibleMetrics(emSize: single; pixelsPerDip: single; const transform: TDWRITE_MATRIX;
            out fontMetrics: TDWRITE_FONT_METRICS1): HResult; stdcall;
        procedure GetCaretMetrics(out caretMetrics: TDWRITE_CARET_METRICS); stdcall;
        function GetUnicodeRanges(maxRangeCount: UINT32; out unicodeRanges: PDWRITE_UNICODE_RANGE;
            out actualRangeCount: UINT32): HResult; stdcall;
        function IsMonospacedFont(): longbool; stdcall;
        function GetDesignGlyphAdvances(glyphCount: UINT32; glyphIndices: PUINT16; out glyphAdvances: PINT32;
            isSideways: longbool = False): HResult; stdcall;
        function GetGdiCompatibleGlyphAdvances(emSize: single; pixelsPerDip: single; const transform: TDWRITE_MATRIX;
            useGdiNatural: longbool; isSideways: longbool; glyphCount: UINT32; glyphIndices: PUINT16; out glyphAdvances: PINT32): HResult; stdcall;
        function GetKerningPairAdjustments(glyphCount: UINT32; glyphIndices: PUINT16;
            out glyphAdvanceAdjustments: PINT32): HResult; stdcall;
        function HasKerningPairs(): longbool; stdcall;
        function GetRecommendedRenderingMode(fontEmSize: single; dpiX: single; dpiY: single; const transform: TDWRITE_MATRIX;
            isSideways: longbool; outlineThreshold: TDWRITE_OUTLINE_THRESHOLD; measuringMode: TDWRITE_MEASURING_MODE;
            out renderingMode: TDWRITE_RENDERING_MODE): HResult; stdcall;
        function GetVerticalGlyphVariants(glyphCount: UINT32; nominalGlyphIndices: PUINT16;
            out verticalGlyphIndices: PUINT16): HResult; stdcall;
        function HasVerticalGlyphVariants(): longbool; stdcall;
    end;



    IDWriteFont1 = interface(IDWriteFont)
        ['{acd16696-8c14-4f5d-877e-fe3fc1d32738}']
        procedure GetMetrics(out fontMetrics: TDWRITE_FONT_METRICS1); stdcall;
        procedure GetPanose(out panose: TDWRITE_PANOSE); stdcall;
        function GetUnicodeRanges(maxRangeCount: UINT32; out unicodeRanges: PDWRITE_UNICODE_RANGE;
            out actualRangeCount: UINT32): HResult; stdcall;
        function IsMonospacedFont(): longbool; stdcall;
    end;


    IDWriteRenderingParams1 = interface(IDWriteRenderingParams)
        ['{94413cf4-a6fc-4248-8b50-6674348fcad3}']
        function GetGrayscaleEnhancedContrast(): single; stdcall;
    end;



    IDWriteTextAnalyzer1 = interface(IDWriteTextAnalyzer)
        ['{80DAD800-E21F-4E83-96CE-BFCCE500DB7C}']
        function ApplyCharacterSpacing(leadingSpacing: single; trailingSpacing: single; minimumAdvanceWidth: single;
            textLength: UINT32; glyphCount: UINT32; clusterMap: PUINT16; glyphAdvances: Psingle; glyphOffsets: PDWRITE_GLYPH_OFFSET;
            glyphProperties: PDWRITE_SHAPING_GLYPH_PROPERTIES; out modifiedGlyphAdvances: Psingle;
            out modifiedGlyphOffsets: PDWRITE_GLYPH_OFFSET): HResult; stdcall;
        function GetBaseline(fontFace: IDWriteFontFace; baseline: TDWRITE_BASELINE; isVertical: longbool;
            isSimulationAllowed: longbool; scriptAnalysis: TDWRITE_SCRIPT_ANALYSIS; localeName: PWideChar;
            out baselineCoordinate: INT32; out exists: longbool): HResult; stdcall;
        function AnalyzeVerticalGlyphOrientation(analysisSource: IDWriteTextAnalysisSource1; textPosition: UINT32;
            textLength: UINT32; analysisSink: IDWriteTextAnalysisSink1): HResult; stdcall;
        function GetGlyphOrientationTransform(glyphOrientationAngle: TDWRITE_GLYPH_ORIENTATION_ANGLE;
            isSideways: longbool; out transform: TDWRITE_MATRIX): HResult; stdcall;
        function GetScriptProperties(scriptAnalysis: TDWRITE_SCRIPT_ANALYSIS;
            out scriptProperties: TDWRITE_SCRIPT_PROPERTIES): HResult; stdcall;
        function GetTextComplexity(textString: PWideChar; textLength: UINT32; fontFace: IDWriteFontFace;
            out isTextSimple: longbool; out textLengthRead: UINT32; out glyphIndices: PUINT16): HResult; stdcall;
        function GetJustificationOpportunities(fontFace: IDWriteFontFace; fontEmSize: single;
            scriptAnalysis: TDWRITE_SCRIPT_ANALYSIS; textLength: UINT32; glyphCount: UINT32; textString: PWideChar;
            clusterMap: PUINT16; glyphProperties: PDWRITE_SHAPING_GLYPH_PROPERTIES;
            out justificationOpportunities: PDWRITE_JUSTIFICATION_OPPORTUNITY): HResult; stdcall;
        function JustifyGlyphAdvances(lineWidth: single; glyphCount: UINT32;
            justificationOpportunities: PDWRITE_JUSTIFICATION_OPPORTUNITY; glyphAdvances: Psingle;
            glyphOffsets: PDWRITE_GLYPH_OFFSET; out justifiedGlyphAdvances: Psingle;
            out justifiedGlyphOffsets: PDWRITE_GLYPH_OFFSET): HResult; stdcall;
        function GetJustifiedGlyphs(fontFace: IDWriteFontFace; fontEmSize: single; scriptAnalysis: TDWRITE_SCRIPT_ANALYSIS;
            textLength: UINT32; glyphCount: UINT32; maxGlyphCount: UINT32; clusterMap: PUINT16; glyphIndices: PUINT16;
            glyphAdvances: Psingle; justifiedGlyphAdvances: Psingle; justifiedGlyphOffsets: PDWRITE_GLYPH_OFFSET;
            glyphProperties: PDWRITE_SHAPING_GLYPH_PROPERTIES; out actualGlyphCount: UINT32; out modifiedClusterMap: PUINT16;
            out modifiedGlyphIndices: PUINT16; out modifiedGlyphAdvances: Psingle; out modifiedGlyphOffsets: PDWRITE_GLYPH_OFFSET): HResult; stdcall;
    end;


    IDWriteTextAnalysisSource1 = interface(IDWriteTextAnalysisSource)
        ['{639CFAD8-0FB4-4B21-A58A-067920120009}']
        function GetVerticalGlyphOrientation(textPosition: UINT32; out textLength: UINT32;
            out glyphOrientation: TDWRITE_VERTICAL_GLYPH_ORIENTATION; out bidiLevel: UINT8): HResult; stdcall;
    end;



    IDWriteTextAnalysisSink1 = interface(IDWriteTextAnalysisSink)
        ['{B0D941A0-85E7-4D8B-9FD3-5CED9934482A}']
        function SetGlyphOrientation(textPosition: UINT32; textLength: UINT32; glyphOrientationAngle: TDWRITE_GLYPH_ORIENTATION_ANGLE;
            adjustedBidiLevel: UINT8; isSideways: longbool; isRightToLeft: longbool): HResult; stdcall;
    end;



    IDWriteTextLayout1 = interface(IDWriteTextLayout)
        ['{9064D822-80A7-465C-A986-DF65F78B8FEB}']
        function SetPairKerning(isPairKerningEnabled: longbool; textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetPairKerning(currentPosition: UINT32; out isPairKerningEnabled: longbool;
            out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function SetCharacterSpacing(leadingSpacing: single; trailingSpacing: single; minimumAdvanceWidth: single;
            textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
        function GetCharacterSpacing(currentPosition: UINT32; out leadingSpacing: single; out trailingSpacing: single;
            out minimumAdvanceWidth: single; out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
    end;




    IDWriteBitmapRenderTarget1 = interface(IDWriteBitmapRenderTarget)
        ['{791e8298-3ef3-4230-9880-c9bdecc42064}']
        function GetTextAntialiasMode(): HResult; stdcall;
        function SetTextAntialiasMode(antialiasMode: TDWRITE_TEXT_ANTIALIAS_MODE): TDWRITE_TEXT_ANTIALIAS_MODE; stdcall;
    end;


    {DWrite2.h}

    IDWriteFontFallback = interface;

    IDWriteTextRenderer1 = interface(IDWriteTextRenderer)
        ['{D3E0E934-22A0-427E-AAE4-7D9574B59DB1}']
        function DrawGlyphRun(clientDrawingContext: Pointer; baselineOriginX: single; baselineOriginY: single;
            orientationAngle: TDWRITE_GLYPH_ORIENTATION_ANGLE; measuringMode: TDWRITE_MEASURING_MODE;
            const glyphRun: TDWRITE_GLYPH_RUN; const glyphRunDescription: TDWRITE_GLYPH_RUN_DESCRIPTION;
            clientDrawingEffect: IUnknown): HResult; stdcall;
        function DrawUnderline(clientDrawingContext: Pointer; baselineOriginX: single; baselineOriginY: single;
            orientationAngle: TDWRITE_GLYPH_ORIENTATION_ANGLE; const underline: TDWRITE_UNDERLINE; clientDrawingEffect: IUnknown): HResult; stdcall;
        function DrawStrikethrough(clientDrawingContext: Pointer; baselineOriginX: single; baselineOriginY: single;
            orientationAngle: TDWRITE_GLYPH_ORIENTATION_ANGLE; const strikethrough: TDWRITE_STRIKETHROUGH;
            clientDrawingEffect: IUnknown): HResult; stdcall;
        function DrawInlineObject(clientDrawingContext: Pointer; originX: single; originY: single;
            orientationAngle: TDWRITE_GLYPH_ORIENTATION_ANGLE; inlineObject: IDWriteInlineObject; isSideways: longbool;
            isRightToLeft: longbool; clientDrawingEffect: IUnknown): HResult; stdcall;
    end;


    IDWriteTextFormat1 = interface(IDWriteTextFormat)
        ['{5F174B49-0D8B-4CFB-8BCA-F1CCE9D06C67}']
        function SetVerticalGlyphOrientation(glyphOrientation: TDWRITE_VERTICAL_GLYPH_ORIENTATION): HResult; stdcall;
        function GetVerticalGlyphOrientation(): TDWRITE_VERTICAL_GLYPH_ORIENTATION; stdcall;
        function SetLastLineWrapping(isLastLineWrappingEnabled: longbool): HResult; stdcall;
        function GetLastLineWrapping(): longbool; stdcall;
        function SetOpticalAlignment(opticalAlignment: TDWRITE_OPTICAL_ALIGNMENT): HResult; stdcall;
        function GetOpticalAlignment(): TDWRITE_OPTICAL_ALIGNMENT; stdcall;
        function SetFontFallback(fontFallback: IDWriteFontFallback): HResult; stdcall;
        function GetFontFallback(out fontFallback: IDWriteFontFallback): HResult; stdcall;
    end;



    IDWriteTextLayout2 = interface(IDWriteTextLayout1)
        ['{1093C18F-8D5E-43F0-B064-0917311B525E}']
        function GetMetrics(out textMetrics: TDWRITE_TEXT_METRICS1): HResult; stdcall;
        function SetVerticalGlyphOrientation(glyphOrientation: TDWRITE_VERTICAL_GLYPH_ORIENTATION): HResult; stdcall;
        function GetVerticalGlyphOrientation(): TDWRITE_VERTICAL_GLYPH_ORIENTATION; stdcall;
        function SetLastLineWrapping(isLastLineWrappingEnabled: longbool): HResult; stdcall;
        function GetLastLineWrapping(): longbool; stdcall;
        function SetOpticalAlignment(opticalAlignment: TDWRITE_OPTICAL_ALIGNMENT): HResult; stdcall;
        function GetOpticalAlignment(): TDWRITE_OPTICAL_ALIGNMENT; stdcall;
        function SetFontFallback(fontFallback: IDWriteFontFallback): HResult; stdcall;
        function GetFontFallback(out fontFallback: IDWriteFontFallback): HResult; stdcall;
    end;



    IDWriteTextAnalyzer2 = interface(IDWriteTextAnalyzer1)
        ['{553A9FF3-5693-4DF7-B52B-74806F7F2EB9}']
        function GetGlyphOrientationTransform(glyphOrientationAngle: TDWRITE_GLYPH_ORIENTATION_ANGLE;
            isSideways: longbool; originX: single; originY: single; out transform: TDWRITE_MATRIX): HResult; stdcall;
        function GetTypographicFeatures(fontFace: IDWriteFontFace; scriptAnalysis: TDWRITE_SCRIPT_ANALYSIS;
            localeName: PWideChar; maxTagCount: UINT32; out actualTagCount: UINT32; out tags: PDWRITE_FONT_FEATURE_TAG): HResult; stdcall;
        function CheckTypographicFeature(fontFace: IDWriteFontFace; scriptAnalysis: TDWRITE_SCRIPT_ANALYSIS;
            localeName: PWideChar; featureTag: TDWRITE_FONT_FEATURE_TAG; glyphCount: UINT32; glyphIndices: PUINT16;
            out featureApplies: PUINT8): HResult; stdcall;
    end;




    IDWriteFontFallback = interface(IUnknown)
        ['{EFA008F9-F7A1-48BF-B05C-F224713CC0FF}']
        function MapCharacters(analysisSource: IDWriteTextAnalysisSource; textPosition: UINT32; textLength: UINT32;
            baseFontCollection: IDWriteFontCollection; baseFamilyName: PWideChar; baseWeight: TDWRITE_FONT_WEIGHT;
            baseStyle: TDWRITE_FONT_STYLE; baseStretch: TDWRITE_FONT_STRETCH; out mappedLength: UINT32;
            out mappedFont: IDWriteFont; out scale: single): HResult; stdcall;
    end;



    IDWriteFontFallbackBuilder = interface(IUnknown)
        ['{FD882D06-8ABA-4FB8-B849-8BE8B73E14DE}']
        function AddMapping(ranges: PDWRITE_UNICODE_RANGE; rangesCount: UINT32; targetFamilyNames: PWideChar;
            targetFamilyNamesCount: UINT32; fontCollection: IDWriteFontCollection = nil; localeName: PWideChar = nil;
            baseFamilyName: PWideChar = nil; scale: single = 1.0): HResult; stdcall;
        function AddMappings(fontFallback: IDWriteFontFallback): HResult; stdcall;
        function CreateFontFallback(out fontFallback: IDWriteFontFallback): HResult; stdcall;
    end;




    IDWriteFont2 = interface(IDWriteFont1)
        ['{29748ed6-8c9c-4a6a-be0b-d912e8538944}']
        function IsColorFont(): longbool; stdcall;
    end;



    IDWriteFontFace2 = interface(IDWriteFontFace1)
        ['{d8b768ff-64bc-4e66-982b-ec8e87f693f7}']
        function IsColorFont(): longbool; stdcall;
        function GetColorPaletteCount(): UINT32; stdcall;
        function GetPaletteEntryCount(): UINT32; stdcall;
        function GetPaletteEntries(colorPaletteIndex: UINT32; firstEntryIndex: UINT32; entryCount: UINT32;
            out paletteEntries: PDWRITE_COLOR_F): HResult; stdcall;
        function GetRecommendedRenderingMode(fontEmSize: single; dpiX: single; dpiY: single; const transform: TDWRITE_MATRIX;
            isSideways: longbool; outlineThreshold: TDWRITE_OUTLINE_THRESHOLD; measuringMode: TDWRITE_MEASURING_MODE;
            renderingParams: IDWriteRenderingParams; out renderingMode: TDWRITE_RENDERING_MODE;
            out gridFitMode: TDWRITE_GRID_FIT_MODE): HResult; stdcall;
    end;



    TDWRITE_COLOR_GLYPH_RUN = record
        glyphRun: TDWRITE_GLYPH_RUN;
        glyphRunDescription: PDWRITE_GLYPH_RUN_DESCRIPTION;
        baselineOriginX: single;
        baselineOriginY: single;
        runColor: TDWRITE_COLOR_F;
        paletteIndex: UINT16;
    end;

    PDWRITE_COLOR_GLYPH_RUN = ^TDWRITE_COLOR_GLYPH_RUN;

    IDWriteColorGlyphRunEnumerator = interface(IUnknown)
        ['{d31fbe17-f157-41a2-8d24-cb779e0560e8}']
        function MoveNext(out hasRun: longbool): HResult; stdcall;
        function GetCurrentRun(out colorGlyphRun: PDWRITE_COLOR_GLYPH_RUN): HResult; stdcall;
    end;



    IDWriteRenderingParams2 = interface(IDWriteRenderingParams1)
        ['{F9D711C3-9777-40AE-87E8-3E5AF9BF0948}']
        function GetGridFitMode(): TDWRITE_GRID_FIT_MODE; stdcall;
    end;



    IDWriteFactory2 = interface(IDWriteFactory1)
        ['{0439fc60-ca44-4994-8dee-3a9af7b732ec}']
        function GetSystemFontFallback(out fontFallback: IDWriteFontFallback): HResult; stdcall;
        function CreateFontFallbackBuilder(out fontFallbackBuilder: IDWriteFontFallbackBuilder): HResult; stdcall;
        function TranslateColorGlyphRun(baselineOriginX: single; baselineOriginY: single; const glyphRun: TDWRITE_GLYPH_RUN;
            const glyphRunDescription: TDWRITE_GLYPH_RUN_DESCRIPTION; measuringMode: TDWRITE_MEASURING_MODE;
            const worldToDeviceTransform: TDWRITE_MATRIX; colorPaletteIndex: UINT32;
            out colorLayers: IDWriteColorGlyphRunEnumerator): HResult; stdcall;
        function CreateCustomRenderingParams(gamma: single; enhancedContrast: single; grayscaleEnhancedContrast: single;
            clearTypeLevel: single; pixelGeometry: TDWRITE_PIXEL_GEOMETRY; renderingMode: TDWRITE_RENDERING_MODE;
            gridFitMode: TDWRITE_GRID_FIT_MODE; out renderingParams: IDWriteRenderingParams2): HResult; stdcall;
        function CreateGlyphRunAnalysis(const glyphRun: TDWRITE_GLYPH_RUN; const transform: TDWRITE_MATRIX;
            renderingMode: TDWRITE_RENDERING_MODE; measuringMode: TDWRITE_MEASURING_MODE; gridFitMode: TDWRITE_GRID_FIT_MODE;
            antialiasMode: TDWRITE_TEXT_ANTIALIAS_MODE; baselineOriginX: single; baselineOriginY: single;
            out glyphRunAnalysis: IDWriteGlyphRunAnalysis): HResult; stdcall;
    end;


function DWriteCreateFactory(factoryType: TDWRITE_FACTORY_TYPE; const iid: TGUID; out factory): HResult;
    stdcall; external DWRITE_DLL;

function DWRITE_MAKE_OPENTYPE_TAG(a, b, c, d: uint8): UINT32;

implementation


// Creates an OpenType tag as a 32bit integer such that
// the first character in the tag is the lowest byte,
// (least significant on little endian architectures)
// which can be used to compare with tags in the font file.
// This macro is compatible with DWRITE_FONT_FEATURE_TAG.

// Example: DWRITE_MAKE_OPENTYPE_TAG('c','c','m','p')
// Dword:   $706D6363

function DWRITE_MAKE_OPENTYPE_TAG(a, b, c, d: uint8): UINT32;
begin
    Result := (d shl 24) or (c shl 16) or (b shl 8) or a;
end;


end.
