

-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.HarfBuzz.Functions
    ( 

 -- * Methods


-- ** aatLayoutFeatureTypeGetNameId #method:aatLayoutFeatureTypeGetNameId#

    aatLayoutFeatureTypeGetNameId           ,


-- ** aatLayoutFeatureTypeGetSelectorInfos #method:aatLayoutFeatureTypeGetSelectorInfos#

    aatLayoutFeatureTypeGetSelectorInfos    ,


-- ** aatLayoutGetFeatureTypes #method:aatLayoutGetFeatureTypes#

    aatLayoutGetFeatureTypes                ,


-- ** aatLayoutHasPositioning #method:aatLayoutHasPositioning#

    aatLayoutHasPositioning                 ,


-- ** aatLayoutHasSubstitution #method:aatLayoutHasSubstitution#

    aatLayoutHasSubstitution                ,


-- ** aatLayoutHasTracking #method:aatLayoutHasTracking#

    aatLayoutHasTracking                    ,


-- ** blobCopyWritableOrFail #method:blobCopyWritableOrFail#

    blobCopyWritableOrFail                  ,


-- ** blobCreateFromFile #method:blobCreateFromFile#

    blobCreateFromFile                      ,


-- ** blobCreateFromFileOrFail #method:blobCreateFromFileOrFail#

    blobCreateFromFileOrFail                ,


-- ** blobCreateSubBlob #method:blobCreateSubBlob#

    blobCreateSubBlob                       ,


-- ** blobGetData #method:blobGetData#

    blobGetData                             ,


-- ** blobGetDataWritable #method:blobGetDataWritable#

    blobGetDataWritable                     ,


-- ** blobGetEmpty #method:blobGetEmpty#

    blobGetEmpty                            ,


-- ** blobGetLength #method:blobGetLength#

    blobGetLength                           ,


-- ** blobIsImmutable #method:blobIsImmutable#

    blobIsImmutable                         ,


-- ** blobMakeImmutable #method:blobMakeImmutable#

    blobMakeImmutable                       ,


-- ** bufferAdd #method:bufferAdd#

    bufferAdd                               ,


-- ** bufferAddCodepoints #method:bufferAddCodepoints#

    bufferAddCodepoints                     ,


-- ** bufferAddLatin1 #method:bufferAddLatin1#

    bufferAddLatin1                         ,


-- ** bufferAddUtf16 #method:bufferAddUtf16#

    bufferAddUtf16                          ,


-- ** bufferAddUtf32 #method:bufferAddUtf32#

    bufferAddUtf32                          ,


-- ** bufferAddUtf8 #method:bufferAddUtf8#

    bufferAddUtf8                           ,


-- ** bufferAllocationSuccessful #method:bufferAllocationSuccessful#

    bufferAllocationSuccessful              ,


-- ** bufferAppend #method:bufferAppend#

    bufferAppend                            ,


-- ** bufferChanged #method:bufferChanged#

    bufferChanged                           ,


-- ** bufferClearContents #method:bufferClearContents#

    bufferClearContents                     ,


-- ** bufferCreate #method:bufferCreate#

    bufferCreate                            ,


-- ** bufferCreateSimilar #method:bufferCreateSimilar#

    bufferCreateSimilar                     ,


-- ** bufferDeserializeGlyphs #method:bufferDeserializeGlyphs#

    bufferDeserializeGlyphs                 ,


-- ** bufferDeserializeUnicode #method:bufferDeserializeUnicode#

    bufferDeserializeUnicode                ,


-- ** bufferDiff #method:bufferDiff#

    bufferDiff                              ,


-- ** bufferGetClusterLevel #method:bufferGetClusterLevel#

    bufferGetClusterLevel                   ,


-- ** bufferGetContentType #method:bufferGetContentType#

    bufferGetContentType                    ,


-- ** bufferGetDirection #method:bufferGetDirection#

    bufferGetDirection                      ,


-- ** bufferGetEmpty #method:bufferGetEmpty#

    bufferGetEmpty                          ,


-- ** bufferGetFlags #method:bufferGetFlags#

    bufferGetFlags                          ,


-- ** bufferGetGlyphInfos #method:bufferGetGlyphInfos#

    bufferGetGlyphInfos                     ,


-- ** bufferGetGlyphPositions #method:bufferGetGlyphPositions#

    bufferGetGlyphPositions                 ,


-- ** bufferGetInvisibleGlyph #method:bufferGetInvisibleGlyph#

    bufferGetInvisibleGlyph                 ,


-- ** bufferGetLanguage #method:bufferGetLanguage#

    bufferGetLanguage                       ,


-- ** bufferGetLength #method:bufferGetLength#

    bufferGetLength                         ,


-- ** bufferGetNotFoundGlyph #method:bufferGetNotFoundGlyph#

    bufferGetNotFoundGlyph                  ,


-- ** bufferGetNotFoundVariationSelectorGlyph #method:bufferGetNotFoundVariationSelectorGlyph#

    bufferGetNotFoundVariationSelectorGlyph ,


-- ** bufferGetRandomState #method:bufferGetRandomState#

    bufferGetRandomState                    ,


-- ** bufferGetReplacementCodepoint #method:bufferGetReplacementCodepoint#

    bufferGetReplacementCodepoint           ,


-- ** bufferGetScript #method:bufferGetScript#

    bufferGetScript                         ,


-- ** bufferGetSegmentProperties #method:bufferGetSegmentProperties#

    bufferGetSegmentProperties              ,


-- ** bufferGetUnicodeFuncs #method:bufferGetUnicodeFuncs#

    bufferGetUnicodeFuncs                   ,


-- ** bufferGuessSegmentProperties #method:bufferGuessSegmentProperties#

    bufferGuessSegmentProperties            ,


-- ** bufferHasPositions #method:bufferHasPositions#

    bufferHasPositions                      ,


-- ** bufferNormalizeGlyphs #method:bufferNormalizeGlyphs#

    bufferNormalizeGlyphs                   ,


-- ** bufferPreAllocate #method:bufferPreAllocate#

    bufferPreAllocate                       ,


-- ** bufferReset #method:bufferReset#

    bufferReset                             ,


-- ** bufferReverse #method:bufferReverse#

    bufferReverse                           ,


-- ** bufferReverseClusters #method:bufferReverseClusters#

    bufferReverseClusters                   ,


-- ** bufferReverseRange #method:bufferReverseRange#

    bufferReverseRange                      ,


-- ** bufferSerialize #method:bufferSerialize#

    bufferSerialize                         ,


-- ** bufferSerializeFormatFromString #method:bufferSerializeFormatFromString#

    bufferSerializeFormatFromString         ,


-- ** bufferSerializeFormatToString #method:bufferSerializeFormatToString#

    bufferSerializeFormatToString           ,


-- ** bufferSerializeGlyphs #method:bufferSerializeGlyphs#

    bufferSerializeGlyphs                   ,


-- ** bufferSerializeListFormats #method:bufferSerializeListFormats#

    bufferSerializeListFormats              ,


-- ** bufferSerializeUnicode #method:bufferSerializeUnicode#

    bufferSerializeUnicode                  ,


-- ** bufferSetClusterLevel #method:bufferSetClusterLevel#

    bufferSetClusterLevel                   ,


-- ** bufferSetContentType #method:bufferSetContentType#

    bufferSetContentType                    ,


-- ** bufferSetDirection #method:bufferSetDirection#

    bufferSetDirection                      ,


-- ** bufferSetFlags #method:bufferSetFlags#

    bufferSetFlags                          ,


-- ** bufferSetInvisibleGlyph #method:bufferSetInvisibleGlyph#

    bufferSetInvisibleGlyph                 ,


-- ** bufferSetLanguage #method:bufferSetLanguage#

    bufferSetLanguage                       ,


-- ** bufferSetLength #method:bufferSetLength#

    bufferSetLength                         ,


-- ** bufferSetNotFoundGlyph #method:bufferSetNotFoundGlyph#

    bufferSetNotFoundGlyph                  ,


-- ** bufferSetNotFoundVariationSelectorGlyph #method:bufferSetNotFoundVariationSelectorGlyph#

    bufferSetNotFoundVariationSelectorGlyph ,


-- ** bufferSetRandomState #method:bufferSetRandomState#

    bufferSetRandomState                    ,


-- ** bufferSetReplacementCodepoint #method:bufferSetReplacementCodepoint#

    bufferSetReplacementCodepoint           ,


-- ** bufferSetScript #method:bufferSetScript#

    bufferSetScript                         ,


-- ** bufferSetSegmentProperties #method:bufferSetSegmentProperties#

    bufferSetSegmentProperties              ,


-- ** bufferSetUnicodeFuncs #method:bufferSetUnicodeFuncs#

    bufferSetUnicodeFuncs                   ,


-- ** calloc #method:calloc#

    calloc                                  ,


-- ** colorGetAlpha #method:colorGetAlpha#

    colorGetAlpha                           ,


-- ** colorGetBlue #method:colorGetBlue#

    colorGetBlue                            ,


-- ** colorGetGreen #method:colorGetGreen#

    colorGetGreen                           ,


-- ** colorGetRed #method:colorGetRed#

    colorGetRed                             ,


-- ** colorLineGetColorStops #method:colorLineGetColorStops#

    colorLineGetColorStops                  ,


-- ** colorLineGetExtend #method:colorLineGetExtend#

    colorLineGetExtend                      ,


-- ** directionFromString #method:directionFromString#

    directionFromString                     ,


-- ** directionToString #method:directionToString#

    directionToString                       ,


-- ** drawCircle #method:drawCircle#

    drawCircle                              ,


-- ** drawClosePath #method:drawClosePath#

    drawClosePath                           ,


-- ** drawCubicTo #method:drawCubicTo#

    drawCubicTo                             ,


-- ** drawFuncsCreate #method:drawFuncsCreate#

    drawFuncsCreate                         ,


-- ** drawFuncsGetEmpty #method:drawFuncsGetEmpty#

    drawFuncsGetEmpty                       ,


-- ** drawFuncsIsImmutable #method:drawFuncsIsImmutable#

    drawFuncsIsImmutable                    ,


-- ** drawFuncsMakeImmutable #method:drawFuncsMakeImmutable#

    drawFuncsMakeImmutable                  ,


-- ** drawLine #method:drawLine#

    drawLine                                ,


-- ** drawLineTo #method:drawLineTo#

    drawLineTo                              ,


-- ** drawMoveTo #method:drawMoveTo#

    drawMoveTo                              ,


-- ** drawQuadraticTo #method:drawQuadraticTo#

    drawQuadraticTo                         ,


-- ** drawRectangle #method:drawRectangle#

    drawRectangle                           ,


-- ** faceBuilderAddTable #method:faceBuilderAddTable#

    faceBuilderAddTable                     ,


-- ** faceBuilderCreate #method:faceBuilderCreate#

    faceBuilderCreate                       ,


-- ** faceBuilderSortTables #method:faceBuilderSortTables#

    faceBuilderSortTables                   ,


-- ** faceCount #method:faceCount#

    faceCount                               ,


-- ** faceCreate #method:faceCreate#

    faceCreate                              ,


-- ** faceCreateFromFileOrFail #method:faceCreateFromFileOrFail#

    faceCreateFromFileOrFail                ,


-- ** faceCreateFromFileOrFailUsing #method:faceCreateFromFileOrFailUsing#

    faceCreateFromFileOrFailUsing           ,


-- ** faceCreateOrFail #method:faceCreateOrFail#

    faceCreateOrFail                        ,


-- ** faceCreateOrFailUsing #method:faceCreateOrFailUsing#

    faceCreateOrFailUsing                   ,


-- ** faceGetEmpty #method:faceGetEmpty#

    faceGetEmpty                            ,


-- ** faceGetGlyphCount #method:faceGetGlyphCount#

    faceGetGlyphCount                       ,


-- ** faceGetIndex #method:faceGetIndex#

    faceGetIndex                            ,


-- ** faceGetTableTags #method:faceGetTableTags#

    faceGetTableTags                        ,


-- ** faceGetUpem #method:faceGetUpem#

    faceGetUpem                             ,


-- ** faceIsImmutable #method:faceIsImmutable#

    faceIsImmutable                         ,


-- ** faceListLoaders #method:faceListLoaders#

    faceListLoaders                         ,


-- ** faceMakeImmutable #method:faceMakeImmutable#

    faceMakeImmutable                       ,


-- ** faceReferenceBlob #method:faceReferenceBlob#

    faceReferenceBlob                       ,


-- ** faceReferenceTable #method:faceReferenceTable#

    faceReferenceTable                      ,


-- ** faceSetGlyphCount #method:faceSetGlyphCount#

    faceSetGlyphCount                       ,


-- ** faceSetIndex #method:faceSetIndex#

    faceSetIndex                            ,


-- ** faceSetUpem #method:faceSetUpem#

    faceSetUpem                             ,


-- ** featureFromString #method:featureFromString#

    featureFromString                       ,


-- ** featureToString #method:featureToString#

    featureToString                         ,


-- ** fontAddGlyphOriginForDirection #method:fontAddGlyphOriginForDirection#

    fontAddGlyphOriginForDirection          ,


-- ** fontChanged #method:fontChanged#

    fontChanged                             ,


-- ** fontCreate #method:fontCreate#

    fontCreate                              ,


-- ** fontCreateSubFont #method:fontCreateSubFont#

    fontCreateSubFont                       ,


-- ** fontDrawGlyph #method:fontDrawGlyph#

    fontDrawGlyph                           ,


-- ** fontDrawGlyphOrFail #method:fontDrawGlyphOrFail#

    fontDrawGlyphOrFail                     ,


-- ** fontFuncsCreate #method:fontFuncsCreate#

    fontFuncsCreate                         ,


-- ** fontFuncsGetEmpty #method:fontFuncsGetEmpty#

    fontFuncsGetEmpty                       ,


-- ** fontFuncsIsImmutable #method:fontFuncsIsImmutable#

    fontFuncsIsImmutable                    ,


-- ** fontFuncsMakeImmutable #method:fontFuncsMakeImmutable#

    fontFuncsMakeImmutable                  ,


-- ** fontGetEmpty #method:fontGetEmpty#

    fontGetEmpty                            ,


-- ** fontGetExtentsForDirection #method:fontGetExtentsForDirection#

    fontGetExtentsForDirection              ,


-- ** fontGetFace #method:fontGetFace#

    fontGetFace                             ,


-- ** fontGetGlyph #method:fontGetGlyph#

    fontGetGlyph                            ,


-- ** fontGetGlyphAdvanceForDirection #method:fontGetGlyphAdvanceForDirection#

    fontGetGlyphAdvanceForDirection         ,


-- ** fontGetGlyphAdvancesForDirection #method:fontGetGlyphAdvancesForDirection#

    fontGetGlyphAdvancesForDirection        ,


-- ** fontGetGlyphContourPoint #method:fontGetGlyphContourPoint#

    fontGetGlyphContourPoint                ,


-- ** fontGetGlyphContourPointForOrigin #method:fontGetGlyphContourPointForOrigin#

    fontGetGlyphContourPointForOrigin       ,


-- ** fontGetGlyphExtents #method:fontGetGlyphExtents#

    fontGetGlyphExtents                     ,


-- ** fontGetGlyphExtentsForOrigin #method:fontGetGlyphExtentsForOrigin#

    fontGetGlyphExtentsForOrigin            ,


-- ** fontGetGlyphFromName #method:fontGetGlyphFromName#

    fontGetGlyphFromName                    ,


-- ** fontGetGlyphHAdvance #method:fontGetGlyphHAdvance#

    fontGetGlyphHAdvance                    ,


-- ** fontGetGlyphHAdvances #method:fontGetGlyphHAdvances#

    fontGetGlyphHAdvances                   ,


-- ** fontGetGlyphHKerning #method:fontGetGlyphHKerning#

    fontGetGlyphHKerning                    ,


-- ** fontGetGlyphHOrigin #method:fontGetGlyphHOrigin#

    fontGetGlyphHOrigin                     ,


-- ** fontGetGlyphHOrigins #method:fontGetGlyphHOrigins#

    fontGetGlyphHOrigins                    ,


-- ** fontGetGlyphKerningForDirection #method:fontGetGlyphKerningForDirection#

    fontGetGlyphKerningForDirection         ,


-- ** fontGetGlyphName #method:fontGetGlyphName#

    fontGetGlyphName                        ,


-- ** fontGetGlyphOriginForDirection #method:fontGetGlyphOriginForDirection#

    fontGetGlyphOriginForDirection          ,


-- ** fontGetGlyphShape #method:fontGetGlyphShape#

    fontGetGlyphShape                       ,


-- ** fontGetGlyphVAdvance #method:fontGetGlyphVAdvance#

    fontGetGlyphVAdvance                    ,


-- ** fontGetGlyphVAdvances #method:fontGetGlyphVAdvances#

    fontGetGlyphVAdvances                   ,


-- ** fontGetGlyphVKerning #method:fontGetGlyphVKerning#

    fontGetGlyphVKerning                    ,


-- ** fontGetGlyphVOrigin #method:fontGetGlyphVOrigin#

    fontGetGlyphVOrigin                     ,


-- ** fontGetGlyphVOrigins #method:fontGetGlyphVOrigins#

    fontGetGlyphVOrigins                    ,


-- ** fontGetHExtents #method:fontGetHExtents#

    fontGetHExtents                         ,


-- ** fontGetNominalGlyph #method:fontGetNominalGlyph#

    fontGetNominalGlyph                     ,


-- ** fontGetNominalGlyphs #method:fontGetNominalGlyphs#

    fontGetNominalGlyphs                    ,


-- ** fontGetParent #method:fontGetParent#

    fontGetParent                           ,


-- ** fontGetPpem #method:fontGetPpem#

    fontGetPpem                             ,


-- ** fontGetPtem #method:fontGetPtem#

    fontGetPtem                             ,


-- ** fontGetScale #method:fontGetScale#

    fontGetScale                            ,


-- ** fontGetSerial #method:fontGetSerial#

    fontGetSerial                           ,


-- ** fontGetSyntheticBold #method:fontGetSyntheticBold#

    fontGetSyntheticBold                    ,


-- ** fontGetSyntheticSlant #method:fontGetSyntheticSlant#

    fontGetSyntheticSlant                   ,


-- ** fontGetVExtents #method:fontGetVExtents#

    fontGetVExtents                         ,


-- ** fontGetVarCoordsDesign #method:fontGetVarCoordsDesign#

    fontGetVarCoordsDesign                  ,


-- ** fontGetVarCoordsNormalized #method:fontGetVarCoordsNormalized#

    fontGetVarCoordsNormalized              ,


-- ** fontGetVarNamedInstance #method:fontGetVarNamedInstance#

    fontGetVarNamedInstance                 ,


-- ** fontGetVariationGlyph #method:fontGetVariationGlyph#

    fontGetVariationGlyph                   ,


-- ** fontGlyphFromString #method:fontGlyphFromString#

    fontGlyphFromString                     ,


-- ** fontGlyphToString #method:fontGlyphToString#

    fontGlyphToString                       ,


-- ** fontIsImmutable #method:fontIsImmutable#

    fontIsImmutable                         ,


-- ** fontIsSynthetic #method:fontIsSynthetic#

    fontIsSynthetic                         ,


-- ** fontListFuncs #method:fontListFuncs#

    fontListFuncs                           ,


-- ** fontMakeImmutable #method:fontMakeImmutable#

    fontMakeImmutable                       ,


-- ** fontPaintGlyph #method:fontPaintGlyph#

    fontPaintGlyph                          ,


-- ** fontPaintGlyphOrFail #method:fontPaintGlyphOrFail#

    fontPaintGlyphOrFail                    ,


-- ** fontSetFace #method:fontSetFace#

    fontSetFace                             ,


-- ** fontSetFuncs #method:fontSetFuncs#

    fontSetFuncs                            ,


-- ** fontSetFuncsData #method:fontSetFuncsData#

    fontSetFuncsData                        ,


-- ** fontSetFuncsUsing #method:fontSetFuncsUsing#

    fontSetFuncsUsing                       ,


-- ** fontSetParent #method:fontSetParent#

    fontSetParent                           ,


-- ** fontSetPpem #method:fontSetPpem#

    fontSetPpem                             ,


-- ** fontSetPtem #method:fontSetPtem#

    fontSetPtem                             ,


-- ** fontSetScale #method:fontSetScale#

    fontSetScale                            ,


-- ** fontSetSyntheticBold #method:fontSetSyntheticBold#

    fontSetSyntheticBold                    ,


-- ** fontSetSyntheticSlant #method:fontSetSyntheticSlant#

    fontSetSyntheticSlant                   ,


-- ** fontSetVarCoordsDesign #method:fontSetVarCoordsDesign#

    fontSetVarCoordsDesign                  ,


-- ** fontSetVarCoordsNormalized #method:fontSetVarCoordsNormalized#

    fontSetVarCoordsNormalized              ,


-- ** fontSetVarNamedInstance #method:fontSetVarNamedInstance#

    fontSetVarNamedInstance                 ,


-- ** fontSetVariation #method:fontSetVariation#

    fontSetVariation                        ,


-- ** fontSetVariations #method:fontSetVariations#

    fontSetVariations                       ,


-- ** fontSubtractGlyphOriginForDirection #method:fontSubtractGlyphOriginForDirection#

    fontSubtractGlyphOriginForDirection     ,


-- ** free #method:free#

    free                                    ,


-- ** ftFaceCreate #method:ftFaceCreate#

    ftFaceCreate                            ,


-- ** ftFaceCreateCached #method:ftFaceCreateCached#

    ftFaceCreateCached                      ,


-- ** ftFaceCreateFromBlobOrFail #method:ftFaceCreateFromBlobOrFail#

    ftFaceCreateFromBlobOrFail              ,


-- ** ftFaceCreateFromFileOrFail #method:ftFaceCreateFromFileOrFail#

    ftFaceCreateFromFileOrFail              ,


-- ** ftFaceCreateReferenced #method:ftFaceCreateReferenced#

    ftFaceCreateReferenced                  ,


-- ** ftFontChanged #method:ftFontChanged#

    ftFontChanged                           ,


-- ** ftFontCreate #method:ftFontCreate#

    ftFontCreate                            ,


-- ** ftFontCreateReferenced #method:ftFontCreateReferenced#

    ftFontCreateReferenced                  ,


-- ** ftFontGetLoadFlags #method:ftFontGetLoadFlags#

    ftFontGetLoadFlags                      ,


-- ** ftFontSetFuncs #method:ftFontSetFuncs#

    ftFontSetFuncs                          ,


-- ** ftFontSetLoadFlags #method:ftFontSetLoadFlags#

    ftFontSetLoadFlags                      ,


-- ** ftHbFontChanged #method:ftHbFontChanged#

    ftHbFontChanged                         ,


-- ** glibBlobCreate #method:glibBlobCreate#

    glibBlobCreate                          ,


-- ** glibGetUnicodeFuncs #method:glibGetUnicodeFuncs#

    glibGetUnicodeFuncs                     ,


-- ** glibScriptFromScript #method:glibScriptFromScript#

    glibScriptFromScript                    ,


-- ** glibScriptToScript #method:glibScriptToScript#

    glibScriptToScript                      ,


-- ** glyphInfoGetGlyphFlags #method:glyphInfoGetGlyphFlags#

    glyphInfoGetGlyphFlags                  ,


-- ** languageFromString #method:languageFromString#

    languageFromString                      ,


-- ** languageGetDefault #method:languageGetDefault#

    languageGetDefault                      ,


-- ** languageMatches #method:languageMatches#

    languageMatches                         ,


-- ** languageToString #method:languageToString#

    languageToString                        ,


-- ** malloc #method:malloc#

    malloc                                  ,


-- ** mapAllocationSuccessful #method:mapAllocationSuccessful#

    mapAllocationSuccessful                 ,


-- ** mapClear #method:mapClear#

    mapClear                                ,


-- ** mapCopy #method:mapCopy#

    mapCopy                                 ,


-- ** mapCreate #method:mapCreate#

    mapCreate                               ,


-- ** mapDel #method:mapDel#

    mapDel                                  ,


-- ** mapGet #method:mapGet#

    mapGet                                  ,


-- ** mapGetEmpty #method:mapGetEmpty#

    mapGetEmpty                             ,


-- ** mapGetPopulation #method:mapGetPopulation#

    mapGetPopulation                        ,


-- ** mapHas #method:mapHas#

    mapHas                                  ,


-- ** mapHash #method:mapHash#

    mapHash                                 ,


-- ** mapIsEmpty #method:mapIsEmpty#

    mapIsEmpty                              ,


-- ** mapIsEqual #method:mapIsEqual#

    mapIsEqual                              ,


-- ** mapKeys #method:mapKeys#

    mapKeys                                 ,


-- ** mapNext #method:mapNext#

    mapNext                                 ,


-- ** mapSet #method:mapSet#

    mapSet                                  ,


-- ** mapUpdate #method:mapUpdate#

    mapUpdate                               ,


-- ** mapValues #method:mapValues#

    mapValues                               ,


-- ** otColorGetSvgDocumentCount #method:otColorGetSvgDocumentCount#

    otColorGetSvgDocumentCount              ,


-- ** otColorGetSvgDocumentGlyphRange #method:otColorGetSvgDocumentGlyphRange#

    otColorGetSvgDocumentGlyphRange         ,


-- ** otColorGlyphGetLayers #method:otColorGlyphGetLayers#

    otColorGlyphGetLayers                   ,


-- ** otColorGlyphGetSvgDocumentIndex #method:otColorGlyphGetSvgDocumentIndex#

    otColorGlyphGetSvgDocumentIndex         ,


-- ** otColorGlyphHasPaint #method:otColorGlyphHasPaint#

    otColorGlyphHasPaint                    ,


-- ** otColorGlyphReferencePng #method:otColorGlyphReferencePng#

    otColorGlyphReferencePng                ,


-- ** otColorGlyphReferenceSvg #method:otColorGlyphReferenceSvg#

    otColorGlyphReferenceSvg                ,


-- ** otColorHasLayers #method:otColorHasLayers#

    otColorHasLayers                        ,


-- ** otColorHasPaint #method:otColorHasPaint#

    otColorHasPaint                         ,


-- ** otColorHasPalettes #method:otColorHasPalettes#

    otColorHasPalettes                      ,


-- ** otColorHasPng #method:otColorHasPng#

    otColorHasPng                           ,


-- ** otColorHasSvg #method:otColorHasSvg#

    otColorHasSvg                           ,


-- ** otColorPaletteColorGetNameId #method:otColorPaletteColorGetNameId#

    otColorPaletteColorGetNameId            ,


-- ** otColorPaletteGetColors #method:otColorPaletteGetColors#

    otColorPaletteGetColors                 ,


-- ** otColorPaletteGetCount #method:otColorPaletteGetCount#

    otColorPaletteGetCount                  ,


-- ** otColorPaletteGetFlags #method:otColorPaletteGetFlags#

    otColorPaletteGetFlags                  ,


-- ** otColorPaletteGetNameId #method:otColorPaletteGetNameId#

    otColorPaletteGetNameId                 ,


-- ** otFetchBits #method:otFetchBits#

    otFetchBits                             ,


-- ** otFetchNumber #method:otFetchNumber#

    otFetchNumber                           ,


-- ** otFontSetFuncs #method:otFontSetFuncs#

    otFontSetFuncs                          ,


-- ** otLayoutFeatureGetCharacters #method:otLayoutFeatureGetCharacters#

    otLayoutFeatureGetCharacters            ,


-- ** otLayoutFeatureGetLookups #method:otLayoutFeatureGetLookups#

    otLayoutFeatureGetLookups               ,


-- ** otLayoutFeatureGetNameIds #method:otLayoutFeatureGetNameIds#

    otLayoutFeatureGetNameIds               ,


-- ** otLayoutFeatureWithVariationsGetLookups #method:otLayoutFeatureWithVariationsGetLookups#

    otLayoutFeatureWithVariationsGetLookups ,


-- ** otLayoutGetAttachPoints #method:otLayoutGetAttachPoints#

    otLayoutGetAttachPoints                 ,


-- ** otLayoutGetBaseline #method:otLayoutGetBaseline#

    otLayoutGetBaseline                     ,


-- ** otLayoutGetBaseline2 #method:otLayoutGetBaseline2#

    otLayoutGetBaseline2                    ,


-- ** otLayoutGetBaselineWithFallback #method:otLayoutGetBaselineWithFallback#

    otLayoutGetBaselineWithFallback         ,


-- ** otLayoutGetBaselineWithFallback2 #method:otLayoutGetBaselineWithFallback2#

    otLayoutGetBaselineWithFallback2        ,


-- ** otLayoutGetFontExtents #method:otLayoutGetFontExtents#

    otLayoutGetFontExtents                  ,


-- ** otLayoutGetFontExtents2 #method:otLayoutGetFontExtents2#

    otLayoutGetFontExtents2                 ,


-- ** otLayoutGetGlyphClass #method:otLayoutGetGlyphClass#

    otLayoutGetGlyphClass                   ,


-- ** otLayoutGetHorizontalBaselineTagForScript #method:otLayoutGetHorizontalBaselineTagForScript#

    otLayoutGetHorizontalBaselineTagForScript,


-- ** otLayoutGetLigatureCarets #method:otLayoutGetLigatureCarets#

    otLayoutGetLigatureCarets               ,


-- ** otLayoutGetSizeParams #method:otLayoutGetSizeParams#

    otLayoutGetSizeParams                   ,


-- ** otLayoutHasGlyphClasses #method:otLayoutHasGlyphClasses#

    otLayoutHasGlyphClasses                 ,


-- ** otLayoutHasPositioning #method:otLayoutHasPositioning#

    otLayoutHasPositioning                  ,


-- ** otLayoutHasSubstitution #method:otLayoutHasSubstitution#

    otLayoutHasSubstitution                 ,


-- ** otLayoutLanguageFindFeature #method:otLayoutLanguageFindFeature#

    otLayoutLanguageFindFeature             ,


-- ** otLayoutLanguageGetFeatureIndexes #method:otLayoutLanguageGetFeatureIndexes#

    otLayoutLanguageGetFeatureIndexes       ,


-- ** otLayoutLanguageGetFeatureTags #method:otLayoutLanguageGetFeatureTags#

    otLayoutLanguageGetFeatureTags          ,


-- ** otLayoutLanguageGetRequiredFeature #method:otLayoutLanguageGetRequiredFeature#

    otLayoutLanguageGetRequiredFeature      ,


-- ** otLayoutLanguageGetRequiredFeatureIndex #method:otLayoutLanguageGetRequiredFeatureIndex#

    otLayoutLanguageGetRequiredFeatureIndex ,


-- ** otLayoutLookupGetGlyphAlternates #method:otLayoutLookupGetGlyphAlternates#

    otLayoutLookupGetGlyphAlternates        ,


-- ** otLayoutLookupGetOpticalBound #method:otLayoutLookupGetOpticalBound#

    otLayoutLookupGetOpticalBound           ,


-- ** otLayoutLookupWouldSubstitute #method:otLayoutLookupWouldSubstitute#

    otLayoutLookupWouldSubstitute           ,


-- ** otLayoutScriptFindLanguage #method:otLayoutScriptFindLanguage#

    otLayoutScriptFindLanguage              ,


-- ** otLayoutScriptGetLanguageTags #method:otLayoutScriptGetLanguageTags#

    otLayoutScriptGetLanguageTags           ,


-- ** otLayoutScriptSelectLanguage #method:otLayoutScriptSelectLanguage#

    otLayoutScriptSelectLanguage            ,


-- ** otLayoutScriptSelectLanguage2 #method:otLayoutScriptSelectLanguage2#

    otLayoutScriptSelectLanguage2           ,


-- ** otLayoutTableChooseScript #method:otLayoutTableChooseScript#

    otLayoutTableChooseScript               ,


-- ** otLayoutTableFindFeatureVariations #method:otLayoutTableFindFeatureVariations#

    otLayoutTableFindFeatureVariations      ,


-- ** otLayoutTableFindScript #method:otLayoutTableFindScript#

    otLayoutTableFindScript                 ,


-- ** otLayoutTableGetFeatureTags #method:otLayoutTableGetFeatureTags#

    otLayoutTableGetFeatureTags             ,


-- ** otLayoutTableGetLookupCount #method:otLayoutTableGetLookupCount#

    otLayoutTableGetLookupCount             ,


-- ** otLayoutTableGetScriptTags #method:otLayoutTableGetScriptTags#

    otLayoutTableGetScriptTags              ,


-- ** otLayoutTableSelectScript #method:otLayoutTableSelectScript#

    otLayoutTableSelectScript               ,


-- ** otMathGetConstant #method:otMathGetConstant#

    otMathGetConstant                       ,


-- ** otMathGetGlyphAssembly #method:otMathGetGlyphAssembly#

    otMathGetGlyphAssembly                  ,


-- ** otMathGetGlyphItalicsCorrection #method:otMathGetGlyphItalicsCorrection#

    otMathGetGlyphItalicsCorrection         ,


-- ** otMathGetGlyphKerning #method:otMathGetGlyphKerning#

    otMathGetGlyphKerning                   ,


-- ** otMathGetGlyphKernings #method:otMathGetGlyphKernings#

    otMathGetGlyphKernings                  ,


-- ** otMathGetGlyphTopAccentAttachment #method:otMathGetGlyphTopAccentAttachment#

    otMathGetGlyphTopAccentAttachment       ,


-- ** otMathGetGlyphVariants #method:otMathGetGlyphVariants#

    otMathGetGlyphVariants                  ,


-- ** otMathGetMinConnectorOverlap #method:otMathGetMinConnectorOverlap#

    otMathGetMinConnectorOverlap            ,


-- ** otMathHasData #method:otMathHasData#

    otMathHasData                           ,


-- ** otMathIsGlyphExtendedShape #method:otMathIsGlyphExtendedShape#

    otMathIsGlyphExtendedShape              ,


-- ** otMetaGetEntryTags #method:otMetaGetEntryTags#

    otMetaGetEntryTags                      ,


-- ** otMetaReferenceEntry #method:otMetaReferenceEntry#

    otMetaReferenceEntry                    ,


-- ** otMetricsGetPosition #method:otMetricsGetPosition#

    otMetricsGetPosition                    ,


-- ** otMetricsGetPositionWithFallback #method:otMetricsGetPositionWithFallback#

    otMetricsGetPositionWithFallback        ,


-- ** otMetricsGetVariation #method:otMetricsGetVariation#

    otMetricsGetVariation                   ,


-- ** otMetricsGetXVariation #method:otMetricsGetXVariation#

    otMetricsGetXVariation                  ,


-- ** otMetricsGetYVariation #method:otMetricsGetYVariation#

    otMetricsGetYVariation                  ,


-- ** otNameGetUtf16 #method:otNameGetUtf16#

    otNameGetUtf16                          ,


-- ** otNameGetUtf32 #method:otNameGetUtf32#

    otNameGetUtf32                          ,


-- ** otNameGetUtf8 #method:otNameGetUtf8#

    otNameGetUtf8                           ,


-- ** otNameListNames #method:otNameListNames#

    otNameListNames                         ,


-- ** otShapeGetBufferFormatSerial #method:otShapeGetBufferFormatSerial#

    otShapeGetBufferFormatSerial            ,


-- ** otShapePlanGetFeatureTags #method:otShapePlanGetFeatureTags#

    otShapePlanGetFeatureTags               ,


-- ** otTagFromLanguage #method:otTagFromLanguage#

    otTagFromLanguage                       ,


-- ** otTagToLanguage #method:otTagToLanguage#

    otTagToLanguage                         ,


-- ** otTagToScript #method:otTagToScript#

    otTagToScript                           ,


-- ** otTagsFromScript #method:otTagsFromScript#

    otTagsFromScript                        ,


-- ** otTagsFromScriptAndLanguage #method:otTagsFromScriptAndLanguage#

    otTagsFromScriptAndLanguage             ,


-- ** otVarFindAxis #method:otVarFindAxis#

    otVarFindAxis                           ,


-- ** otVarFindAxisInfo #method:otVarFindAxisInfo#

    otVarFindAxisInfo                       ,


-- ** otVarGetAxes #method:otVarGetAxes#

    otVarGetAxes                            ,


-- ** otVarGetAxisCount #method:otVarGetAxisCount#

    otVarGetAxisCount                       ,


-- ** otVarGetAxisInfos #method:otVarGetAxisInfos#

    otVarGetAxisInfos                       ,


-- ** otVarGetNamedInstanceCount #method:otVarGetNamedInstanceCount#

    otVarGetNamedInstanceCount              ,


-- ** otVarHasData #method:otVarHasData#

    otVarHasData                            ,


-- ** otVarNamedInstanceGetDesignCoords #method:otVarNamedInstanceGetDesignCoords#

    otVarNamedInstanceGetDesignCoords       ,


-- ** otVarNamedInstanceGetPostscriptNameId #method:otVarNamedInstanceGetPostscriptNameId#

    otVarNamedInstanceGetPostscriptNameId   ,


-- ** otVarNamedInstanceGetSubfamilyNameId #method:otVarNamedInstanceGetSubfamilyNameId#

    otVarNamedInstanceGetSubfamilyNameId    ,


-- ** otVarNormalizeCoords #method:otVarNormalizeCoords#

    otVarNormalizeCoords                    ,


-- ** otVarNormalizeVariations #method:otVarNormalizeVariations#

    otVarNormalizeVariations                ,


-- ** paintColor #method:paintColor#

    paintColor                              ,


-- ** paintColorGlyph #method:paintColorGlyph#

    paintColorGlyph                         ,


-- ** paintCustomPaletteColor #method:paintCustomPaletteColor#

    paintCustomPaletteColor                 ,


-- ** paintFillGlyph #method:paintFillGlyph#

    paintFillGlyph                          ,


-- ** paintFuncsCreate #method:paintFuncsCreate#

    paintFuncsCreate                        ,


-- ** paintFuncsGetEmpty #method:paintFuncsGetEmpty#

    paintFuncsGetEmpty                      ,


-- ** paintFuncsIsImmutable #method:paintFuncsIsImmutable#

    paintFuncsIsImmutable                   ,


-- ** paintFuncsMakeImmutable #method:paintFuncsMakeImmutable#

    paintFuncsMakeImmutable                 ,


-- ** paintImage #method:paintImage#

    paintImage                              ,


-- ** paintLinearGradient #method:paintLinearGradient#

    paintLinearGradient                     ,


-- ** paintNormalizeColorLine #method:paintNormalizeColorLine#

    paintNormalizeColorLine                 ,


-- ** paintPopClip #method:paintPopClip#

    paintPopClip                            ,


-- ** paintPopGroup #method:paintPopGroup#

    paintPopGroup                           ,


-- ** paintPopTransform #method:paintPopTransform#

    paintPopTransform                       ,


-- ** paintPushClipGlyph #method:paintPushClipGlyph#

    paintPushClipGlyph                      ,


-- ** paintPushClipPathEnd #method:paintPushClipPathEnd#

    paintPushClipPathEnd                    ,


-- ** paintPushClipPathStart #method:paintPushClipPathStart#

    paintPushClipPathStart                  ,


-- ** paintPushClipRectangle #method:paintPushClipRectangle#

    paintPushClipRectangle                  ,


-- ** paintPushFontTransform #method:paintPushFontTransform#

    paintPushFontTransform                  ,


-- ** paintPushGroup #method:paintPushGroup#

    paintPushGroup                          ,


-- ** paintPushGroupFor #method:paintPushGroupFor#

    paintPushGroupFor                       ,


-- ** paintPushInverseFontTransform #method:paintPushInverseFontTransform#

    paintPushInverseFontTransform           ,


-- ** paintPushTransform #method:paintPushTransform#

    paintPushTransform                      ,


-- ** paintRadialGradient #method:paintRadialGradient#

    paintRadialGradient                     ,


-- ** paintReduceLinearAnchors #method:paintReduceLinearAnchors#

    paintReduceLinearAnchors                ,


-- ** paintSweepGradient #method:paintSweepGradient#

    paintSweepGradient                      ,


-- ** paintSweepGradientTiles #method:paintSweepGradientTiles#

    paintSweepGradientTiles                 ,


-- ** realloc #method:realloc#

    realloc                                 ,


-- ** scriptFromIso15924Tag #method:scriptFromIso15924Tag#

    scriptFromIso15924Tag                   ,


-- ** scriptFromString #method:scriptFromString#

    scriptFromString                        ,


-- ** scriptGetHorizontalDirection #method:scriptGetHorizontalDirection#

    scriptGetHorizontalDirection            ,


-- ** scriptToIso15924Tag #method:scriptToIso15924Tag#

    scriptToIso15924Tag                     ,


-- ** segmentPropertiesEqual #method:segmentPropertiesEqual#

    segmentPropertiesEqual                  ,


-- ** segmentPropertiesHash #method:segmentPropertiesHash#

    segmentPropertiesHash                   ,


-- ** segmentPropertiesOverlay #method:segmentPropertiesOverlay#

    segmentPropertiesOverlay                ,


-- ** setAdd #method:setAdd#

    setAdd                                  ,


-- ** setAddRange #method:setAddRange#

    setAddRange                             ,


-- ** setAddSortedArray #method:setAddSortedArray#

    setAddSortedArray                       ,


-- ** setAllocationSuccessful #method:setAllocationSuccessful#

    setAllocationSuccessful                 ,


-- ** setClear #method:setClear#

    setClear                                ,


-- ** setCopy #method:setCopy#

    setCopy                                 ,


-- ** setCreate #method:setCreate#

    setCreate                               ,


-- ** setDel #method:setDel#

    setDel                                  ,


-- ** setDelRange #method:setDelRange#

    setDelRange                             ,


-- ** setGetEmpty #method:setGetEmpty#

    setGetEmpty                             ,


-- ** setGetMax #method:setGetMax#

    setGetMax                               ,


-- ** setGetMin #method:setGetMin#

    setGetMin                               ,


-- ** setGetPopulation #method:setGetPopulation#

    setGetPopulation                        ,


-- ** setHas #method:setHas#

    setHas                                  ,


-- ** setHash #method:setHash#

    setHash                                 ,


-- ** setIntersect #method:setIntersect#

    setIntersect                            ,


-- ** setIntersects #method:setIntersects#

    setIntersects                           ,


-- ** setInvert #method:setInvert#

    setInvert                               ,


-- ** setIsEmpty #method:setIsEmpty#

    setIsEmpty                              ,


-- ** setIsEqual #method:setIsEqual#

    setIsEqual                              ,


-- ** setIsInverted #method:setIsInverted#

    setIsInverted                           ,


-- ** setIsSubset #method:setIsSubset#

    setIsSubset                             ,


-- ** setNext #method:setNext#

    setNext                                 ,


-- ** setNextMany #method:setNextMany#

    setNextMany                             ,


-- ** setNextRange #method:setNextRange#

    setNextRange                            ,


-- ** setPrevious #method:setPrevious#

    setPrevious                             ,


-- ** setPreviousRange #method:setPreviousRange#

    setPreviousRange                        ,


-- ** setSet #method:setSet#

    setSet                                  ,


-- ** setSubtract #method:setSubtract#

    setSubtract                             ,


-- ** setSymmetricDifference #method:setSymmetricDifference#

    setSymmetricDifference                  ,


-- ** setUnion #method:setUnion#

    setUnion                                ,


-- ** shape #method:shape#

    shape                                   ,


-- ** shapeFull #method:shapeFull#

    shapeFull                               ,


-- ** shapeListShapers #method:shapeListShapers#

    shapeListShapers                        ,


-- ** shapePlanCreate #method:shapePlanCreate#

    shapePlanCreate                         ,


-- ** shapePlanCreate2 #method:shapePlanCreate2#

    shapePlanCreate2                        ,


-- ** shapePlanCreateCached #method:shapePlanCreateCached#

    shapePlanCreateCached                   ,


-- ** shapePlanCreateCached2 #method:shapePlanCreateCached2#

    shapePlanCreateCached2                  ,


-- ** shapePlanExecute #method:shapePlanExecute#

    shapePlanExecute                        ,


-- ** shapePlanGetEmpty #method:shapePlanGetEmpty#

    shapePlanGetEmpty                       ,


-- ** shapePlanGetShaper #method:shapePlanGetShaper#

    shapePlanGetShaper                      ,


-- ** styleGetValue #method:styleGetValue#

    styleGetValue                           ,


-- ** tagFromString #method:tagFromString#

    tagFromString                           ,


-- ** unicodeCombiningClass #method:unicodeCombiningClass#

    unicodeCombiningClass                   ,


-- ** unicodeCompose #method:unicodeCompose#

    unicodeCompose                          ,


-- ** unicodeDecompose #method:unicodeDecompose#

    unicodeDecompose                        ,


-- ** unicodeDecomposeCompatibility #method:unicodeDecomposeCompatibility#

    unicodeDecomposeCompatibility           ,


-- ** unicodeEastasianWidth #method:unicodeEastasianWidth#

    unicodeEastasianWidth                   ,


-- ** unicodeFuncsCreate #method:unicodeFuncsCreate#

    unicodeFuncsCreate                      ,


-- ** unicodeFuncsGetDefault #method:unicodeFuncsGetDefault#

    unicodeFuncsGetDefault                  ,


-- ** unicodeFuncsGetEmpty #method:unicodeFuncsGetEmpty#

    unicodeFuncsGetEmpty                    ,


-- ** unicodeFuncsGetParent #method:unicodeFuncsGetParent#

    unicodeFuncsGetParent                   ,


-- ** unicodeFuncsIsImmutable #method:unicodeFuncsIsImmutable#

    unicodeFuncsIsImmutable                 ,


-- ** unicodeFuncsMakeImmutable #method:unicodeFuncsMakeImmutable#

    unicodeFuncsMakeImmutable               ,


-- ** unicodeGeneralCategory #method:unicodeGeneralCategory#

    unicodeGeneralCategory                  ,


-- ** unicodeMirroring #method:unicodeMirroring#

    unicodeMirroring                        ,


-- ** unicodeScript #method:unicodeScript#

    unicodeScript                           ,


-- ** variationFromString #method:variationFromString#

    variationFromString                     ,


-- ** variationToString #method:variationToString#

    variationToString                       ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.Freetype2.Structs.Face as Freetype2.Face
import qualified GI.GLib.Enums as GLib.Enums
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.HarfBuzz.Callbacks as HarfBuzz.Callbacks
import {-# SOURCE #-} qualified GI.HarfBuzz.Enums as HarfBuzz.Enums
import {-# SOURCE #-} qualified GI.HarfBuzz.Flags as HarfBuzz.Flags
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.AatLayoutFeatureSelectorInfoT as HarfBuzz.AatLayoutFeatureSelectorInfoT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.BlobT as HarfBuzz.BlobT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.BufferT as HarfBuzz.BufferT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.ColorLineT as HarfBuzz.ColorLineT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.ColorStopT as HarfBuzz.ColorStopT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.DrawFuncsT as HarfBuzz.DrawFuncsT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.DrawStateT as HarfBuzz.DrawStateT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.FaceT as HarfBuzz.FaceT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.FeatureT as HarfBuzz.FeatureT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.FontExtentsT as HarfBuzz.FontExtentsT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.FontFuncsT as HarfBuzz.FontFuncsT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.FontT as HarfBuzz.FontT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.GlyphExtentsT as HarfBuzz.GlyphExtentsT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.GlyphInfoT as HarfBuzz.GlyphInfoT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.GlyphPositionT as HarfBuzz.GlyphPositionT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.LanguageT as HarfBuzz.LanguageT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.MapT as HarfBuzz.MapT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtColorLayerT as HarfBuzz.OtColorLayerT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtMathGlyphPartT as HarfBuzz.OtMathGlyphPartT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtMathGlyphVariantT as HarfBuzz.OtMathGlyphVariantT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtMathKernEntryT as HarfBuzz.OtMathKernEntryT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtNameEntryT as HarfBuzz.OtNameEntryT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtVarAxisInfoT as HarfBuzz.OtVarAxisInfoT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtVarAxisT as HarfBuzz.OtVarAxisT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.PaintFuncsT as HarfBuzz.PaintFuncsT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.SegmentPropertiesT as HarfBuzz.SegmentPropertiesT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.SetT as HarfBuzz.SetT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.ShapePlanT as HarfBuzz.ShapePlanT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.UnicodeFuncsT as HarfBuzz.UnicodeFuncsT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.VariationT as HarfBuzz.VariationT

#else
import qualified GI.Freetype2.Structs.Face as Freetype2.Face
import qualified GI.GLib.Enums as GLib.Enums
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.HarfBuzz.Callbacks as HarfBuzz.Callbacks
import {-# SOURCE #-} qualified GI.HarfBuzz.Enums as HarfBuzz.Enums
import {-# SOURCE #-} qualified GI.HarfBuzz.Flags as HarfBuzz.Flags
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.AatLayoutFeatureSelectorInfoT as HarfBuzz.AatLayoutFeatureSelectorInfoT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.BlobT as HarfBuzz.BlobT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.BufferT as HarfBuzz.BufferT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.ColorLineT as HarfBuzz.ColorLineT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.ColorStopT as HarfBuzz.ColorStopT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.DrawFuncsT as HarfBuzz.DrawFuncsT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.DrawStateT as HarfBuzz.DrawStateT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.FaceT as HarfBuzz.FaceT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.FeatureT as HarfBuzz.FeatureT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.FontExtentsT as HarfBuzz.FontExtentsT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.FontFuncsT as HarfBuzz.FontFuncsT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.FontT as HarfBuzz.FontT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.GlyphExtentsT as HarfBuzz.GlyphExtentsT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.GlyphInfoT as HarfBuzz.GlyphInfoT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.GlyphPositionT as HarfBuzz.GlyphPositionT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.LanguageT as HarfBuzz.LanguageT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.MapT as HarfBuzz.MapT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtColorLayerT as HarfBuzz.OtColorLayerT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtMathGlyphPartT as HarfBuzz.OtMathGlyphPartT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtMathGlyphVariantT as HarfBuzz.OtMathGlyphVariantT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtMathKernEntryT as HarfBuzz.OtMathKernEntryT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtNameEntryT as HarfBuzz.OtNameEntryT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtVarAxisInfoT as HarfBuzz.OtVarAxisInfoT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.OtVarAxisT as HarfBuzz.OtVarAxisT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.PaintFuncsT as HarfBuzz.PaintFuncsT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.SegmentPropertiesT as HarfBuzz.SegmentPropertiesT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.SetT as HarfBuzz.SetT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.ShapePlanT as HarfBuzz.ShapePlanT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.UnicodeFuncsT as HarfBuzz.UnicodeFuncsT
import {-# SOURCE #-} qualified GI.HarfBuzz.Structs.VariationT as HarfBuzz.VariationT

#endif

-- function variation_to_string
-- Args: [ Arg
--           { argCName = "variation"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "variation_t" }
--           , argCType = Just "hb_variation_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_variation_t to convert"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buf"
--           , argType = TCArray False (-1) 2 (TBasicType TUTF8)
--           , argCType = Just "char*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "output string" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the allocated size of @buf"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "size"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the allocated size of @buf"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_variation_to_string" hb_variation_to_string :: 
    Ptr HarfBuzz.VariationT.VariationT ->   -- variation : TInterface (Name {namespace = "HarfBuzz", name = "variation_t"})
    Ptr CString ->                          -- buf : TCArray False (-1) 2 (TBasicType TUTF8)
    Word32 ->                               -- size : TBasicType TUInt
    IO ()

-- | Converts an t'GI.HarfBuzz.Structs.VariationT.VariationT' into a @NULL@-terminated string in the format
-- understood by 'GI.HarfBuzz.Functions.variationFromString'. The client in responsible for
-- allocating big enough size for /@buf@/, 128 bytes is more than enough.
-- 
-- Note that the string won\'t include any whitespace.
-- 
-- /Since: 1.4.2/
variationToString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.VariationT.VariationT
    -- ^ /@variation@/: an t'GI.HarfBuzz.Structs.VariationT.VariationT' to convert
    -> [T.Text]
    -- ^ /@buf@/: output string
    -> m ([T.Text])
variationToString variation buf = liftIO $ do
    let size = fromIntegral $ P.length buf
    variation' <- unsafeManagedPtrGetPtr variation
    buf' <- packUTF8CArray buf
    hb_variation_to_string variation' buf' size
    buf'' <- (unpackUTF8CArrayWithLength size) buf'
    (mapCArrayWithLength size) freeMem buf'
    freeMem buf'
    touchManagedPtr variation
    return buf''


-- function variation_from_string
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a string to parse" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "length of @str, or -1 if string is `NULL` terminated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "variation"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "variation_t" }
--           , argCType = Just "hb_variation_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the #hb_variation_t to initialize with the parsed values"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "length of @str, or -1 if string is `NULL` terminated"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_variation_from_string" hb_variation_from_string :: 
    Ptr Word8 ->                            -- str : TCArray False (-1) 1 (TBasicType TUInt8)
    Int32 ->                                -- len : TBasicType TInt
    Ptr HarfBuzz.VariationT.VariationT ->   -- variation : TInterface (Name {namespace = "HarfBuzz", name = "variation_t"})
    IO Int32

-- | Parses a string into a t'GI.HarfBuzz.Structs.VariationT.VariationT'.
-- 
-- The format for specifying variation settings follows. All valid CSS
-- font-variation-settings values other than \'normal\' and \'inherited\' are also
-- accepted, though, not documented below.
-- 
-- The format is a tag, optionally followed by an equals sign, followed by a
-- number. For example @wght=500@, or @slnt=-7.5@.
-- 
-- /Since: 1.4.2/
variationFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@str@/: a string to parse
    -> m ((Int32, HarfBuzz.VariationT.VariationT))
    -- ^ __Returns:__ @true@ if /@str@/ is successfully parsed, @false@ otherwise
variationFromString str = liftIO $ do
    let len = fromIntegral $ B.length str
    str' <- packByteString str
    variation <- SP.callocBytes 8 :: IO (Ptr HarfBuzz.VariationT.VariationT)
    result <- hb_variation_from_string str' len variation
    variation' <- (wrapPtr HarfBuzz.VariationT.VariationT) variation
    freeMem str'
    return (result, variation')


-- function unicode_script
-- Args: [ Arg
--           { argCName = "ufuncs"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" }
--           , argCType = Just "hb_unicode_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "unicode"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The code point to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "script_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_script" hb_unicode_script :: 
    Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT -> -- ufuncs : TInterface (Name {namespace = "HarfBuzz", name = "unicode_funcs_t"})
    Word32 ->                               -- unicode : TBasicType TUInt32
    IO CUInt

-- | Retrieves the t'GI.HarfBuzz.Enums.ScriptT' script to which code
-- point /@unicode@/ belongs.
-- 
-- /Since: 0.9.2/
unicodeScript ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ /@ufuncs@/: The Unicode-functions structure
    -> Word32
    -- ^ /@unicode@/: The code point to query
    -> m HarfBuzz.Enums.ScriptT
    -- ^ __Returns:__ The t'GI.HarfBuzz.Enums.ScriptT' of /@unicode@/
unicodeScript ufuncs unicode = liftIO $ do
    ufuncs' <- unsafeManagedPtrGetPtr ufuncs
    result <- hb_unicode_script ufuncs' unicode
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr ufuncs
    return result'


-- function unicode_mirroring
-- Args: [ Arg
--           { argCName = "ufuncs"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" }
--           , argCType = Just "hb_unicode_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "unicode"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The code point to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_mirroring" hb_unicode_mirroring :: 
    Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT -> -- ufuncs : TInterface (Name {namespace = "HarfBuzz", name = "unicode_funcs_t"})
    Word32 ->                               -- unicode : TBasicType TUInt32
    IO Word32

-- | Retrieves the Bi-directional Mirroring Glyph code
-- point defined for code point /@unicode@/.
-- 
-- /Since: 0.9.2/
unicodeMirroring ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ /@ufuncs@/: The Unicode-functions structure
    -> Word32
    -- ^ /@unicode@/: The code point to query
    -> m Word32
    -- ^ __Returns:__ The @/hb_codepoint_t/@ of the Mirroring Glyph for /@unicode@/
unicodeMirroring ufuncs unicode = liftIO $ do
    ufuncs' <- unsafeManagedPtrGetPtr ufuncs
    result <- hb_unicode_mirroring ufuncs' unicode
    touchManagedPtr ufuncs
    return result


-- function unicode_general_category
-- Args: [ Arg
--           { argCName = "ufuncs"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" }
--           , argCType = Just "hb_unicode_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "unicode"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The code point to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name
--                    { namespace = "HarfBuzz" , name = "unicode_general_category_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_general_category" hb_unicode_general_category :: 
    Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT -> -- ufuncs : TInterface (Name {namespace = "HarfBuzz", name = "unicode_funcs_t"})
    Word32 ->                               -- unicode : TBasicType TUInt32
    IO CUInt

-- | Retrieves the General Category (gc) property
-- of code point /@unicode@/.
-- 
-- /Since: 0.9.2/
unicodeGeneralCategory ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ /@ufuncs@/: The Unicode-functions structure
    -> Word32
    -- ^ /@unicode@/: The code point to query
    -> m HarfBuzz.Enums.UnicodeGeneralCategoryT
    -- ^ __Returns:__ The t'GI.HarfBuzz.Enums.UnicodeGeneralCategoryT' of /@unicode@/
unicodeGeneralCategory ufuncs unicode = liftIO $ do
    ufuncs' <- unsafeManagedPtrGetPtr ufuncs
    result <- hb_unicode_general_category ufuncs' unicode
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr ufuncs
    return result'


-- function unicode_funcs_set_script_func
-- XXX Could not generate function unicode_funcs_set_script_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function unicode_funcs_set_mirroring_func
-- XXX Could not generate function unicode_funcs_set_mirroring_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function unicode_funcs_set_general_category_func
-- XXX Could not generate function unicode_funcs_set_general_category_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function unicode_funcs_set_eastasian_width_func
-- XXX Could not generate function unicode_funcs_set_eastasian_width_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function unicode_funcs_set_decompose_func
-- XXX Could not generate function unicode_funcs_set_decompose_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function unicode_funcs_set_decompose_compatibility_func
-- XXX Could not generate function unicode_funcs_set_decompose_compatibility_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function unicode_funcs_set_compose_func
-- XXX Could not generate function unicode_funcs_set_compose_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function unicode_funcs_set_combining_class_func
-- XXX Could not generate function unicode_funcs_set_combining_class_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function unicode_funcs_make_immutable
-- Args: [ Arg
--           { argCName = "ufuncs"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" }
--           , argCType = Just "hb_unicode_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_funcs_make_immutable" hb_unicode_funcs_make_immutable :: 
    Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT -> -- ufuncs : TInterface (Name {namespace = "HarfBuzz", name = "unicode_funcs_t"})
    IO ()

-- | Makes the specified Unicode-functions structure
-- immutable.
-- 
-- /Since: 0.9.2/
unicodeFuncsMakeImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ /@ufuncs@/: The Unicode-functions structure
    -> m ()
unicodeFuncsMakeImmutable ufuncs = liftIO $ do
    ufuncs' <- unsafeManagedPtrGetPtr ufuncs
    hb_unicode_funcs_make_immutable ufuncs'
    touchManagedPtr ufuncs
    return ()


-- function unicode_funcs_is_immutable
-- Args: [ Arg
--           { argCName = "ufuncs"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" }
--           , argCType = Just "hb_unicode_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_funcs_is_immutable" hb_unicode_funcs_is_immutable :: 
    Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT -> -- ufuncs : TInterface (Name {namespace = "HarfBuzz", name = "unicode_funcs_t"})
    IO Int32

-- | Tests whether the specified Unicode-functions structure
-- is immutable.
-- 
-- /Since: 0.9.2/
unicodeFuncsIsImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ /@ufuncs@/: The Unicode-functions structure
    -> m Int32
    -- ^ __Returns:__ @true@ if /@ufuncs@/ is immutable, @false@ otherwise
unicodeFuncsIsImmutable ufuncs = liftIO $ do
    ufuncs' <- unsafeManagedPtrGetPtr ufuncs
    result <- hb_unicode_funcs_is_immutable ufuncs'
    touchManagedPtr ufuncs
    return result


-- function unicode_funcs_get_parent
-- Args: [ Arg
--           { argCName = "ufuncs"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" }
--           , argCType = Just "hb_unicode_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_funcs_get_parent" hb_unicode_funcs_get_parent :: 
    Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT -> -- ufuncs : TInterface (Name {namespace = "HarfBuzz", name = "unicode_funcs_t"})
    IO (Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT)

-- | Fetches the parent of the Unicode-functions structure
-- /@ufuncs@/.
-- 
-- /Since: 0.9.2/
unicodeFuncsGetParent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ /@ufuncs@/: The Unicode-functions structure
    -> m HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ __Returns:__ The parent Unicode-functions structure
unicodeFuncsGetParent ufuncs = liftIO $ do
    ufuncs' <- unsafeManagedPtrGetPtr ufuncs
    result <- hb_unicode_funcs_get_parent ufuncs'
    checkUnexpectedReturnNULL "unicodeFuncsGetParent" result
    result' <- (wrapBoxed HarfBuzz.UnicodeFuncsT.UnicodeFuncsT) result
    touchManagedPtr ufuncs
    return result'


-- function unicode_funcs_get_empty
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_funcs_get_empty" hb_unicode_funcs_get_empty :: 
    IO (Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT)

-- | Fetches the singleton empty Unicode-functions structure.
-- 
-- /Since: 0.9.2/
unicodeFuncsGetEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ __Returns:__ The empty Unicode-functions structure
unicodeFuncsGetEmpty  = liftIO $ do
    result <- hb_unicode_funcs_get_empty
    checkUnexpectedReturnNULL "unicodeFuncsGetEmpty" result
    result' <- (wrapBoxed HarfBuzz.UnicodeFuncsT.UnicodeFuncsT) result
    return result'


-- function unicode_funcs_get_default
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_funcs_get_default" hb_unicode_funcs_get_default :: 
    IO (Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT)

-- | Fetches a pointer to the default Unicode-functions structure that is used
-- when no functions are explicitly set on t'GI.HarfBuzz.Structs.BufferT.BufferT'.
-- 
-- /Since: 0.9.2/
unicodeFuncsGetDefault ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ __Returns:__ a pointer to the t'GI.HarfBuzz.Structs.UnicodeFuncsT.UnicodeFuncsT' Unicode-functions structure
unicodeFuncsGetDefault  = liftIO $ do
    result <- hb_unicode_funcs_get_default
    checkUnexpectedReturnNULL "unicodeFuncsGetDefault" result
    result' <- (newBoxed HarfBuzz.UnicodeFuncsT.UnicodeFuncsT) result
    return result'


-- function unicode_funcs_create
-- Args: [ Arg
--           { argCName = "parent"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" }
--           , argCType = Just "hb_unicode_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Parent Unicode-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_funcs_create" hb_unicode_funcs_create :: 
    Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT -> -- parent : TInterface (Name {namespace = "HarfBuzz", name = "unicode_funcs_t"})
    IO (Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT)

-- | Creates a new t'GI.HarfBuzz.Structs.UnicodeFuncsT.UnicodeFuncsT' structure of Unicode functions.
-- 
-- /Since: 0.9.2/
unicodeFuncsCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (HarfBuzz.UnicodeFuncsT.UnicodeFuncsT)
    -- ^ /@parent@/: Parent Unicode-functions structure
    -> m HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ __Returns:__ The Unicode-functions structure
unicodeFuncsCreate parent = liftIO $ do
    maybeParent <- case parent of
        Nothing -> return FP.nullPtr
        Just jParent -> do
            jParent' <- unsafeManagedPtrGetPtr jParent
            return jParent'
    result <- hb_unicode_funcs_create maybeParent
    checkUnexpectedReturnNULL "unicodeFuncsCreate" result
    result' <- (wrapBoxed HarfBuzz.UnicodeFuncsT.UnicodeFuncsT) result
    whenJust parent touchManagedPtr
    return result'


-- function unicode_eastasian_width
-- Args: [ Arg
--           { argCName = "ufuncs"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" }
--           , argCType = Just "hb_unicode_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a Unicode-function structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "unicode"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The code point to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_eastasian_width" hb_unicode_eastasian_width :: 
    Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT -> -- ufuncs : TInterface (Name {namespace = "HarfBuzz", name = "unicode_funcs_t"})
    Word32 ->                               -- unicode : TBasicType TUInt32
    IO Word32

{-# DEPRECATED unicodeEastasianWidth ["(Since version 2.0.0)"] #-}
-- | Don\'t use. Not used by HarfBuzz.
-- 
-- /Since: 0.9.2/
unicodeEastasianWidth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ /@ufuncs@/: a Unicode-function structure
    -> Word32
    -- ^ /@unicode@/: The code point to query
    -> m Word32
unicodeEastasianWidth ufuncs unicode = liftIO $ do
    ufuncs' <- unsafeManagedPtrGetPtr ufuncs
    result <- hb_unicode_eastasian_width ufuncs' unicode
    touchManagedPtr ufuncs
    return result


-- function unicode_decompose_compatibility
-- Args: [ Arg
--           { argCName = "ufuncs"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" }
--           , argCType = Just "hb_unicode_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "u"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Code point to decompose"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "decomposed"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Compatibility decomposition of @u"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_decompose_compatibility" hb_unicode_decompose_compatibility :: 
    Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT -> -- ufuncs : TInterface (Name {namespace = "HarfBuzz", name = "unicode_funcs_t"})
    Word32 ->                               -- u : TBasicType TUInt32
    Ptr Word32 ->                           -- decomposed : TBasicType TUInt32
    IO Word32

{-# DEPRECATED unicodeDecomposeCompatibility ["(Since version 2.0.0)"] #-}
-- | Fetches the compatibility decomposition of a Unicode
-- code point. Deprecated.
-- 
-- /Since: 0.9.2/
unicodeDecomposeCompatibility ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ /@ufuncs@/: The Unicode-functions structure
    -> Word32
    -- ^ /@u@/: Code point to decompose
    -> m ((Word32, Word32))
    -- ^ __Returns:__ length of /@decomposed@/.
unicodeDecomposeCompatibility ufuncs u = liftIO $ do
    ufuncs' <- unsafeManagedPtrGetPtr ufuncs
    decomposed <- allocMem :: IO (Ptr Word32)
    result <- hb_unicode_decompose_compatibility ufuncs' u decomposed
    decomposed' <- peek decomposed
    touchManagedPtr ufuncs
    freeMem decomposed
    return (result, decomposed')


-- function unicode_decompose
-- Args: [ Arg
--           { argCName = "ufuncs"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" }
--           , argCType = Just "hb_unicode_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "ab"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Unicode code point to decompose"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The first code point of the decomposition of @ab"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The second code point of the decomposition of @ab"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_decompose" hb_unicode_decompose :: 
    Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT -> -- ufuncs : TInterface (Name {namespace = "HarfBuzz", name = "unicode_funcs_t"})
    Word32 ->                               -- ab : TBasicType TUInt32
    Ptr Word32 ->                           -- a : TBasicType TUInt32
    Ptr Word32 ->                           -- b : TBasicType TUInt32
    IO Int32

-- | Fetches the decomposition of a Unicode code point.
-- 
-- Calls the decomposition function of the specified
-- Unicode-functions structure /@ufuncs@/.
-- 
-- /Since: 0.9.2/
unicodeDecompose ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ /@ufuncs@/: The Unicode-functions structure
    -> Word32
    -- ^ /@ab@/: Unicode code point to decompose
    -> m ((Int32, Word32, Word32))
    -- ^ __Returns:__ @true@ if /@ab@/ was decomposed, @false@ otherwise
unicodeDecompose ufuncs ab = liftIO $ do
    ufuncs' <- unsafeManagedPtrGetPtr ufuncs
    a <- allocMem :: IO (Ptr Word32)
    b <- allocMem :: IO (Ptr Word32)
    result <- hb_unicode_decompose ufuncs' ab a b
    a' <- peek a
    b' <- peek b
    touchManagedPtr ufuncs
    freeMem a
    freeMem b
    return (result, a', b')


-- function unicode_compose
-- Args: [ Arg
--           { argCName = "ufuncs"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" }
--           , argCType = Just "hb_unicode_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first Unicode code point to compose"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The second Unicode code point to compose"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "ab"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The composition of @a, @b"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_compose" hb_unicode_compose :: 
    Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT -> -- ufuncs : TInterface (Name {namespace = "HarfBuzz", name = "unicode_funcs_t"})
    Word32 ->                               -- a : TBasicType TUInt32
    Word32 ->                               -- b : TBasicType TUInt32
    Ptr Word32 ->                           -- ab : TBasicType TUInt32
    IO Int32

-- | Fetches the composition of a sequence of two Unicode
-- code points.
-- 
-- Calls the composition function of the specified
-- Unicode-functions structure /@ufuncs@/.
-- 
-- /Since: 0.9.2/
unicodeCompose ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ /@ufuncs@/: The Unicode-functions structure
    -> Word32
    -- ^ /@a@/: The first Unicode code point to compose
    -> Word32
    -- ^ /@b@/: The second Unicode code point to compose
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if /@a@/ and /@b@/ composed, @false@ otherwise
unicodeCompose ufuncs a b = liftIO $ do
    ufuncs' <- unsafeManagedPtrGetPtr ufuncs
    ab <- allocMem :: IO (Ptr Word32)
    result <- hb_unicode_compose ufuncs' a b ab
    ab' <- peek ab
    touchManagedPtr ufuncs
    freeMem ab
    return (result, ab')


-- function unicode_combining_class
-- Args: [ Arg
--           { argCName = "ufuncs"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" }
--           , argCType = Just "hb_unicode_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "unicode"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The code point to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name
--                    { namespace = "HarfBuzz" , name = "unicode_combining_class_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_unicode_combining_class" hb_unicode_combining_class :: 
    Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT -> -- ufuncs : TInterface (Name {namespace = "HarfBuzz", name = "unicode_funcs_t"})
    Word32 ->                               -- unicode : TBasicType TUInt32
    IO CUInt

-- | Retrieves the Canonical Combining Class (ccc) property
-- of code point /@unicode@/.
-- 
-- /Since: 0.9.2/
unicodeCombiningClass ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ /@ufuncs@/: The Unicode-functions structure
    -> Word32
    -- ^ /@unicode@/: The code point to query
    -> m HarfBuzz.Enums.UnicodeCombiningClassT
    -- ^ __Returns:__ The t'GI.HarfBuzz.Enums.UnicodeCombiningClassT' of /@unicode@/
unicodeCombiningClass ufuncs unicode = liftIO $ do
    ufuncs' <- unsafeManagedPtrGetPtr ufuncs
    result <- hb_unicode_combining_class ufuncs' unicode
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr ufuncs
    return result'


-- function tag_to_string
-- XXX Could not generate function tag_to_string

-- Not implemented: Don't know how to allocate "buf" of type TCArray False 4 (-1) (TBasicType TUInt8)

-- function tag_from_string
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "String to convert" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Length of @str, or -1 if it is `NULL`-terminated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "Length of @str, or -1 if it is `NULL`-terminated"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_tag_from_string" hb_tag_from_string :: 
    Ptr Word8 ->                            -- str : TCArray False (-1) 1 (TBasicType TUInt8)
    Int32 ->                                -- len : TBasicType TInt
    IO Word32

-- | Converts a string into an @/hb_tag_t/@. Valid tags
-- are four characters. Shorter input strings will be
-- padded with spaces. Longer input strings will be
-- truncated.
-- 
-- /Since: 0.9.2/
tagFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@str@/: String to convert
    -> m Word32
    -- ^ __Returns:__ The @/hb_tag_t/@ corresponding to /@str@/
tagFromString str = liftIO $ do
    let len = fromIntegral $ B.length str
    str' <- packByteString str
    result <- hb_tag_from_string str' len
    freeMem str'
    return result


-- function style_get_value
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #hb_font_t object."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "style_tag"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "style_tag_t" }
--           , argCType = Just "hb_style_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a style tag." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "hb_style_get_value" hb_style_get_value :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- style_tag : TInterface (Name {namespace = "HarfBuzz", name = "style_tag_t"})
    IO CFloat

-- | Searches variation axes of a t'GI.HarfBuzz.Structs.FontT.FontT' object for a specific axis first,
-- if not set, first tries to get default style values in @STAT@ table
-- then tries to polyfill from different tables of the font.
-- 
-- /Since: 3.0.0/
styleGetValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: a t'GI.HarfBuzz.Structs.FontT.FontT' object.
    -> HarfBuzz.Enums.StyleTagT
    -- ^ /@styleTag@/: a style tag.
    -> m Float
    -- ^ __Returns:__ Corresponding axis or default value to a style tag.
styleGetValue font styleTag = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let styleTag' = (fromIntegral . fromEnum) styleTag
    result <- hb_style_get_value font' styleTag'
    let result' = realToFrac result
    touchManagedPtr font
    return result'


-- function shape_plan_get_shaper
-- Args: [ Arg
--           { argCName = "shape_plan"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "shape_plan_t" }
--           , argCType = Just "hb_shape_plan_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A shaping plan" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "hb_shape_plan_get_shaper" hb_shape_plan_get_shaper :: 
    Ptr HarfBuzz.ShapePlanT.ShapePlanT ->   -- shape_plan : TInterface (Name {namespace = "HarfBuzz", name = "shape_plan_t"})
    IO CString

-- | Fetches the shaper from a given shaping plan.
-- 
-- /Since: 0.9.7/
shapePlanGetShaper ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.ShapePlanT.ShapePlanT
    -- ^ /@shapePlan@/: A shaping plan
    -> m T.Text
    -- ^ __Returns:__ The shaper
shapePlanGetShaper shapePlan = liftIO $ do
    shapePlan' <- unsafeManagedPtrGetPtr shapePlan
    result <- hb_shape_plan_get_shaper shapePlan'
    checkUnexpectedReturnNULL "shapePlanGetShaper" result
    result' <- cstringToText result
    touchManagedPtr shapePlan
    return result'


-- function shape_plan_get_empty
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "shape_plan_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_shape_plan_get_empty" hb_shape_plan_get_empty :: 
    IO (Ptr HarfBuzz.ShapePlanT.ShapePlanT)

-- | Fetches the singleton empty shaping plan.
-- 
-- /Since: 0.9.7/
shapePlanGetEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.ShapePlanT.ShapePlanT
    -- ^ __Returns:__ The empty shaping plan
shapePlanGetEmpty  = liftIO $ do
    result <- hb_shape_plan_get_empty
    checkUnexpectedReturnNULL "shapePlanGetEmpty" result
    result' <- (wrapBoxed HarfBuzz.ShapePlanT.ShapePlanT) result
    return result'


-- function shape_plan_execute
-- Args: [ Arg
--           { argCName = "shape_plan"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "shape_plan_t" }
--           , argCType = Just "hb_shape_plan_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A shaping plan" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_font_t to use"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_buffer_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "features"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 4
--                 (TInterface Name { namespace = "HarfBuzz" , name = "feature_t" })
--           , argCType = Just "const hb_feature_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Features to enable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_features"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The number of features to enable"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "num_features"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The number of features to enable"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_shape_plan_execute" hb_shape_plan_execute :: 
    Ptr HarfBuzz.ShapePlanT.ShapePlanT ->   -- shape_plan : TInterface (Name {namespace = "HarfBuzz", name = "shape_plan_t"})
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr HarfBuzz.FeatureT.FeatureT ->       -- features : TCArray False (-1) 4 (TInterface (Name {namespace = "HarfBuzz", name = "feature_t"}))
    Word32 ->                               -- num_features : TBasicType TUInt
    IO Int32

-- | Executes the given shaping plan on the specified buffer, using
-- the given /@font@/ and /@features@/.
-- 
-- /Since: 0.9.7/
shapePlanExecute ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.ShapePlanT.ShapePlanT
    -- ^ /@shapePlan@/: A shaping plan
    -> HarfBuzz.FontT.FontT
    -- ^ /@font@/: The t'GI.HarfBuzz.Structs.FontT.FontT' to use
    -> HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: The t'GI.HarfBuzz.Structs.BufferT.BufferT' to work upon
    -> [HarfBuzz.FeatureT.FeatureT]
    -- ^ /@features@/: Features to enable
    -> m Int32
    -- ^ __Returns:__ @true@ if success, @false@ otherwise.
shapePlanExecute shapePlan font buffer features = liftIO $ do
    let numFeatures = fromIntegral $ P.length features
    shapePlan' <- unsafeManagedPtrGetPtr shapePlan
    font' <- unsafeManagedPtrGetPtr font
    buffer' <- unsafeManagedPtrGetPtr buffer
    features' <- mapM unsafeManagedPtrGetPtr features
    features'' <- packBlockArray 16 features'
    result <- hb_shape_plan_execute shapePlan' font' buffer' features'' numFeatures
    touchManagedPtr shapePlan
    touchManagedPtr font
    touchManagedPtr buffer
    mapM_ touchManagedPtr features
    freeMem features''
    return result


-- function shape_plan_create_cached2
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to use" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "props"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "segment_properties_t" }
--           , argCType = Just "const hb_segment_properties_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_segment_properties_t of the segment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_features"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 3
--                 (TInterface Name { namespace = "HarfBuzz" , name = "feature_t" })
--           , argCType = Just "const hb_feature_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The list of user-selected features"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_user_features"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The number of user-selected features"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coords"
--           , argType = TCArray False (-1) 5 (TBasicType TInt)
--           , argCType = Just "const int*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The list of variation-space coordinates"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_coords"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The number of variation-space coordinates"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "shaper_list"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , argCType = Just "const char* const*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "List of shapers to try"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "num_coords"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The number of variation-space coordinates"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          , Arg
--              { argCName = "num_user_features"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The number of user-selected features"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "shape_plan_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_shape_plan_create_cached2" hb_shape_plan_create_cached2 :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Ptr HarfBuzz.SegmentPropertiesT.SegmentPropertiesT -> -- props : TInterface (Name {namespace = "HarfBuzz", name = "segment_properties_t"})
    Ptr HarfBuzz.FeatureT.FeatureT ->       -- user_features : TCArray False (-1) 3 (TInterface (Name {namespace = "HarfBuzz", name = "feature_t"}))
    Word32 ->                               -- num_user_features : TBasicType TUInt
    Ptr Int32 ->                            -- coords : TCArray False (-1) 5 (TBasicType TInt)
    Word32 ->                               -- num_coords : TBasicType TUInt
    Ptr CString ->                          -- shaper_list : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO (Ptr HarfBuzz.ShapePlanT.ShapePlanT)

-- | The variable-font version of @/hb_shape_plan_create_cached/@.
-- Creates a cached shaping plan suitable for reuse, for a combination
-- of /@face@/, /@userFeatures@/, /@props@/, and /@shaperList@/, plus the
-- variation-space coordinates /@coords@/.
-- 
-- /Since: 1.4.0/
shapePlanCreateCached2 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to use
    -> HarfBuzz.SegmentPropertiesT.SegmentPropertiesT
    -- ^ /@props@/: The t'GI.HarfBuzz.Structs.SegmentPropertiesT.SegmentPropertiesT' of the segment
    -> [HarfBuzz.FeatureT.FeatureT]
    -- ^ /@userFeatures@/: The list of user-selected features
    -> [Int32]
    -- ^ /@coords@/: The list of variation-space coordinates
    -> [T.Text]
    -- ^ /@shaperList@/: List of shapers to try
    -> m HarfBuzz.ShapePlanT.ShapePlanT
    -- ^ __Returns:__ The shaping plan
shapePlanCreateCached2 face props userFeatures coords shaperList = liftIO $ do
    let numCoords = fromIntegral $ P.length coords
    let numUserFeatures = fromIntegral $ P.length userFeatures
    face' <- unsafeManagedPtrGetPtr face
    props' <- unsafeManagedPtrGetPtr props
    userFeatures' <- mapM unsafeManagedPtrGetPtr userFeatures
    userFeatures'' <- packBlockArray 16 userFeatures'
    coords' <- packStorableArray coords
    shaperList' <- packZeroTerminatedUTF8CArray shaperList
    result <- hb_shape_plan_create_cached2 face' props' userFeatures'' numUserFeatures coords' numCoords shaperList'
    checkUnexpectedReturnNULL "shapePlanCreateCached2" result
    result' <- (wrapBoxed HarfBuzz.ShapePlanT.ShapePlanT) result
    touchManagedPtr face
    touchManagedPtr props
    mapM_ touchManagedPtr userFeatures
    freeMem userFeatures''
    freeMem coords'
    mapZeroTerminatedCArray freeMem shaperList'
    freeMem shaperList'
    return result'


-- function shape_plan_create_cached
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to use" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "props"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "segment_properties_t" }
--           , argCType = Just "const hb_segment_properties_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_segment_properties_t of the segment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_features"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 3
--                 (TInterface Name { namespace = "HarfBuzz" , name = "feature_t" })
--           , argCType = Just "const hb_feature_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The list of user-selected features"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_user_features"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The number of user-selected features"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "shaper_list"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , argCType = Just "const char* const*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "List of shapers to try"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "num_user_features"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The number of user-selected features"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "shape_plan_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_shape_plan_create_cached" hb_shape_plan_create_cached :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Ptr HarfBuzz.SegmentPropertiesT.SegmentPropertiesT -> -- props : TInterface (Name {namespace = "HarfBuzz", name = "segment_properties_t"})
    Ptr HarfBuzz.FeatureT.FeatureT ->       -- user_features : TCArray False (-1) 3 (TInterface (Name {namespace = "HarfBuzz", name = "feature_t"}))
    Word32 ->                               -- num_user_features : TBasicType TUInt
    Ptr CString ->                          -- shaper_list : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO (Ptr HarfBuzz.ShapePlanT.ShapePlanT)

-- | Creates a cached shaping plan suitable for reuse, for a combination
-- of /@face@/, /@userFeatures@/, /@props@/, and /@shaperList@/.
-- 
-- /Since: 0.9.7/
shapePlanCreateCached ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to use
    -> HarfBuzz.SegmentPropertiesT.SegmentPropertiesT
    -- ^ /@props@/: The t'GI.HarfBuzz.Structs.SegmentPropertiesT.SegmentPropertiesT' of the segment
    -> [HarfBuzz.FeatureT.FeatureT]
    -- ^ /@userFeatures@/: The list of user-selected features
    -> [T.Text]
    -- ^ /@shaperList@/: List of shapers to try
    -> m HarfBuzz.ShapePlanT.ShapePlanT
    -- ^ __Returns:__ The shaping plan
shapePlanCreateCached face props userFeatures shaperList = liftIO $ do
    let numUserFeatures = fromIntegral $ P.length userFeatures
    face' <- unsafeManagedPtrGetPtr face
    props' <- unsafeManagedPtrGetPtr props
    userFeatures' <- mapM unsafeManagedPtrGetPtr userFeatures
    userFeatures'' <- packBlockArray 16 userFeatures'
    shaperList' <- packZeroTerminatedUTF8CArray shaperList
    result <- hb_shape_plan_create_cached face' props' userFeatures'' numUserFeatures shaperList'
    checkUnexpectedReturnNULL "shapePlanCreateCached" result
    result' <- (wrapBoxed HarfBuzz.ShapePlanT.ShapePlanT) result
    touchManagedPtr face
    touchManagedPtr props
    mapM_ touchManagedPtr userFeatures
    freeMem userFeatures''
    mapZeroTerminatedCArray freeMem shaperList'
    freeMem shaperList'
    return result'


-- function shape_plan_create2
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to use" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "props"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "segment_properties_t" }
--           , argCType = Just "const hb_segment_properties_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_segment_properties_t of the segment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_features"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 3
--                 (TInterface Name { namespace = "HarfBuzz" , name = "feature_t" })
--           , argCType = Just "const hb_feature_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The list of user-selected features"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_user_features"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The number of user-selected features"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coords"
--           , argType = TCArray False (-1) 5 (TBasicType TInt)
--           , argCType = Just "const int*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The list of variation-space coordinates"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_coords"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The number of variation-space coordinates"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "shaper_list"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , argCType = Just "const char* const*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "List of shapers to try"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "num_coords"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The number of variation-space coordinates"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          , Arg
--              { argCName = "num_user_features"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The number of user-selected features"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "shape_plan_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_shape_plan_create2" hb_shape_plan_create2 :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Ptr HarfBuzz.SegmentPropertiesT.SegmentPropertiesT -> -- props : TInterface (Name {namespace = "HarfBuzz", name = "segment_properties_t"})
    Ptr HarfBuzz.FeatureT.FeatureT ->       -- user_features : TCArray False (-1) 3 (TInterface (Name {namespace = "HarfBuzz", name = "feature_t"}))
    Word32 ->                               -- num_user_features : TBasicType TUInt
    Ptr Int32 ->                            -- coords : TCArray False (-1) 5 (TBasicType TInt)
    Word32 ->                               -- num_coords : TBasicType TUInt
    Ptr CString ->                          -- shaper_list : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO (Ptr HarfBuzz.ShapePlanT.ShapePlanT)

-- | The variable-font version of @/hb_shape_plan_create/@.
-- Constructs a shaping plan for a combination of /@face@/, /@userFeatures@/, /@props@/,
-- and /@shaperList@/, plus the variation-space coordinates /@coords@/.
-- 
-- /Since: 1.4.0/
shapePlanCreate2 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to use
    -> HarfBuzz.SegmentPropertiesT.SegmentPropertiesT
    -- ^ /@props@/: The t'GI.HarfBuzz.Structs.SegmentPropertiesT.SegmentPropertiesT' of the segment
    -> [HarfBuzz.FeatureT.FeatureT]
    -- ^ /@userFeatures@/: The list of user-selected features
    -> [Int32]
    -- ^ /@coords@/: The list of variation-space coordinates
    -> [T.Text]
    -- ^ /@shaperList@/: List of shapers to try
    -> m HarfBuzz.ShapePlanT.ShapePlanT
    -- ^ __Returns:__ The shaping plan
shapePlanCreate2 face props userFeatures coords shaperList = liftIO $ do
    let numCoords = fromIntegral $ P.length coords
    let numUserFeatures = fromIntegral $ P.length userFeatures
    face' <- unsafeManagedPtrGetPtr face
    props' <- unsafeManagedPtrGetPtr props
    userFeatures' <- mapM unsafeManagedPtrGetPtr userFeatures
    userFeatures'' <- packBlockArray 16 userFeatures'
    coords' <- packStorableArray coords
    shaperList' <- packZeroTerminatedUTF8CArray shaperList
    result <- hb_shape_plan_create2 face' props' userFeatures'' numUserFeatures coords' numCoords shaperList'
    checkUnexpectedReturnNULL "shapePlanCreate2" result
    result' <- (wrapBoxed HarfBuzz.ShapePlanT.ShapePlanT) result
    touchManagedPtr face
    touchManagedPtr props
    mapM_ touchManagedPtr userFeatures
    freeMem userFeatures''
    freeMem coords'
    mapZeroTerminatedCArray freeMem shaperList'
    freeMem shaperList'
    return result'


-- function shape_plan_create
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to use" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "props"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "segment_properties_t" }
--           , argCType = Just "const hb_segment_properties_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_segment_properties_t of the segment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_features"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 3
--                 (TInterface Name { namespace = "HarfBuzz" , name = "feature_t" })
--           , argCType = Just "const hb_feature_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The list of user-selected features"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_user_features"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The number of user-selected features"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "shaper_list"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , argCType = Just "const char* const*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "List of shapers to try"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "num_user_features"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The number of user-selected features"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "shape_plan_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_shape_plan_create" hb_shape_plan_create :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Ptr HarfBuzz.SegmentPropertiesT.SegmentPropertiesT -> -- props : TInterface (Name {namespace = "HarfBuzz", name = "segment_properties_t"})
    Ptr HarfBuzz.FeatureT.FeatureT ->       -- user_features : TCArray False (-1) 3 (TInterface (Name {namespace = "HarfBuzz", name = "feature_t"}))
    Word32 ->                               -- num_user_features : TBasicType TUInt
    Ptr CString ->                          -- shaper_list : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO (Ptr HarfBuzz.ShapePlanT.ShapePlanT)

-- | Constructs a shaping plan for a combination of /@face@/, /@userFeatures@/, /@props@/,
-- and /@shaperList@/.
-- 
-- /Since: 0.9.7/
shapePlanCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to use
    -> HarfBuzz.SegmentPropertiesT.SegmentPropertiesT
    -- ^ /@props@/: The t'GI.HarfBuzz.Structs.SegmentPropertiesT.SegmentPropertiesT' of the segment
    -> [HarfBuzz.FeatureT.FeatureT]
    -- ^ /@userFeatures@/: The list of user-selected features
    -> [T.Text]
    -- ^ /@shaperList@/: List of shapers to try
    -> m HarfBuzz.ShapePlanT.ShapePlanT
    -- ^ __Returns:__ The shaping plan
shapePlanCreate face props userFeatures shaperList = liftIO $ do
    let numUserFeatures = fromIntegral $ P.length userFeatures
    face' <- unsafeManagedPtrGetPtr face
    props' <- unsafeManagedPtrGetPtr props
    userFeatures' <- mapM unsafeManagedPtrGetPtr userFeatures
    userFeatures'' <- packBlockArray 16 userFeatures'
    shaperList' <- packZeroTerminatedUTF8CArray shaperList
    result <- hb_shape_plan_create face' props' userFeatures'' numUserFeatures shaperList'
    checkUnexpectedReturnNULL "shapePlanCreate" result
    result' <- (wrapBoxed HarfBuzz.ShapePlanT.ShapePlanT) result
    touchManagedPtr face
    touchManagedPtr props
    mapM_ touchManagedPtr userFeatures
    freeMem userFeatures''
    mapZeroTerminatedCArray freeMem shaperList'
    freeMem shaperList'
    return result'


-- function shape_list_shapers
-- Args: []
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "hb_shape_list_shapers" hb_shape_list_shapers :: 
    IO (Ptr CString)

-- | Retrieves the list of shapers supported by HarfBuzz.
-- 
-- /Since: 0.9.2/
shapeListShapers ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [T.Text]
    -- ^ __Returns:__ a
    --    @NULL@-terminated array of supported shapers constant string.
    --    The returned array is owned by HarfBuzz and should not be
    --    modified or freed.
shapeListShapers  = liftIO $ do
    result <- hb_shape_list_shapers
    checkUnexpectedReturnNULL "shapeListShapers" result
    result' <- unpackZeroTerminatedUTF8CArray result
    return result'


-- function shape_full
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_font_t to use for shaping"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_buffer_t to shape"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "features"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 3
--                 (TInterface Name { namespace = "HarfBuzz" , name = "feature_t" })
--           , argCType = Just "const hb_feature_t*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "an array of user\n   specified #hb_feature_t or `NULL`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_features"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the length of @features array"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "shaper_list"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , argCType = Just "const char* const*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a `NULL`-terminated\n   array of shapers to use or `NULL`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "num_features"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the length of @features array"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_shape_full" hb_shape_full :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr HarfBuzz.FeatureT.FeatureT ->       -- features : TCArray False (-1) 3 (TInterface (Name {namespace = "HarfBuzz", name = "feature_t"}))
    Word32 ->                               -- num_features : TBasicType TUInt
    Ptr CString ->                          -- shaper_list : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO Int32

-- | See 'GI.HarfBuzz.Functions.shape' for details. If /@shaperList@/ is not @NULL@, the specified
-- shapers will be used in the given order, otherwise the default shapers list
-- will be used.
-- 
-- /Since: 0.9.2/
shapeFull ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: an t'GI.HarfBuzz.Structs.FontT.FontT' to use for shaping
    -> HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: an t'GI.HarfBuzz.Structs.BufferT.BufferT' to shape
    -> Maybe ([HarfBuzz.FeatureT.FeatureT])
    -- ^ /@features@/: an array of user
    --    specified t'GI.HarfBuzz.Structs.FeatureT.FeatureT' or @NULL@
    -> Maybe ([T.Text])
    -- ^ /@shaperList@/: a @NULL@-terminated
    --    array of shapers to use or @NULL@
    -> m Int32
    -- ^ __Returns:__ false if all shapers failed, true otherwise
shapeFull font buffer features shaperList = liftIO $ do
    let numFeatures = case features of
            Nothing -> 0
            Just jFeatures -> fromIntegral $ P.length jFeatures
    font' <- unsafeManagedPtrGetPtr font
    buffer' <- unsafeManagedPtrGetPtr buffer
    maybeFeatures <- case features of
        Nothing -> return FP.nullPtr
        Just jFeatures -> do
            jFeatures' <- mapM unsafeManagedPtrGetPtr jFeatures
            jFeatures'' <- packBlockArray 16 jFeatures'
            return jFeatures''
    maybeShaperList <- case shaperList of
        Nothing -> return FP.nullPtr
        Just jShaperList -> do
            jShaperList' <- packZeroTerminatedUTF8CArray jShaperList
            return jShaperList'
    result <- hb_shape_full font' buffer' maybeFeatures numFeatures maybeShaperList
    touchManagedPtr font
    touchManagedPtr buffer
    whenJust features (mapM_ touchManagedPtr)
    freeMem maybeFeatures
    mapZeroTerminatedCArray freeMem maybeShaperList
    freeMem maybeShaperList
    return result


-- function shape
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_font_t to use for shaping"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_buffer_t to shape"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "features"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 3
--                 (TInterface Name { namespace = "HarfBuzz" , name = "feature_t" })
--           , argCType = Just "const hb_feature_t*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "an array of user\n   specified #hb_feature_t or `NULL`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_features"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the length of @features array"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "num_features"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the length of @features array"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_shape" hb_shape :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr HarfBuzz.FeatureT.FeatureT ->       -- features : TCArray False (-1) 3 (TInterface (Name {namespace = "HarfBuzz", name = "feature_t"}))
    Word32 ->                               -- num_features : TBasicType TUInt
    IO ()

-- | Shapes /@buffer@/ using /@font@/ turning its Unicode characters content to
-- positioned glyphs. If /@features@/ is not @NULL@, it will be used to control the
-- features applied during shaping. If two /@features@/ have the same tag but
-- overlapping ranges the value of the feature with the higher index takes
-- precedence.
-- 
-- /Since: 0.9.2/
shape ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: an t'GI.HarfBuzz.Structs.FontT.FontT' to use for shaping
    -> HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: an t'GI.HarfBuzz.Structs.BufferT.BufferT' to shape
    -> Maybe ([HarfBuzz.FeatureT.FeatureT])
    -- ^ /@features@/: an array of user
    --    specified t'GI.HarfBuzz.Structs.FeatureT.FeatureT' or @NULL@
    -> m ()
shape font buffer features = liftIO $ do
    let numFeatures = case features of
            Nothing -> 0
            Just jFeatures -> fromIntegral $ P.length jFeatures
    font' <- unsafeManagedPtrGetPtr font
    buffer' <- unsafeManagedPtrGetPtr buffer
    maybeFeatures <- case features of
        Nothing -> return FP.nullPtr
        Just jFeatures -> do
            jFeatures' <- mapM unsafeManagedPtrGetPtr jFeatures
            jFeatures'' <- packBlockArray 16 jFeatures'
            return jFeatures''
    hb_shape font' buffer' maybeFeatures numFeatures
    touchManagedPtr font
    touchManagedPtr buffer
    whenJust features (mapM_ touchManagedPtr)
    freeMem maybeFeatures
    return ()


-- function set_union
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "other"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Another set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_union" hb_set_union :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Ptr HarfBuzz.SetT.SetT ->               -- other : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO ()

-- | Makes /@set@/ the union of /@set@/ and /@other@/.
-- 
-- /Since: 0.9.2/
setUnion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> HarfBuzz.SetT.SetT
    -- ^ /@other@/: Another set
    -> m ()
setUnion set other = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    other' <- unsafeManagedPtrGetPtr other
    hb_set_union set' other'
    touchManagedPtr set
    touchManagedPtr other
    return ()


-- function set_symmetric_difference
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "other"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Another set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_symmetric_difference" hb_set_symmetric_difference :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Ptr HarfBuzz.SetT.SetT ->               -- other : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO ()

-- | Makes /@set@/ the symmetric difference of /@set@/
-- and /@other@/.
-- 
-- /Since: 0.9.2/
setSymmetricDifference ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> HarfBuzz.SetT.SetT
    -- ^ /@other@/: Another set
    -> m ()
setSymmetricDifference set other = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    other' <- unsafeManagedPtrGetPtr other
    hb_set_symmetric_difference set' other'
    touchManagedPtr set
    touchManagedPtr other
    return ()


-- function set_subtract
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "other"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Another set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_subtract" hb_set_subtract :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Ptr HarfBuzz.SetT.SetT ->               -- other : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO ()

-- | Subtracts the contents of /@other@/ from /@set@/.
-- 
-- /Since: 0.9.2/
setSubtract ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> HarfBuzz.SetT.SetT
    -- ^ /@other@/: Another set
    -> m ()
setSubtract set other = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    other' <- unsafeManagedPtrGetPtr other
    hb_set_subtract set' other'
    touchManagedPtr set
    touchManagedPtr other
    return ()


-- function set_set
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "other"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Another set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_set" hb_set_set :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Ptr HarfBuzz.SetT.SetT ->               -- other : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO ()

-- | Makes the contents of /@set@/ equal to the contents of /@other@/.
-- 
-- /Since: 0.9.2/
setSet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> HarfBuzz.SetT.SetT
    -- ^ /@other@/: Another set
    -> m ()
setSet set other = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    other' <- unsafeManagedPtrGetPtr other
    hb_set_set set' other'
    touchManagedPtr set
    touchManagedPtr other
    return ()


-- function set_previous_range
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = The current first code point in the range\n        Output = The first code point in the range"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "last"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The last code point in the range"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_previous_range" hb_set_previous_range :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Ptr Word32 ->                           -- first : TBasicType TUInt32
    Ptr Word32 ->                           -- last : TBasicType TUInt32
    IO Int32

-- | Fetches the previous consecutive range of elements in /@set@/ that
-- are greater than current value of /@last@/.
-- 
-- Set /@first@/ to @/HB_SET_VALUE_INVALID/@ to get started.
-- 
-- /Since: 1.8.0/
setPreviousRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> Word32
    -- ^ /@first@/: Input = The current first code point in the range
    --         Output = The first code point in the range
    -> m ((Int32, Word32, Word32))
    -- ^ __Returns:__ @true@ if there was a previous range, @false@ otherwise
setPreviousRange set first = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    first' <- allocMem :: IO (Ptr Word32)
    poke first' first
    last <- allocMem :: IO (Ptr Word32)
    result <- hb_set_previous_range set' first' last
    first'' <- peek first'
    last' <- peek last
    touchManagedPtr set
    freeMem first'
    freeMem last
    return (result, first'', last')


-- function set_previous
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "codepoint"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = Code point to query\n            Output = Code point retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_previous" hb_set_previous :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Ptr Word32 ->                           -- codepoint : TBasicType TUInt32
    IO Int32

-- | Fetches the previous element in /@set@/ that is lower than current value of /@codepoint@/.
-- 
-- Set /@codepoint@/ to @/HB_SET_VALUE_INVALID/@ to get started.
-- 
-- /Since: 1.8.0/
setPrevious ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> Word32
    -- ^ /@codepoint@/: Input = Code point to query
    --             Output = Code point retrieved
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if there was a previous value, @false@ otherwise
setPrevious set codepoint = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    codepoint' <- allocMem :: IO (Ptr Word32)
    poke codepoint' codepoint
    result <- hb_set_previous set' codepoint'
    codepoint'' <- peek codepoint'
    touchManagedPtr set
    freeMem codepoint'
    return (result, codepoint'')


-- function set_next_range
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first code point in the range"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "last"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = The current last code point in the range\n        Output = The last code point in the range"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_next_range" hb_set_next_range :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Ptr Word32 ->                           -- first : TBasicType TUInt32
    Ptr Word32 ->                           -- last : TBasicType TUInt32
    IO Int32

-- | Fetches the next consecutive range of elements in /@set@/ that
-- are greater than current value of /@last@/.
-- 
-- Set /@last@/ to @/HB_SET_VALUE_INVALID/@ to get started.
-- 
-- /Since: 0.9.7/
setNextRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> Word32
    -- ^ /@last@/: Input = The current last code point in the range
    --         Output = The last code point in the range
    -> m ((Int32, Word32, Word32))
    -- ^ __Returns:__ @true@ if there was a next range, @false@ otherwise
setNextRange set last = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    first <- allocMem :: IO (Ptr Word32)
    last' <- allocMem :: IO (Ptr Word32)
    poke last' last
    result <- hb_set_next_range set' first last'
    first' <- peek first
    last'' <- peek last'
    touchManagedPtr set
    freeMem first
    freeMem last'
    return (result, first', last'')


-- function set_next_many
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "codepoint"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Outputting codepoints starting after this one.\n            Use #HB_SET_VALUE_INVALID to get started."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out"
--           , argType = TCArray False (-1) 3 (TBasicType TUInt32)
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An array of codepoints to write to."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The maximum number of codepoints to write out."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "size"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "The maximum number of codepoints to write out."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_next_many" hb_set_next_many :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Word32 ->                               -- codepoint : TBasicType TUInt32
    Ptr Word32 ->                           -- out : TCArray False (-1) 3 (TBasicType TUInt32)
    Word32 ->                               -- size : TBasicType TUInt
    IO Word32

-- | Finds the next element in /@set@/ that is greater than /@codepoint@/. Writes out
-- codepoints to /@out@/, until either the set runs out of elements, or /@size@/
-- codepoints are written, whichever comes first.
-- 
-- /Since: 4.2.0/
setNextMany ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> Word32
    -- ^ /@codepoint@/: Outputting codepoints starting after this one.
    --             Use @/HB_SET_VALUE_INVALID/@ to get started.
    -> [Word32]
    -- ^ /@out@/: An array of codepoints to write to.
    -> m Word32
    -- ^ __Returns:__ the number of values written.
setNextMany set codepoint out = liftIO $ do
    let size = fromIntegral $ P.length out
    set' <- unsafeManagedPtrGetPtr set
    out' <- packStorableArray out
    result <- hb_set_next_many set' codepoint out' size
    touchManagedPtr set
    freeMem out'
    return result


-- function set_next
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "codepoint"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = Code point to query\n            Output = Code point retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_next" hb_set_next :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Ptr Word32 ->                           -- codepoint : TBasicType TUInt32
    IO Int32

-- | Fetches the next element in /@set@/ that is greater than current value of /@codepoint@/.
-- 
-- Set /@codepoint@/ to @/HB_SET_VALUE_INVALID/@ to get started.
-- 
-- /Since: 0.9.2/
setNext ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> Word32
    -- ^ /@codepoint@/: Input = Code point to query
    --             Output = Code point retrieved
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if there was a next value, @false@ otherwise
setNext set codepoint = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    codepoint' <- allocMem :: IO (Ptr Word32)
    poke codepoint' codepoint
    result <- hb_set_next set' codepoint'
    codepoint'' <- peek codepoint'
    touchManagedPtr set
    freeMem codepoint'
    return (result, codepoint'')


-- function set_is_subset
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "larger_set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Another set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_is_subset" hb_set_is_subset :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Ptr HarfBuzz.SetT.SetT ->               -- larger_set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO Int32

-- | Tests whether /@set@/ is a subset of /@largerSet@/.
-- 
-- /Since: 1.8.1/
setIsSubset ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> HarfBuzz.SetT.SetT
    -- ^ /@largerSet@/: Another set
    -> m Int32
    -- ^ __Returns:__ @true@ if the /@set@/ is a subset of (or equal to) /@largerSet@/, @false@ otherwise.
setIsSubset set largerSet = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    largerSet' <- unsafeManagedPtrGetPtr largerSet
    result <- hb_set_is_subset set' largerSet'
    touchManagedPtr set
    touchManagedPtr largerSet
    return result


-- function set_is_inverted
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_is_inverted" hb_set_is_inverted :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO Int32

-- | Returns whether the set is inverted.
-- 
-- /Since: 7.0.0/
setIsInverted ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> m Int32
    -- ^ __Returns:__ @true@ if the set is inverted, @false@ otherwise
setIsInverted set = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    result <- hb_set_is_inverted set'
    touchManagedPtr set
    return result


-- function set_is_equal
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "other"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Another set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_is_equal" hb_set_is_equal :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Ptr HarfBuzz.SetT.SetT ->               -- other : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO Int32

-- | Tests whether /@set@/ and /@other@/ are equal (contain the same
-- elements).
-- 
-- /Since: 0.9.7/
setIsEqual ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> HarfBuzz.SetT.SetT
    -- ^ /@other@/: Another set
    -> m Int32
    -- ^ __Returns:__ @true@ if the two sets are equal, @false@ otherwise.
setIsEqual set other = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    other' <- unsafeManagedPtrGetPtr other
    result <- hb_set_is_equal set' other'
    touchManagedPtr set
    touchManagedPtr other
    return result


-- function set_is_empty
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a set." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_is_empty" hb_set_is_empty :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO Int32

-- | Tests whether a set is empty (contains no elements).
-- 
-- /Since: 0.9.7/
setIsEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: a set.
    -> m Int32
    -- ^ __Returns:__ @true@ if /@set@/ is empty
setIsEmpty set = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    result <- hb_set_is_empty set'
    touchManagedPtr set
    return result


-- function set_invert
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_invert" hb_set_invert :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO ()

-- | Inverts the contents of /@set@/.
-- 
-- /Since: 3.0.0/
setInvert ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> m ()
setInvert set = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    hb_set_invert set'
    touchManagedPtr set
    return ()


-- function set_intersects
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "other"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Another set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_intersects" hb_set_intersects :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Ptr HarfBuzz.SetT.SetT ->               -- other : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO Int32

-- | Tests whether /@set@/ and /@other@/ have any elements in common.
-- 
-- /Since: 14.4.0/
setIntersects ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> HarfBuzz.SetT.SetT
    -- ^ /@other@/: Another set
    -> m Int32
    -- ^ __Returns:__ @true@ if the two sets intersect, @false@ otherwise.
setIntersects set other = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    other' <- unsafeManagedPtrGetPtr other
    result <- hb_set_intersects set' other'
    touchManagedPtr set
    touchManagedPtr other
    return result


-- function set_intersect
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "other"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Another set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_intersect" hb_set_intersect :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Ptr HarfBuzz.SetT.SetT ->               -- other : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO ()

-- | Makes /@set@/ the intersection of /@set@/ and /@other@/.
-- 
-- /Since: 0.9.2/
setIntersect ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> HarfBuzz.SetT.SetT
    -- ^ /@other@/: Another set
    -> m ()
setIntersect set other = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    other' <- unsafeManagedPtrGetPtr other
    hb_set_intersect set' other'
    touchManagedPtr set
    touchManagedPtr other
    return ()


-- function set_hash
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_hash" hb_set_hash :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO Word32

-- | Creates a hash representing /@set@/.
-- 
-- /Since: 4.4.0/
setHash ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> m Word32
    -- ^ __Returns:__ A hash of /@set@/.
setHash set = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    result <- hb_set_hash set'
    touchManagedPtr set
    return result


-- function set_has
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "codepoint"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The element to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_has" hb_set_has :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Word32 ->                               -- codepoint : TBasicType TUInt32
    IO Int32

-- | Tests whether /@codepoint@/ belongs to /@set@/.
-- 
-- /Since: 0.9.2/
setHas ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> Word32
    -- ^ /@codepoint@/: The element to query
    -> m Int32
    -- ^ __Returns:__ @true@ if /@codepoint@/ is in /@set@/, @false@ otherwise
setHas set codepoint = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    result <- hb_set_has set' codepoint
    touchManagedPtr set
    return result


-- function set_get_population
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_get_population" hb_set_get_population :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO Word32

-- | Returns the number of elements in the set.
-- 
-- /Since: 0.9.7/
setGetPopulation ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> m Word32
    -- ^ __Returns:__ The population of /@set@/
setGetPopulation set = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    result <- hb_set_get_population set'
    touchManagedPtr set
    return result


-- function set_get_min
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_get_min" hb_set_get_min :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO Word32

-- | Finds the smallest element in the set.
-- 
-- /Since: 0.9.7/
setGetMin ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> m Word32
    -- ^ __Returns:__ minimum of /@set@/, or @/HB_SET_VALUE_INVALID/@ if /@set@/ is empty.
setGetMin set = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    result <- hb_set_get_min set'
    touchManagedPtr set
    return result


-- function set_get_max
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_get_max" hb_set_get_max :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO Word32

-- | Finds the largest element in the set.
-- 
-- /Since: 0.9.7/
setGetMax ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> m Word32
    -- ^ __Returns:__ maximum of /@set@/, or @/HB_SET_VALUE_INVALID/@ if /@set@/ is empty.
setGetMax set = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    result <- hb_set_get_max set'
    touchManagedPtr set
    return result


-- function set_get_empty
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "set_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_get_empty" hb_set_get_empty :: 
    IO (Ptr HarfBuzz.SetT.SetT)

-- | Fetches the singleton empty t'GI.HarfBuzz.Structs.SetT.SetT'.
-- 
-- /Since: 0.9.2/
setGetEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.SetT.SetT
    -- ^ __Returns:__ The empty t'GI.HarfBuzz.Structs.SetT.SetT'
setGetEmpty  = liftIO $ do
    result <- hb_set_get_empty
    checkUnexpectedReturnNULL "setGetEmpty" result
    result' <- (wrapBoxed HarfBuzz.SetT.SetT) result
    return result'


-- function set_del_range
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first element to remove from @set"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "last"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The final element to remove from @set"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_del_range" hb_set_del_range :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Word32 ->                               -- first : TBasicType TUInt32
    Word32 ->                               -- last : TBasicType TUInt32
    IO ()

-- | Removes all of the elements from /@first@/ to /@last@/
-- (inclusive) from /@set@/.
-- 
-- If /@last@/ is @/HB_SET_VALUE_INVALID/@, then all values
-- greater than or equal to /@first@/ are removed.
-- 
-- /Since: 0.9.7/
setDelRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> Word32
    -- ^ /@first@/: The first element to remove from /@set@/
    -> Word32
    -- ^ /@last@/: The final element to remove from /@set@/
    -> m ()
setDelRange set first last = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    hb_set_del_range set' first last
    touchManagedPtr set
    return ()


-- function set_del
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "codepoint"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Removes @codepoint from @set"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_del" hb_set_del :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Word32 ->                               -- codepoint : TBasicType TUInt32
    IO ()

-- | Removes /@codepoint@/ from /@set@/.
-- 
-- /Since: 0.9.2/
setDel ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> Word32
    -- ^ /@codepoint@/: Removes /@codepoint@/ from /@set@/
    -> m ()
setDel set codepoint = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    hb_set_del set' codepoint
    touchManagedPtr set
    return ()


-- function set_create
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "set_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_create" hb_set_create :: 
    IO (Ptr HarfBuzz.SetT.SetT)

-- | Creates a new, initially empty set.
-- 
-- /Since: 0.9.2/
setCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.SetT.SetT
    -- ^ __Returns:__ The new t'GI.HarfBuzz.Structs.SetT.SetT'
setCreate  = liftIO $ do
    result <- hb_set_create
    checkUnexpectedReturnNULL "setCreate" result
    result' <- (wrapBoxed HarfBuzz.SetT.SetT) result
    return result'


-- function set_copy
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "set_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_copy" hb_set_copy :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO (Ptr HarfBuzz.SetT.SetT)

-- | Allocate a copy of /@set@/.
-- 
-- /Since: 2.8.2/
setCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> m HarfBuzz.SetT.SetT
    -- ^ __Returns:__ Newly-allocated set.
setCopy set = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    result <- hb_set_copy set'
    checkUnexpectedReturnNULL "setCopy" result
    result' <- (wrapBoxed HarfBuzz.SetT.SetT) result
    touchManagedPtr set
    return result'


-- function set_clear
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_clear" hb_set_clear :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO ()

-- | Clears out the contents of a set.
-- 
-- /Since: 0.9.2/
setClear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> m ()
setClear set = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    hb_set_clear set'
    touchManagedPtr set
    return ()


-- function set_allocation_successful
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "const hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_allocation_successful" hb_set_allocation_successful :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO Int32

-- | Tests whether memory allocation for a set was successful.
-- 
-- /Since: 0.9.2/
setAllocationSuccessful ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> m Int32
    -- ^ __Returns:__ @true@ if allocation succeeded, @false@ otherwise
setAllocationSuccessful set = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    result <- hb_set_allocation_successful set'
    touchManagedPtr set
    return result


-- function set_add_sorted_array
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "sorted_codepoints"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt32)
--           , argCType = Just "const hb_codepoint_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Array of codepoints to add"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_codepoints"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of @sorted_codepoints"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "num_codepoints"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of @sorted_codepoints"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_add_sorted_array" hb_set_add_sorted_array :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Ptr Word32 ->                           -- sorted_codepoints : TCArray False (-1) 2 (TBasicType TUInt32)
    Word32 ->                               -- num_codepoints : TBasicType TUInt
    IO ()

-- | Adds /@numCodepoints@/ codepoints to a set at once.
-- The codepoints array must be in increasing order,
-- with size at least /@numCodepoints@/.
-- 
-- /Since: 4.1.0/
setAddSortedArray ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> [Word32]
    -- ^ /@sortedCodepoints@/: Array of codepoints to add
    -> m ()
setAddSortedArray set sortedCodepoints = liftIO $ do
    let numCodepoints = fromIntegral $ P.length sortedCodepoints
    set' <- unsafeManagedPtrGetPtr set
    sortedCodepoints' <- packStorableArray sortedCodepoints
    hb_set_add_sorted_array set' sortedCodepoints' numCodepoints
    touchManagedPtr set
    freeMem sortedCodepoints'
    return ()


-- function set_add_range
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first element to add to @set"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "last"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The final element to add to @set"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_add_range" hb_set_add_range :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Word32 ->                               -- first : TBasicType TUInt32
    Word32 ->                               -- last : TBasicType TUInt32
    IO ()

-- | Adds all of the elements from /@first@/ to /@last@/
-- (inclusive) to /@set@/.
-- 
-- /Since: 0.9.7/
setAddRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> Word32
    -- ^ /@first@/: The first element to add to /@set@/
    -> Word32
    -- ^ /@last@/: The final element to add to /@set@/
    -> m ()
setAddRange set first last = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    hb_set_add_range set' first last
    touchManagedPtr set
    return ()


-- function set_add
-- Args: [ Arg
--           { argCName = "set"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "codepoint"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The element to add to @set"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_set_add" hb_set_add :: 
    Ptr HarfBuzz.SetT.SetT ->               -- set : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    Word32 ->                               -- codepoint : TBasicType TUInt32
    IO ()

-- | Adds /@codepoint@/ to /@set@/.
-- 
-- /Since: 0.9.2/
setAdd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SetT.SetT
    -- ^ /@set@/: A set
    -> Word32
    -- ^ /@codepoint@/: The element to add to /@set@/
    -> m ()
setAdd set codepoint = liftIO $ do
    set' <- unsafeManagedPtrGetPtr set
    hb_set_add set' codepoint
    touchManagedPtr set
    return ()


-- function segment_properties_overlay
-- Args: [ Arg
--           { argCName = "p"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "segment_properties_t" }
--           , argCType = Just "hb_segment_properties_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_segment_properties_t to fill in."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "src"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "segment_properties_t" }
--           , argCType = Just "const hb_segment_properties_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_segment_properties_t to fill in from."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_segment_properties_overlay" hb_segment_properties_overlay :: 
    Ptr HarfBuzz.SegmentPropertiesT.SegmentPropertiesT -> -- p : TInterface (Name {namespace = "HarfBuzz", name = "segment_properties_t"})
    Ptr HarfBuzz.SegmentPropertiesT.SegmentPropertiesT -> -- src : TInterface (Name {namespace = "HarfBuzz", name = "segment_properties_t"})
    IO ()

-- | Fills in missing fields of /@p@/ from /@src@/ in a considered manner.
-- 
-- First, if /@p@/ does not have direction set, direction is copied from /@src@/.
-- 
-- Next, if /@p@/ and /@src@/ have the same direction (which can be unset), if /@p@/
-- does not have script set, script is copied from /@src@/.
-- 
-- Finally, if /@p@/ and /@src@/ have the same direction and script (which either
-- can be unset), if /@p@/ does not have language set, language is copied from
-- /@src@/.
-- 
-- /Since: 3.3.0/
segmentPropertiesOverlay ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SegmentPropertiesT.SegmentPropertiesT
    -- ^ /@p@/: t'GI.HarfBuzz.Structs.SegmentPropertiesT.SegmentPropertiesT' to fill in.
    -> HarfBuzz.SegmentPropertiesT.SegmentPropertiesT
    -- ^ /@src@/: t'GI.HarfBuzz.Structs.SegmentPropertiesT.SegmentPropertiesT' to fill in from.
    -> m ()
segmentPropertiesOverlay p src = liftIO $ do
    p' <- unsafeManagedPtrGetPtr p
    src' <- unsafeManagedPtrGetPtr src
    hb_segment_properties_overlay p' src'
    touchManagedPtr p
    touchManagedPtr src
    return ()


-- function segment_properties_hash
-- Args: [ Arg
--           { argCName = "p"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "segment_properties_t" }
--           , argCType = Just "const hb_segment_properties_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_segment_properties_t to hash."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_segment_properties_hash" hb_segment_properties_hash :: 
    Ptr HarfBuzz.SegmentPropertiesT.SegmentPropertiesT -> -- p : TInterface (Name {namespace = "HarfBuzz", name = "segment_properties_t"})
    IO Word32

-- | Creates a hash representing /@p@/.
-- 
-- /Since: 0.9.7/
segmentPropertiesHash ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SegmentPropertiesT.SegmentPropertiesT
    -- ^ /@p@/: t'GI.HarfBuzz.Structs.SegmentPropertiesT.SegmentPropertiesT' to hash.
    -> m Word32
    -- ^ __Returns:__ A hash of /@p@/.
segmentPropertiesHash p = liftIO $ do
    p' <- unsafeManagedPtrGetPtr p
    result <- hb_segment_properties_hash p'
    touchManagedPtr p
    return result


-- function segment_properties_equal
-- Args: [ Arg
--           { argCName = "a"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "segment_properties_t" }
--           , argCType = Just "const hb_segment_properties_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "first #hb_segment_properties_t to compare."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "segment_properties_t" }
--           , argCType = Just "const hb_segment_properties_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "second #hb_segment_properties_t to compare."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_segment_properties_equal" hb_segment_properties_equal :: 
    Ptr HarfBuzz.SegmentPropertiesT.SegmentPropertiesT -> -- a : TInterface (Name {namespace = "HarfBuzz", name = "segment_properties_t"})
    Ptr HarfBuzz.SegmentPropertiesT.SegmentPropertiesT -> -- b : TInterface (Name {namespace = "HarfBuzz", name = "segment_properties_t"})
    IO Int32

-- | Checks the equality of two t'GI.HarfBuzz.Structs.SegmentPropertiesT.SegmentPropertiesT'\'s.
-- 
-- /Since: 0.9.7/
segmentPropertiesEqual ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.SegmentPropertiesT.SegmentPropertiesT
    -- ^ /@a@/: first t'GI.HarfBuzz.Structs.SegmentPropertiesT.SegmentPropertiesT' to compare.
    -> HarfBuzz.SegmentPropertiesT.SegmentPropertiesT
    -- ^ /@b@/: second t'GI.HarfBuzz.Structs.SegmentPropertiesT.SegmentPropertiesT' to compare.
    -> m Int32
    -- ^ __Returns:__ @true@ if all properties of /@a@/ equal those of /@b@/, @false@ otherwise.
segmentPropertiesEqual a b = liftIO $ do
    a' <- unsafeManagedPtrGetPtr a
    b' <- unsafeManagedPtrGetPtr b
    result <- hb_segment_properties_equal a' b'
    touchManagedPtr a
    touchManagedPtr b
    return result


-- function script_to_iso15924_tag
-- Args: [ Arg
--           { argCName = "script"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "script_t" }
--           , argCType = Just "hb_script_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_script_t to convert."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_script_to_iso15924_tag" hb_script_to_iso15924_tag :: 
    CUInt ->                                -- script : TInterface (Name {namespace = "HarfBuzz", name = "script_t"})
    IO Word32

-- | Converts an t'GI.HarfBuzz.Enums.ScriptT' to a corresponding ISO 15924 script tag.
-- 
-- /Since: 0.9.2/
scriptToIso15924Tag ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.Enums.ScriptT
    -- ^ /@script@/: an t'GI.HarfBuzz.Enums.ScriptT' to convert.
    -> m Word32
    -- ^ __Returns:__ An @/hb_tag_t/@ representing an ISO 15924 script tag.
scriptToIso15924Tag script = liftIO $ do
    let script' = (fromIntegral . fromEnum) script
    result <- hb_script_to_iso15924_tag script'
    return result


-- function script_get_horizontal_direction
-- Args: [ Arg
--           { argCName = "script"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "script_t" }
--           , argCType = Just "hb_script_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_script_t to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "direction_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_script_get_horizontal_direction" hb_script_get_horizontal_direction :: 
    CUInt ->                                -- script : TInterface (Name {namespace = "HarfBuzz", name = "script_t"})
    IO CUInt

-- | Fetches the t'GI.HarfBuzz.Enums.DirectionT' of a script when it is
-- set horizontally. All right-to-left scripts will return
-- @/HB_DIRECTION_RTL/@. All left-to-right scripts will return
-- @/HB_DIRECTION_LTR/@.
-- 
-- Scripts that can be written either right-to-left or
-- left-to-right will return @/HB_DIRECTION_INVALID/@.
-- 
-- Unknown scripts will return @/HB_DIRECTION_LTR/@.
-- 
-- /Since: 0.9.2/
scriptGetHorizontalDirection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.Enums.ScriptT
    -- ^ /@script@/: The t'GI.HarfBuzz.Enums.ScriptT' to query
    -> m HarfBuzz.Enums.DirectionT
    -- ^ __Returns:__ The horizontal t'GI.HarfBuzz.Enums.DirectionT' of /@script@/
scriptGetHorizontalDirection script = liftIO $ do
    let script' = (fromIntegral . fromEnum) script
    result <- hb_script_get_horizontal_direction script'
    let result' = (toEnum . fromIntegral) result
    return result'


-- function script_from_string
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a string representing an\n      ISO 15924 tag."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "length of the @str, or -1 if it is `NULL`-terminated."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "length of the @str, or -1 if it is `NULL`-terminated."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "script_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_script_from_string" hb_script_from_string :: 
    Ptr Word8 ->                            -- str : TCArray False (-1) 1 (TBasicType TUInt8)
    Int32 ->                                -- len : TBasicType TInt
    IO CUInt

-- | Converts a string /@str@/ representing an ISO 15924 script tag to a
-- corresponding t'GI.HarfBuzz.Enums.ScriptT'. Shorthand for 'GI.HarfBuzz.Functions.tagFromString' then
-- 'GI.HarfBuzz.Functions.scriptFromIso15924Tag'.
-- 
-- /Since: 0.9.2/
scriptFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@str@/: a string representing an
    --       ISO 15924 tag.
    -> m HarfBuzz.Enums.ScriptT
    -- ^ __Returns:__ An t'GI.HarfBuzz.Enums.ScriptT' corresponding to the ISO 15924 tag.
scriptFromString str = liftIO $ do
    let len = fromIntegral $ B.length str
    str' <- packByteString str
    result <- hb_script_from_string str' len
    let result' = (toEnum . fromIntegral) result
    freeMem str'
    return result'


-- function script_from_iso15924_tag
-- Args: [ Arg
--           { argCName = "tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_tag_t representing an ISO 15924 tag."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "script_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_script_from_iso15924_tag" hb_script_from_iso15924_tag :: 
    Word32 ->                               -- tag : TBasicType TUInt32
    IO CUInt

-- | Converts an ISO 15924 script tag to a corresponding t'GI.HarfBuzz.Enums.ScriptT'.
-- 
-- /Since: 0.9.2/
scriptFromIso15924Tag ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@tag@/: an @/hb_tag_t/@ representing an ISO 15924 tag.
    -> m HarfBuzz.Enums.ScriptT
    -- ^ __Returns:__ An t'GI.HarfBuzz.Enums.ScriptT' corresponding to the ISO 15924 tag.
scriptFromIso15924Tag tag = liftIO $ do
    result <- hb_script_from_iso15924_tag tag
    let result' = (toEnum . fromIntegral) result
    return result'


-- function realloc
-- Args: [ Arg
--           { argCName = "ptr"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The pointer to the memory to reallocate."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TSize
--           , argCType = Just "size_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The new size of the memory."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "hb_realloc" hb_realloc :: 
    Ptr () ->                               -- ptr : TBasicType TPtr
    FCT.CSize ->                            -- size : TBasicType TSize
    IO (Ptr ())

-- | Reallocates the memory pointed to by /@ptr@/ to /@size@/ bytes, using the
-- allocator set at compile-time. Typically just @/realloc()/@.
-- 
-- /Since: 11.0.0/
realloc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    -- ^ /@ptr@/: The pointer to the memory to reallocate.
    -> FCT.CSize
    -- ^ /@size@/: The new size of the memory.
    -> m (Ptr ())
    -- ^ __Returns:__ A pointer to the reallocated memory.
realloc ptr size = liftIO $ do
    result <- hb_realloc ptr size
    return result


-- function paint_sweep_gradient_tiles
-- Args: [ Arg
--           { argCName = "stops"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 1
--                 (TInterface
--                    Name { namespace = "HarfBuzz" , name = "color_stop_t" })
--           , argCType = Just "hb_color_stop_t*"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "color stops (sorted, offsets in [0,1])."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "n_stops"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of stops." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "extend"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "paint_extend_t" }
--           , argCType = Just "hb_paint_extend_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "extend mode." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_angle"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "sweep start angle, in radians."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "end_angle"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "sweep end angle, in radians."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "emit_patch"
--           , argType =
--               TInterface
--                 Name
--                   { namespace = "HarfBuzz"
--                   , name = "paint_sweep_gradient_tile_func_t"
--                   }
--           , argCType = Just "hb_paint_sweep_gradient_tile_func_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "callback invoked once per tile."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeCall
--           , argClosure = 6
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data passed to @emit_patch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "n_stops"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionInout
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "number of stops." , sinceVersion = Nothing }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_sweep_gradient_tiles" hb_paint_sweep_gradient_tiles :: 
    Ptr (Ptr HarfBuzz.ColorStopT.ColorStopT) -> -- stops : TCArray False (-1) 1 (TInterface (Name {namespace = "HarfBuzz", name = "color_stop_t"}))
    Ptr Word32 ->                           -- n_stops : TBasicType TUInt
    CUInt ->                                -- extend : TInterface (Name {namespace = "HarfBuzz", name = "paint_extend_t"})
    CFloat ->                               -- start_angle : TBasicType TFloat
    CFloat ->                               -- end_angle : TBasicType TFloat
    FunPtr HarfBuzz.Callbacks.C_PaintSweepGradientTileFuncT -> -- emit_patch : TInterface (Name {namespace = "HarfBuzz", name = "paint_sweep_gradient_tile_func_t"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Iterates the full 0..2π sweep produced by a color-stop list,
-- invoking /@emitPatch@/ once per (start, end) angular segment.
-- Handles @/HB_PAINT_EXTEND_PAD/@, @/HB_PAINT_EXTEND_REPEAT/@, and
-- @/HB_PAINT_EXTEND_REFLECT/@.  Stops must be pre-sorted by
-- offset; use 'GI.HarfBuzz.Functions.paintNormalizeColorLine' first if they
-- aren\'t.
-- 
-- /Since: 14.2.0/
paintSweepGradientTiles ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [HarfBuzz.ColorStopT.ColorStopT]
    -- ^ /@stops@/: color stops (sorted, offsets in [0,1]).
    -> HarfBuzz.Enums.PaintExtendT
    -- ^ /@extend@/: extend mode.
    -> Float
    -- ^ /@startAngle@/: sweep start angle, in radians.
    -> Float
    -- ^ /@endAngle@/: sweep end angle, in radians.
    -> HarfBuzz.Callbacks.PaintSweepGradientTileFuncT
    -- ^ /@emitPatch@/: callback invoked once per tile.
    -> m ([HarfBuzz.ColorStopT.ColorStopT])
paintSweepGradientTiles stops extend startAngle endAngle emitPatch = liftIO $ do
    let nStops = fromIntegral $ P.length stops
    stops' <- mapM B.ManagedPtr.disownBoxed stops
    stops'' <- packBlockArray 12 stops'
    stops''' <- allocMem :: IO (Ptr (Ptr HarfBuzz.ColorStopT.ColorStopT))
    poke stops''' stops''
    nStops' <- allocMem :: IO (Ptr Word32)
    poke nStops' nStops
    let extend' = (fromIntegral . fromEnum) extend
    let startAngle' = realToFrac startAngle
    let endAngle' = realToFrac endAngle
    emitPatch' <- HarfBuzz.Callbacks.mk_PaintSweepGradientTileFuncT (HarfBuzz.Callbacks.wrap_PaintSweepGradientTileFuncT Nothing (HarfBuzz.Callbacks.drop_closures_PaintSweepGradientTileFuncT emitPatch))
    let userData = nullPtr
    hb_paint_sweep_gradient_tiles stops''' nStops' extend' startAngle' endAngle' emitPatch' userData
    nStops'' <- peek nStops'
    stops'''' <- peek stops'''
    stops''''' <- (unpackBoxedArrayWithLength 12 nStops'') stops''''
    stops'''''' <- mapM (wrapBoxed HarfBuzz.ColorStopT.ColorStopT) stops'''''
    freeMem stops''''
    safeFreeFunPtr $ castFunPtrToPtr emitPatch'
    mapM_ touchManagedPtr stops
    freeMem stops'''
    freeMem nStops'
    return stops''''''


-- function paint_sweep_gradient
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "color_line"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "color_line_t" }
--           , argCType = Just "hb_color_line_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Color information for the gradient"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "X coordinate of the circle's center"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Y coordinate of the circle's center"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_angle"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the start angle" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "end_angle"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the end angle" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_sweep_gradient" hb_paint_sweep_gradient :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Ptr HarfBuzz.ColorLineT.ColorLineT ->   -- color_line : TInterface (Name {namespace = "HarfBuzz", name = "color_line_t"})
    CFloat ->                               -- x0 : TBasicType TFloat
    CFloat ->                               -- y0 : TBasicType TFloat
    CFloat ->                               -- start_angle : TBasicType TFloat
    CFloat ->                               -- end_angle : TBasicType TFloat
    IO ()

-- | Perform a \"sweep-gradient\" paint operation.
-- 
-- /Since: 7.0.0/
paintSweepGradient ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> HarfBuzz.ColorLineT.ColorLineT
    -- ^ /@colorLine@/: Color information for the gradient
    -> Float
    -- ^ /@x0@/: X coordinate of the circle\'s center
    -> Float
    -- ^ /@y0@/: Y coordinate of the circle\'s center
    -> Float
    -- ^ /@startAngle@/: the start angle
    -> Float
    -- ^ /@endAngle@/: the end angle
    -> m ()
paintSweepGradient funcs paintData colorLine x0 y0 startAngle endAngle = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    colorLine' <- unsafeManagedPtrGetPtr colorLine
    let x0' = realToFrac x0
    let y0' = realToFrac y0
    let startAngle' = realToFrac startAngle
    let endAngle' = realToFrac endAngle
    hb_paint_sweep_gradient funcs' paintData colorLine' x0' y0' startAngle' endAngle'
    touchManagedPtr funcs
    touchManagedPtr colorLine
    return ()


-- function paint_reduce_linear_anchors
-- Args: [ Arg
--           { argCName = "x0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "x coordinate of P0 (color stop 0)."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "y coordinate of P0 (color stop 0)."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x1"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "x coordinate of P1 (color stop 1)."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y1"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "y coordinate of P1 (color stop 1)."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x2"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "x coordinate of P2 (rotation reference)."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y2"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "y coordinate of P2 (rotation reference)."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "xx0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "x coordinate of the resulting axis start."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "yy0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "y coordinate of the resulting axis start."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "xx1"
--           , argType = TBasicType TFloat
--           , argCType = Just "float*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "x coordinate of the resulting axis end."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "yy1"
--           , argType = TBasicType TFloat
--           , argCType = Just "float*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "y coordinate of the resulting axis end."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_reduce_linear_anchors" hb_paint_reduce_linear_anchors :: 
    CFloat ->                               -- x0 : TBasicType TFloat
    CFloat ->                               -- y0 : TBasicType TFloat
    CFloat ->                               -- x1 : TBasicType TFloat
    CFloat ->                               -- y1 : TBasicType TFloat
    CFloat ->                               -- x2 : TBasicType TFloat
    CFloat ->                               -- y2 : TBasicType TFloat
    Ptr CFloat ->                           -- xx0 : TBasicType TFloat
    Ptr CFloat ->                           -- yy0 : TBasicType TFloat
    Ptr CFloat ->                           -- xx1 : TBasicType TFloat
    Ptr CFloat ->                           -- yy1 : TBasicType TFloat
    IO ()

-- | Reduces a COLRv1 linear gradient\'s 3-anchor spec (P0=color
-- stop 0, P1=color stop 1, P2=rotation reference) to the
-- 2-point axis (P0, P1\') used by SVG \/ cairo \/ most software
-- renderers.  P1\' is the foot of P1 on the line through P0
-- perpendicular to (P2 - P0); the resulting axis is the
-- gradient\'s actual direction (perpendicular to the rotation
-- line).  Degenerate (P0 == P2) passes through unchanged.
-- 
-- /Since: 14.2.0/
paintReduceLinearAnchors ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@x0@/: x coordinate of P0 (color stop 0).
    -> Float
    -- ^ /@y0@/: y coordinate of P0 (color stop 0).
    -> Float
    -- ^ /@x1@/: x coordinate of P1 (color stop 1).
    -> Float
    -- ^ /@y1@/: y coordinate of P1 (color stop 1).
    -> Float
    -- ^ /@x2@/: x coordinate of P2 (rotation reference).
    -> Float
    -- ^ /@y2@/: y coordinate of P2 (rotation reference).
    -> m ((Float, Float, Float, Float))
paintReduceLinearAnchors x0 y0 x1 y1 x2 y2 = liftIO $ do
    let x0' = realToFrac x0
    let y0' = realToFrac y0
    let x1' = realToFrac x1
    let y1' = realToFrac y1
    let x2' = realToFrac x2
    let y2' = realToFrac y2
    xx0 <- allocMem :: IO (Ptr CFloat)
    yy0 <- allocMem :: IO (Ptr CFloat)
    xx1 <- allocMem :: IO (Ptr CFloat)
    yy1 <- allocMem :: IO (Ptr CFloat)
    hb_paint_reduce_linear_anchors x0' y0' x1' y1' x2' y2' xx0 yy0 xx1 yy1
    xx0' <- peek xx0
    let xx0'' = realToFrac xx0'
    yy0' <- peek yy0
    let yy0'' = realToFrac yy0'
    xx1' <- peek xx1
    let xx1'' = realToFrac xx1'
    yy1' <- peek yy1
    let yy1'' = realToFrac yy1'
    freeMem xx0
    freeMem yy0
    freeMem xx1
    freeMem yy1
    return (xx0'', yy0'', xx1'', yy1'')


-- function paint_radial_gradient
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "color_line"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "color_line_t" }
--           , argCType = Just "hb_color_line_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Color information for the gradient"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "X coordinate of the first circle's center"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Y coordinate of the first circle's center"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "r0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "radius of the first circle"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x1"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "X coordinate of the second circle's center"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y1"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Y coordinate of the second circle's center"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "r1"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "radius of the second circle"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_radial_gradient" hb_paint_radial_gradient :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Ptr HarfBuzz.ColorLineT.ColorLineT ->   -- color_line : TInterface (Name {namespace = "HarfBuzz", name = "color_line_t"})
    CFloat ->                               -- x0 : TBasicType TFloat
    CFloat ->                               -- y0 : TBasicType TFloat
    CFloat ->                               -- r0 : TBasicType TFloat
    CFloat ->                               -- x1 : TBasicType TFloat
    CFloat ->                               -- y1 : TBasicType TFloat
    CFloat ->                               -- r1 : TBasicType TFloat
    IO ()

-- | Perform a \"radial-gradient\" paint operation.
-- 
-- /Since: 7.0.0/
paintRadialGradient ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> HarfBuzz.ColorLineT.ColorLineT
    -- ^ /@colorLine@/: Color information for the gradient
    -> Float
    -- ^ /@x0@/: X coordinate of the first circle\'s center
    -> Float
    -- ^ /@y0@/: Y coordinate of the first circle\'s center
    -> Float
    -- ^ /@r0@/: radius of the first circle
    -> Float
    -- ^ /@x1@/: X coordinate of the second circle\'s center
    -> Float
    -- ^ /@y1@/: Y coordinate of the second circle\'s center
    -> Float
    -- ^ /@r1@/: radius of the second circle
    -> m ()
paintRadialGradient funcs paintData colorLine x0 y0 r0 x1 y1 r1 = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    colorLine' <- unsafeManagedPtrGetPtr colorLine
    let x0' = realToFrac x0
    let y0' = realToFrac y0
    let r0' = realToFrac r0
    let x1' = realToFrac x1
    let y1' = realToFrac y1
    let r1' = realToFrac r1
    hb_paint_radial_gradient funcs' paintData colorLine' x0' y0' r0' x1' y1' r1'
    touchManagedPtr funcs
    touchManagedPtr colorLine
    return ()


-- function paint_push_transform
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "xx"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "xx component of the transform matrix"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "yx"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "yx component of the transform matrix"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "xy"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "xy component of the transform matrix"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "yy"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "yy component of the transform matrix"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "dx"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "dx component of the transform matrix"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "dy"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "dy component of the transform matrix"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_push_transform" hb_paint_push_transform :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    CFloat ->                               -- xx : TBasicType TFloat
    CFloat ->                               -- yx : TBasicType TFloat
    CFloat ->                               -- xy : TBasicType TFloat
    CFloat ->                               -- yy : TBasicType TFloat
    CFloat ->                               -- dx : TBasicType TFloat
    CFloat ->                               -- dy : TBasicType TFloat
    IO ()

-- | Perform a \"push-transform\" paint operation.
-- 
-- /Since: 7.0.0/
paintPushTransform ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> Float
    -- ^ /@xx@/: xx component of the transform matrix
    -> Float
    -- ^ /@yx@/: yx component of the transform matrix
    -> Float
    -- ^ /@xy@/: xy component of the transform matrix
    -> Float
    -- ^ /@yy@/: yy component of the transform matrix
    -> Float
    -- ^ /@dx@/: dx component of the transform matrix
    -> Float
    -- ^ /@dy@/: dy component of the transform matrix
    -> m ()
paintPushTransform funcs paintData xx yx xy yy dx dy = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    let xx' = realToFrac xx
    let yx' = realToFrac yx
    let xy' = realToFrac xy
    let yy' = realToFrac yy
    let dx' = realToFrac dx
    let dy' = realToFrac dy
    hb_paint_push_transform funcs' paintData xx' yx' xy' yy' dx' dy'
    touchManagedPtr funcs
    return ()


-- function paint_push_inverse_font_transform
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "const hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a font" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_push_inverse_font_transform" hb_paint_push_inverse_font_transform :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO ()

-- | Push the inverse of the transform reflecting the font\'s
-- scale and slant settings onto the paint functions.
-- 
-- /Since: 11.0.0/
paintPushInverseFontTransform ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> HarfBuzz.FontT.FontT
    -- ^ /@font@/: a font
    -> m ()
paintPushInverseFontTransform funcs paintData font = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    font' <- unsafeManagedPtrGetPtr font
    hb_paint_push_inverse_font_transform funcs' paintData font'
    touchManagedPtr funcs
    touchManagedPtr font
    return ()


-- function paint_push_group_for
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "mode"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "paint_composite_mode_t" }
--           , argCType = Just "hb_paint_composite_mode_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the compositing mode that will be used when the group is popped"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_push_group_for" hb_paint_push_group_for :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    CUInt ->                                -- mode : TInterface (Name {namespace = "HarfBuzz", name = "paint_composite_mode_t"})
    IO ()

-- | Perform a \"push-group\" paint operation, with the compositing
-- mode known in advance.  By default, this calls
-- 'GI.HarfBuzz.Functions.paintPushGroup'.
-- 
-- /Since: 14.2.0/
paintPushGroupFor ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> HarfBuzz.Enums.PaintCompositeModeT
    -- ^ /@mode@/: the compositing mode that will be used when the group is popped
    -> m ()
paintPushGroupFor funcs paintData mode = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    let mode' = (fromIntegral . fromEnum) mode
    hb_paint_push_group_for funcs' paintData mode'
    touchManagedPtr funcs
    return ()


-- function paint_push_group
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_push_group" hb_paint_push_group :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    IO ()

-- | Perform a \"push-group\" paint operation.
-- 
-- /Since: 7.0.0/
paintPushGroup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> m ()
paintPushGroup funcs paintData = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    hb_paint_push_group funcs' paintData
    touchManagedPtr funcs
    return ()


-- function paint_push_font_transform
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "const hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a font" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_push_font_transform" hb_paint_push_font_transform :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO ()

-- | Push the transform reflecting the font\'s scale and slant
-- settings onto the paint functions.
-- 
-- /Since: 11.0.0/
paintPushFontTransform ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> HarfBuzz.FontT.FontT
    -- ^ /@font@/: a font
    -> m ()
paintPushFontTransform funcs paintData font = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    font' <- unsafeManagedPtrGetPtr font
    hb_paint_push_font_transform funcs' paintData font'
    touchManagedPtr funcs
    touchManagedPtr font
    return ()


-- function paint_push_clip_rectangle
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "xmin"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "min X for the rectangle"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "ymin"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "min Y for the rectangle"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "xmax"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "max X for the rectangle"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "ymax"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "max Y for the rectangle"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_push_clip_rectangle" hb_paint_push_clip_rectangle :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    CFloat ->                               -- xmin : TBasicType TFloat
    CFloat ->                               -- ymin : TBasicType TFloat
    CFloat ->                               -- xmax : TBasicType TFloat
    CFloat ->                               -- ymax : TBasicType TFloat
    IO ()

-- | Perform a \"push-clip-rect\" paint operation.
-- 
-- /Since: 7.0.0/
paintPushClipRectangle ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> Float
    -- ^ /@xmin@/: min X for the rectangle
    -> Float
    -- ^ /@ymin@/: min Y for the rectangle
    -> Float
    -- ^ /@xmax@/: max X for the rectangle
    -> Float
    -- ^ /@ymax@/: max Y for the rectangle
    -> m ()
paintPushClipRectangle funcs paintData xmin ymin xmax ymax = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    let xmin' = realToFrac xmin
    let ymin' = realToFrac ymin
    let xmax' = realToFrac xmax
    let ymax' = realToFrac ymax
    hb_paint_push_clip_rectangle funcs' paintData xmin' ymin' xmax' ymax'
    touchManagedPtr funcs
    return ()


-- function paint_push_clip_path_start
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "draw_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void**"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "location to receive the draw data\n  the caller should pass alongside the returned draw funcs."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "draw_funcs_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_push_clip_path_start" hb_paint_push_clip_path_start :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Ptr (Ptr ()) ->                         -- draw_data : TBasicType TPtr
    IO (Ptr HarfBuzz.DrawFuncsT.DrawFuncsT)

-- | Begin clipping to an arbitrary path.  Returns an
-- t'GI.HarfBuzz.Structs.DrawFuncsT.DrawFuncsT' owned by the backend (the caller must not
-- free it) that the caller uses to emit the clip outline via
-- hb_draw_*() calls, using the returned /@drawData@/ as the
-- draw data.  The returned draw funcs and draw data are only
-- valid until the matching 'GI.HarfBuzz.Functions.paintPushClipPathEnd' call;
-- no other paint calls should be made between start and end
-- except hb_draw_*() on the returned funcs.  Finish the path
-- with 'GI.HarfBuzz.Functions.paintPushClipPathEnd'; pop the clip later
-- with 'GI.HarfBuzz.Functions.paintPopClip'.
-- 
-- Usage:
-- 
-- 
-- === /plain code/
-- >
-- >hb_draw_funcs_t *df = hb_paint_push_clip_path_start (pf, pd, &dd);
-- >hb_draw_move_to (df, dd, NULL, ...);
-- >hb_draw_line_to (df, dd, NULL, ...);
-- >...
-- >hb_draw_close_path (df, dd, NULL);
-- >hb_paint_push_clip_path_end (pf, pd);
-- >/&ast; paint ops here are clipped to the emitted path &ast;/
-- >hb_paint_pop_clip (pf, pd);
-- 
-- 
-- /Since: 14.2.0/
paintPushClipPathStart ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> m ((HarfBuzz.DrawFuncsT.DrawFuncsT, Ptr ()))
    -- ^ __Returns:__ draw funcs that accumulate
    --   the clip path, or @NULL@ if the backend does not implement
    --   arbitrary-path clipping.
paintPushClipPathStart funcs paintData = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    drawData <- callocMem :: IO (Ptr (Ptr ()))
    result <- hb_paint_push_clip_path_start funcs' paintData drawData
    checkUnexpectedReturnNULL "paintPushClipPathStart" result
    result' <- (newBoxed HarfBuzz.DrawFuncsT.DrawFuncsT) result
    drawData' <- peek drawData
    touchManagedPtr funcs
    freeMem drawData
    return (result', drawData')


-- function paint_push_clip_path_end
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_push_clip_path_end" hb_paint_push_clip_path_end :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    IO ()

-- | Signal that the arbitrary-clip path started by
-- 'GI.HarfBuzz.Functions.paintPushClipPathStart' is fully drawn.  The
-- accumulated path now acts as a clip on the paint context
-- until a matching 'GI.HarfBuzz.Functions.paintPopClip' call.
-- 
-- /Since: 14.2.0/
paintPushClipPathEnd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> m ()
paintPushClipPathEnd funcs paintData = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    hb_paint_push_clip_path_end funcs' paintData
    touchManagedPtr funcs
    return ()


-- function paint_push_clip_glyph
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the glyph ID" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the font" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_push_clip_glyph" hb_paint_push_clip_glyph :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO ()

-- | Perform a \"push-clip-glyph\" paint operation.
-- 
-- /Since: 7.0.0/
paintPushClipGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> Word32
    -- ^ /@glyph@/: the glyph ID
    -> HarfBuzz.FontT.FontT
    -- ^ /@font@/: the font
    -> m ()
paintPushClipGlyph funcs paintData glyph font = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    font' <- unsafeManagedPtrGetPtr font
    hb_paint_push_clip_glyph funcs' paintData glyph font'
    touchManagedPtr funcs
    touchManagedPtr font
    return ()


-- function paint_pop_transform
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_pop_transform" hb_paint_pop_transform :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    IO ()

-- | Perform a \"pop-transform\" paint operation.
-- 
-- /Since: 7.0.0/
paintPopTransform ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> m ()
paintPopTransform funcs paintData = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    hb_paint_pop_transform funcs' paintData
    touchManagedPtr funcs
    return ()


-- function paint_pop_group
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "mode"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "paint_composite_mode_t" }
--           , argCType = Just "hb_paint_composite_mode_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the compositing mode to use"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_pop_group" hb_paint_pop_group :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    CUInt ->                                -- mode : TInterface (Name {namespace = "HarfBuzz", name = "paint_composite_mode_t"})
    IO ()

-- | Perform a \"pop-group\" paint operation.
-- 
-- /Since: 7.0.0/
paintPopGroup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> HarfBuzz.Enums.PaintCompositeModeT
    -- ^ /@mode@/: the compositing mode to use
    -> m ()
paintPopGroup funcs paintData mode = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    let mode' = (fromIntegral . fromEnum) mode
    hb_paint_pop_group funcs' paintData mode'
    touchManagedPtr funcs
    return ()


-- function paint_pop_clip
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_pop_clip" hb_paint_pop_clip :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    IO ()

-- | Perform a \"pop-clip\" paint operation.
-- 
-- /Since: 7.0.0/
paintPopClip ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> m ()
paintPopClip funcs paintData = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    hb_paint_pop_clip funcs' paintData
    touchManagedPtr funcs
    return ()


-- function paint_normalize_color_line
-- Args: [ Arg
--           { argCName = "stops"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 1
--                 (TInterface
--                    Name { namespace = "HarfBuzz" , name = "color_stop_t" })
--           , argCType = Just "hb_color_stop_t*"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "color stops." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of stops." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "min"
--           , argType = TBasicType TFloat
--           , argCType = Just "float*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "original minimum offset."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "max"
--           , argType = TBasicType TFloat
--           , argCType = Just "float*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "original maximum offset."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionInout
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "number of stops." , sinceVersion = Nothing }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_normalize_color_line" hb_paint_normalize_color_line :: 
    Ptr (Ptr HarfBuzz.ColorStopT.ColorStopT) -> -- stops : TCArray False (-1) 1 (TInterface (Name {namespace = "HarfBuzz", name = "color_stop_t"}))
    Ptr Word32 ->                           -- len : TBasicType TUInt
    Ptr CFloat ->                           -- min : TBasicType TFloat
    Ptr CFloat ->                           -- max : TBasicType TFloat
    IO ()

-- | Sorts /@stops@/ by offset and rescales offsets into [0, 1] in
-- place.  Writes the original (min, max) to /@min@/ \/ /@max@/ so the
-- caller can shift the gradient geometry (axis endpoints for
-- linear, centers+radii for radial, start+end angles for sweep)
-- to keep the rendered gradient visually unchanged after the
-- rescale.  Empty input is safe: both out-parameters set to 0.
-- 
-- /Since: 14.2.0/
paintNormalizeColorLine ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [HarfBuzz.ColorStopT.ColorStopT]
    -- ^ /@stops@/: color stops.
    -> m (([HarfBuzz.ColorStopT.ColorStopT], Float, Float))
paintNormalizeColorLine stops = liftIO $ do
    let len = fromIntegral $ P.length stops
    stops' <- mapM B.ManagedPtr.disownBoxed stops
    stops'' <- packBlockArray 12 stops'
    stops''' <- allocMem :: IO (Ptr (Ptr HarfBuzz.ColorStopT.ColorStopT))
    poke stops''' stops''
    len' <- allocMem :: IO (Ptr Word32)
    poke len' len
    min <- allocMem :: IO (Ptr CFloat)
    max <- allocMem :: IO (Ptr CFloat)
    hb_paint_normalize_color_line stops''' len' min max
    len'' <- peek len'
    stops'''' <- peek stops'''
    stops''''' <- (unpackBoxedArrayWithLength 12 len'') stops''''
    stops'''''' <- mapM (wrapBoxed HarfBuzz.ColorStopT.ColorStopT) stops'''''
    freeMem stops''''
    min' <- peek min
    let min'' = realToFrac min'
    max' <- peek max
    let max'' = realToFrac max'
    mapM_ touchManagedPtr stops
    freeMem stops'''
    freeMem len'
    freeMem min
    freeMem max
    return (stops'''''', min'', max'')


-- function paint_linear_gradient
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "color_line"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "color_line_t" }
--           , argCType = Just "hb_color_line_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Color information for the gradient"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "X coordinate of the first point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Y coordinate of the first point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x1"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "X coordinate of the second point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y1"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Y coordinate of the second point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x2"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "X coordinate of the third point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y2"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Y coordinate of the third point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_linear_gradient" hb_paint_linear_gradient :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Ptr HarfBuzz.ColorLineT.ColorLineT ->   -- color_line : TInterface (Name {namespace = "HarfBuzz", name = "color_line_t"})
    CFloat ->                               -- x0 : TBasicType TFloat
    CFloat ->                               -- y0 : TBasicType TFloat
    CFloat ->                               -- x1 : TBasicType TFloat
    CFloat ->                               -- y1 : TBasicType TFloat
    CFloat ->                               -- x2 : TBasicType TFloat
    CFloat ->                               -- y2 : TBasicType TFloat
    IO ()

-- | Perform a \"linear-gradient\" paint operation.
-- 
-- /Since: 7.0.0/
paintLinearGradient ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> HarfBuzz.ColorLineT.ColorLineT
    -- ^ /@colorLine@/: Color information for the gradient
    -> Float
    -- ^ /@x0@/: X coordinate of the first point
    -> Float
    -- ^ /@y0@/: Y coordinate of the first point
    -> Float
    -- ^ /@x1@/: X coordinate of the second point
    -> Float
    -- ^ /@y1@/: Y coordinate of the second point
    -> Float
    -- ^ /@x2@/: X coordinate of the third point
    -> Float
    -- ^ /@y2@/: Y coordinate of the third point
    -> m ()
paintLinearGradient funcs paintData colorLine x0 y0 x1 y1 x2 y2 = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    colorLine' <- unsafeManagedPtrGetPtr colorLine
    let x0' = realToFrac x0
    let y0' = realToFrac y0
    let x1' = realToFrac x1
    let y1' = realToFrac y1
    let x2' = realToFrac x2
    let y2' = realToFrac y2
    hb_paint_linear_gradient funcs' paintData colorLine' x0' y0' x1' y1' x2' y2'
    touchManagedPtr funcs
    touchManagedPtr colorLine
    return ()


-- function paint_image
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "image"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "width"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "width of the raster image in pixels, or 0"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "height"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "height of the raster image in pixels, or 0"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "format"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the image format as a tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "slant"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Deprecated. set to 0.0"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "extents"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "glyph_extents_t" }
--           , argCType = Just "hb_glyph_extents_t*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the extents of the glyph"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_image" hb_paint_image :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Ptr HarfBuzz.BlobT.BlobT ->             -- image : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    Word32 ->                               -- width : TBasicType TUInt
    Word32 ->                               -- height : TBasicType TUInt
    Word32 ->                               -- format : TBasicType TUInt32
    CFloat ->                               -- slant : TBasicType TFloat
    Ptr HarfBuzz.GlyphExtentsT.GlyphExtentsT -> -- extents : TInterface (Name {namespace = "HarfBuzz", name = "glyph_extents_t"})
    IO ()

-- | Perform a \"image\" paint operation.
-- 
-- /Since: 7.0.0/
paintImage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> HarfBuzz.BlobT.BlobT
    -- ^ /@image@/: image data
    -> Word32
    -- ^ /@width@/: width of the raster image in pixels, or 0
    -> Word32
    -- ^ /@height@/: height of the raster image in pixels, or 0
    -> Word32
    -- ^ /@format@/: the image format as a tag
    -> Float
    -- ^ /@slant@/: Deprecated. set to 0.0
    -> Maybe (HarfBuzz.GlyphExtentsT.GlyphExtentsT)
    -- ^ /@extents@/: the extents of the glyph
    -> m ()
paintImage funcs paintData image width height format slant extents = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    image' <- unsafeManagedPtrGetPtr image
    let slant' = realToFrac slant
    maybeExtents <- case extents of
        Nothing -> return FP.nullPtr
        Just jExtents -> do
            jExtents' <- unsafeManagedPtrGetPtr jExtents
            return jExtents'
    hb_paint_image funcs' paintData image' width height format slant' maybeExtents
    touchManagedPtr funcs
    touchManagedPtr image
    whenJust extents touchManagedPtr
    return ()


-- function paint_funcs_set_sweep_gradient_func
-- XXX Could not generate function paint_funcs_set_sweep_gradient_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_radial_gradient_func
-- XXX Could not generate function paint_funcs_set_radial_gradient_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_push_transform_func
-- XXX Could not generate function paint_funcs_set_push_transform_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_push_group_func
-- XXX Could not generate function paint_funcs_set_push_group_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_push_group_for_func
-- XXX Could not generate function paint_funcs_set_push_group_for_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_push_clip_rectangle_func
-- XXX Could not generate function paint_funcs_set_push_clip_rectangle_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_push_clip_path_start_func
-- XXX Could not generate function paint_funcs_set_push_clip_path_start_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_push_clip_path_end_func
-- XXX Could not generate function paint_funcs_set_push_clip_path_end_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_push_clip_glyph_func
-- XXX Could not generate function paint_funcs_set_push_clip_glyph_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_pop_transform_func
-- XXX Could not generate function paint_funcs_set_pop_transform_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_pop_group_func
-- XXX Could not generate function paint_funcs_set_pop_group_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_pop_clip_func
-- XXX Could not generate function paint_funcs_set_pop_clip_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_linear_gradient_func
-- XXX Could not generate function paint_funcs_set_linear_gradient_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_image_func
-- XXX Could not generate function paint_funcs_set_image_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_fill_glyph_func
-- XXX Could not generate function paint_funcs_set_fill_glyph_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_custom_palette_color_func
-- XXX Could not generate function paint_funcs_set_custom_palette_color_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_color_glyph_func
-- XXX Could not generate function paint_funcs_set_color_glyph_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_set_color_func
-- XXX Could not generate function paint_funcs_set_color_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function paint_funcs_make_immutable
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The paint-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_funcs_make_immutable" hb_paint_funcs_make_immutable :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    IO ()

-- | Makes a paint-functions structure immutable.
-- 
-- After this call, all attempts to set one of the callbacks
-- on /@funcs@/ will fail.
-- 
-- /Since: 7.0.0/
paintFuncsMakeImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: The paint-functions structure
    -> m ()
paintFuncsMakeImmutable funcs = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    hb_paint_funcs_make_immutable funcs'
    touchManagedPtr funcs
    return ()


-- function paint_funcs_is_immutable
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The paint-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_funcs_is_immutable" hb_paint_funcs_is_immutable :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    IO Int32

-- | Tests whether a paint-functions structure is immutable.
-- 
-- /Since: 7.0.0/
paintFuncsIsImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: The paint-functions structure
    -> m Int32
    -- ^ __Returns:__ @true@ if /@funcs@/ is immutable, @false@ otherwise
paintFuncsIsImmutable funcs = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    result <- hb_paint_funcs_is_immutable funcs'
    touchManagedPtr funcs
    return result


-- function paint_funcs_get_empty
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "paint_funcs_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_funcs_get_empty" hb_paint_funcs_get_empty :: 
    IO (Ptr HarfBuzz.PaintFuncsT.PaintFuncsT)

-- | Fetches the singleton empty paint-functions structure.
-- 
-- /Since: 7.0.0/
paintFuncsGetEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ __Returns:__ The empty paint-functions structure
paintFuncsGetEmpty  = liftIO $ do
    result <- hb_paint_funcs_get_empty
    checkUnexpectedReturnNULL "paintFuncsGetEmpty" result
    result' <- (wrapBoxed HarfBuzz.PaintFuncsT.PaintFuncsT) result
    return result'


-- function paint_funcs_create
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "paint_funcs_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_funcs_create" hb_paint_funcs_create :: 
    IO (Ptr HarfBuzz.PaintFuncsT.PaintFuncsT)

-- | Creates a new t'GI.HarfBuzz.Structs.PaintFuncsT.PaintFuncsT' structure of paint functions.
-- 
-- The initial reference count of 1 should be released with @/hb_paint_funcs_destroy()/@
-- when you are done using the t'GI.HarfBuzz.Structs.PaintFuncsT.PaintFuncsT'. This function never returns
-- @NULL@. If memory cannot be allocated, a special singleton t'GI.HarfBuzz.Structs.PaintFuncsT.PaintFuncsT'
-- object will be returned.
-- 
-- /Since: 7.0.0/
paintFuncsCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ __Returns:__ the paint-functions structure
paintFuncsCreate  = liftIO $ do
    result <- hb_paint_funcs_create
    checkUnexpectedReturnNULL "paintFuncsCreate" result
    result' <- (wrapBoxed HarfBuzz.PaintFuncsT.PaintFuncsT) result
    return result'


-- function paint_fill_glyph
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the glyph ID" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the font" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "is_foreground"
--           , argType = TBasicType TInt
--           , argCType = Just "hb_bool_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "whether the color is the foreground"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "color"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_color_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The color to use" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_fill_glyph" hb_paint_fill_glyph :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Int32 ->                                -- is_foreground : TBasicType TInt
    Word32 ->                               -- color : TBasicType TUInt32
    IO ()

-- | Perform a \"fill-glyph\" paint operation: fill the glyph\'s shape
-- with a solid color.
-- 
-- /Since: 14.3.0/
paintFillGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> Word32
    -- ^ /@glyph@/: the glyph ID
    -> HarfBuzz.FontT.FontT
    -- ^ /@font@/: the font
    -> Int32
    -- ^ /@isForeground@/: whether the color is the foreground
    -> Word32
    -- ^ /@color@/: The color to use
    -> m ()
paintFillGlyph funcs paintData glyph font isForeground color = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    font' <- unsafeManagedPtrGetPtr font
    hb_paint_fill_glyph funcs' paintData glyph font' isForeground color
    touchManagedPtr funcs
    touchManagedPtr font
    return ()


-- function paint_custom_palette_color
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "color_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "color index to fetch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "color"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_color_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "fetched color." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_custom_palette_color" hb_paint_custom_palette_color :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Word32 ->                               -- color_index : TBasicType TUInt
    Ptr Word32 ->                           -- color : TBasicType TUInt32
    IO Int32

-- | Gets the custom palette override color for /@colorIndex@/.
-- 
-- /Since: 7.0.0/
paintCustomPaletteColor ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions.
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller.
    -> Word32
    -- ^ /@colorIndex@/: color index to fetch.
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if a custom color is provided, @false@ otherwise.
paintCustomPaletteColor funcs paintData colorIndex = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    color <- allocMem :: IO (Ptr Word32)
    result <- hb_paint_custom_palette_color funcs' paintData colorIndex color
    color' <- peek color
    touchManagedPtr funcs
    freeMem color
    return (result, color')


-- function paint_color_glyph
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the glyph ID" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the font" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_color_glyph" hb_paint_color_glyph :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO Int32

-- | Perform a \"color-glyph\" paint operation.
-- 
-- /Since: 8.2.0/
paintColorGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> Word32
    -- ^ /@glyph@/: the glyph ID
    -> HarfBuzz.FontT.FontT
    -- ^ /@font@/: the font
    -> m Int32
paintColorGlyph funcs paintData glyph font = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_paint_color_glyph funcs' paintData glyph font'
    touchManagedPtr funcs
    touchManagedPtr font
    return result


-- function paint_color
-- Args: [ Arg
--           { argCName = "funcs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "paint functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "is_foreground"
--           , argType = TBasicType TInt
--           , argCType = Just "hb_bool_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "whether the color is the foreground"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "color"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_color_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The color to use" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_paint_color" hb_paint_color :: 
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- funcs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Int32 ->                                -- is_foreground : TBasicType TInt
    Word32 ->                               -- color : TBasicType TUInt32
    IO ()

-- | Perform a \"color\" paint operation.
-- 
-- /Since: 7.0.0/
paintColor ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@funcs@/: paint functions
    -> Ptr ()
    -- ^ /@paintData@/: associated data passed by the caller
    -> Int32
    -- ^ /@isForeground@/: whether the color is the foreground
    -> Word32
    -- ^ /@color@/: The color to use
    -> m ()
paintColor funcs paintData isForeground color = liftIO $ do
    funcs' <- unsafeManagedPtrGetPtr funcs
    hb_paint_color funcs' paintData isForeground color
    touchManagedPtr funcs
    return ()


-- function ot_var_normalize_variations
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_face_t to work on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "variations"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "variation_t" }
--           , argCType = Just "const hb_variation_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The array of variations to normalize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "variations_length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The number of variations to normalize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coords"
--           , argType = TCArray False (-1) 4 (TBasicType TInt)
--           , argCType = Just "int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The array of normalized coordinates"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "coords_length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The length of the coordinate array"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "coords_length"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The length of the coordinate array"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_var_normalize_variations" hb_ot_var_normalize_variations :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Ptr HarfBuzz.VariationT.VariationT ->   -- variations : TInterface (Name {namespace = "HarfBuzz", name = "variation_t"})
    Word32 ->                               -- variations_length : TBasicType TUInt
    Ptr (Ptr Int32) ->                      -- coords : TCArray False (-1) 4 (TBasicType TInt)
    Ptr Word32 ->                           -- coords_length : TBasicType TUInt
    IO ()

-- | Normalizes all of the coordinates in the given list of variation axes.
-- 
-- /Since: 1.4.2/
otVarNormalizeVariations ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: The t'GI.HarfBuzz.Structs.FaceT.FaceT' to work on
    -> HarfBuzz.VariationT.VariationT
    -- ^ /@variations@/: The array of variations to normalize
    -> Word32
    -- ^ /@variationsLength@/: The number of variations to normalize
    -> m ([Int32])
otVarNormalizeVariations face variations variationsLength = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    variations' <- unsafeManagedPtrGetPtr variations
    coords <- callocMem :: IO (Ptr (Ptr Int32))
    coordsLength <- allocMem :: IO (Ptr Word32)
    hb_ot_var_normalize_variations face' variations' variationsLength coords coordsLength
    coordsLength' <- peek coordsLength
    coords' <- peek coords
    coords'' <- (unpackStorableArrayWithLength coordsLength') coords'
    freeMem coords'
    touchManagedPtr face
    touchManagedPtr variations
    freeMem coords
    freeMem coordsLength
    return coords''


-- function ot_var_normalize_coords
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_face_t to work on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coords_length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The length of the coordinate array"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "design_coords"
--           , argType = TBasicType TFloat
--           , argCType = Just "const float*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The design-space coordinates to normalize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "normalized_coords"
--           , argType = TBasicType TInt
--           , argCType = Just "int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The normalized coordinates"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_var_normalize_coords" hb_ot_var_normalize_coords :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- coords_length : TBasicType TUInt
    CFloat ->                               -- design_coords : TBasicType TFloat
    Ptr Int32 ->                            -- normalized_coords : TBasicType TInt
    IO ()

-- | Normalizes the given design-space coordinates. The minimum and maximum
-- values for the axis are mapped to the interval [-1,1], with the default
-- axis value mapped to 0.
-- 
-- The normalized values have 14 bits of fixed-point sub-integer precision as per
-- OpenType specification.
-- 
-- Any additional scaling defined in the face\'s @avar@ table is also
-- applied, as described at https:\/\/docs.microsoft.com\/en-us\/typography\/opentype\/spec\/avar
-- 
-- Note: /@coordsLength@/ must be the same as the number of axes in the face, as
-- for example returned by 'GI.HarfBuzz.Functions.otVarGetAxisCount'.
-- Otherwise, the behavior is undefined.
-- 
-- /Since: 1.4.2/
otVarNormalizeCoords ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: The t'GI.HarfBuzz.Structs.FaceT.FaceT' to work on
    -> Word32
    -- ^ /@coordsLength@/: The length of the coordinate array
    -> Float
    -- ^ /@designCoords@/: The design-space coordinates to normalize
    -> m (Int32)
otVarNormalizeCoords face coordsLength designCoords = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    let designCoords' = realToFrac designCoords
    normalizedCoords <- allocMem :: IO (Ptr Int32)
    hb_ot_var_normalize_coords face' coordsLength designCoords' normalizedCoords
    normalizedCoords' <- peek normalizedCoords
    touchManagedPtr face
    freeMem normalizedCoords
    return normalizedCoords'


-- function ot_var_named_instance_get_subfamily_name_id
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_face_t to work on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "instance_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the named instance to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_var_named_instance_get_subfamily_name_id" hb_ot_var_named_instance_get_subfamily_name_id :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- instance_index : TBasicType TUInt
    IO Word32

-- | Fetches the @name@ table Name ID that provides display names for
-- the \"Subfamily name\" defined for the given named instance in the face.
-- 
-- /Since: 2.2.0/
otVarNamedInstanceGetSubfamilyNameId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: The t'GI.HarfBuzz.Structs.FaceT.FaceT' to work on
    -> Word32
    -- ^ /@instanceIndex@/: The index of the named instance to query
    -> m Word32
    -- ^ __Returns:__ the Name ID found for the Subfamily name
otVarNamedInstanceGetSubfamilyNameId face instanceIndex = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_var_named_instance_get_subfamily_name_id face' instanceIndex
    touchManagedPtr face
    return result


-- function ot_var_named_instance_get_postscript_name_id
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_face_t to work on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "instance_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the named instance to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_var_named_instance_get_postscript_name_id" hb_ot_var_named_instance_get_postscript_name_id :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- instance_index : TBasicType TUInt
    IO Word32

-- | Fetches the @name@ table Name ID that provides display names for
-- the \"PostScript name\" defined for the given named instance in the face.
-- 
-- /Since: 2.2.0/
otVarNamedInstanceGetPostscriptNameId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: The t'GI.HarfBuzz.Structs.FaceT.FaceT' to work on
    -> Word32
    -- ^ /@instanceIndex@/: The index of the named instance to query
    -> m Word32
    -- ^ __Returns:__ the Name ID found for the PostScript name
otVarNamedInstanceGetPostscriptNameId face instanceIndex = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_var_named_instance_get_postscript_name_id face' instanceIndex
    touchManagedPtr face
    return result


-- function ot_var_named_instance_get_design_coords
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_face_t to work on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "instance_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the named instance to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coords_length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of coordinates to return;\n                Output = the actual number of coordinates returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "coords"
--           , argType = TCArray False (-1) 2 (TBasicType TFloat)
--           , argCType = Just "float*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The array of coordinates found for the query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "coords_length"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of coordinates to return;\n                Output = the actual number of coordinates returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_var_named_instance_get_design_coords" hb_ot_var_named_instance_get_design_coords :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- instance_index : TBasicType TUInt
    Ptr Word32 ->                           -- coords_length : TBasicType TUInt
    Ptr (Ptr CFloat) ->                     -- coords : TCArray False (-1) 2 (TBasicType TFloat)
    IO Word32

-- | Fetches the design-space coordinates corresponding to the given
-- named instance in the face.
-- 
-- /Since: 2.2.0/
otVarNamedInstanceGetDesignCoords ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: The t'GI.HarfBuzz.Structs.FaceT.FaceT' to work on
    -> Word32
    -- ^ /@instanceIndex@/: The index of the named instance to query
    -> m ((Word32, Maybe [Float]))
    -- ^ __Returns:__ the number of variation axes in the face
otVarNamedInstanceGetDesignCoords face instanceIndex = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    coordsLength <- allocMem :: IO (Ptr Word32)
    coords <- callocMem :: IO (Ptr (Ptr CFloat))
    result <- hb_ot_var_named_instance_get_design_coords face' instanceIndex coordsLength coords
    coordsLength' <- peek coordsLength
    coords' <- peek coords
    maybeCoords' <- convertIfNonNull coords' $ \coords'' -> do
        coords''' <- (unpackMapStorableArrayWithLength realToFrac coordsLength') coords''
        freeMem coords''
        return coords'''
    touchManagedPtr face
    freeMem coordsLength
    freeMem coords
    return (result, maybeCoords')


-- function ot_var_has_data
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_face_t to work on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_var_has_data" hb_ot_var_has_data :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests whether a face includes any OpenType variation data in the @fvar@ table.
-- 
-- /Since: 1.4.2/
otVarHasData ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: The t'GI.HarfBuzz.Structs.FaceT.FaceT' to work on
    -> m Int32
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
otVarHasData face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_var_has_data face'
    touchManagedPtr face
    return result


-- function ot_var_get_named_instance_count
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_face_t to work on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_var_get_named_instance_count" hb_ot_var_get_named_instance_count :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Word32

-- | Fetches the number of named instances included in the face.
-- 
-- /Since: 2.2.0/
otVarGetNamedInstanceCount ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: The t'GI.HarfBuzz.Structs.FaceT.FaceT' to work on
    -> m Word32
    -- ^ __Returns:__ the number of named instances defined
otVarGetNamedInstanceCount face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_var_get_named_instance_count face'
    touchManagedPtr face
    return result


-- function ot_var_get_axis_infos
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first lookup to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "axes_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of variation axes to return;\n               Output = the actual number of variation axes returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "axes_array"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 2
--                 (TInterface
--                    Name { namespace = "HarfBuzz" , name = "ot_var_axis_info_t" })
--           , argCType = Just "hb_ot_var_axis_info_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The array of variation axes found"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "axes_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of variation axes to return;\n               Output = the actual number of variation axes returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_var_get_axis_infos" hb_ot_var_get_axis_infos :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- start_offset : TBasicType TUInt
    Word32 ->                               -- axes_count : TBasicType TUInt
    Ptr HarfBuzz.OtVarAxisInfoT.OtVarAxisInfoT -> -- axes_array : TCArray False (-1) 2 (TInterface (Name {namespace = "HarfBuzz", name = "ot_var_axis_info_t"}))
    IO Word32

-- | Fetches a list of all variation axes in the specified face. The list returned will begin
-- at the offset provided.
-- 
-- /Since: 2.2.0/
otVarGetAxisInfos ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@startOffset@/: offset of the first lookup to retrieve
    -> Maybe ([HarfBuzz.OtVarAxisInfoT.OtVarAxisInfoT])
    -- ^ /@axesArray@/: The array of variation axes found
    -> m ((Word32, Maybe [HarfBuzz.OtVarAxisInfoT.OtVarAxisInfoT]))
    -- ^ __Returns:__ the number of variation axes in the face
otVarGetAxisInfos face startOffset axesArray = liftIO $ do
    let axesCount = case axesArray of
            Nothing -> 0
            Just jAxesArray -> fromIntegral $ P.length jAxesArray
    face' <- unsafeManagedPtrGetPtr face
    maybeAxesArray <- case axesArray of
        Nothing -> return FP.nullPtr
        Just jAxesArray -> do
            jAxesArray' <- mapM B.ManagedPtr.disownBoxed jAxesArray
            jAxesArray'' <- packBlockArray 32 jAxesArray'
            return jAxesArray''
    result <- hb_ot_var_get_axis_infos face' startOffset axesCount maybeAxesArray
    maybeMaybeAxesArray <- convertIfNonNull maybeAxesArray $ \maybeAxesArray' -> do
        maybeAxesArray'' <- (unpackBoxedArrayWithLength 32 axesCount) maybeAxesArray'
        maybeAxesArray''' <- mapM (wrapBoxed HarfBuzz.OtVarAxisInfoT.OtVarAxisInfoT) maybeAxesArray''
        freeMem maybeAxesArray'
        return maybeAxesArray'''
    touchManagedPtr face
    whenJust axesArray (mapM_ touchManagedPtr)
    return (result, maybeMaybeAxesArray)


-- function ot_var_get_axis_count
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_face_t to work on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_var_get_axis_count" hb_ot_var_get_axis_count :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Word32

-- | Fetches the number of OpenType variation axes included in the face.
-- 
-- /Since: 1.4.2/
otVarGetAxisCount ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: The t'GI.HarfBuzz.Structs.FaceT.FaceT' to work on
    -> m Word32
    -- ^ __Returns:__ the number of variation axes defined
otVarGetAxisCount face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_var_get_axis_count face'
    touchManagedPtr face
    return result


-- function ot_var_get_axes
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first lookup to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "axes_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of variation axes to return;\n               Output = the actual number of variation axes returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "axes_array"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 2
--                 (TInterface
--                    Name { namespace = "HarfBuzz" , name = "ot_var_axis_t" })
--           , argCType = Just "hb_ot_var_axis_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The array of variation axes found"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "axes_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of variation axes to return;\n               Output = the actual number of variation axes returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_var_get_axes" hb_ot_var_get_axes :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- start_offset : TBasicType TUInt
    Word32 ->                               -- axes_count : TBasicType TUInt
    Ptr HarfBuzz.OtVarAxisT.OtVarAxisT ->   -- axes_array : TCArray False (-1) 2 (TInterface (Name {namespace = "HarfBuzz", name = "ot_var_axis_t"}))
    IO Word32

{-# DEPRECATED otVarGetAxes ["(Since version 2.2.0)","use 'GI.HarfBuzz.Functions.otVarGetAxisInfos' instead"] #-}
-- | Fetches a list of all variation axes in the specified face. The list returned will begin
-- at the offset provided.
-- 
-- /Since: 1.4.2/
otVarGetAxes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@startOffset@/: offset of the first lookup to retrieve
    -> Maybe ([HarfBuzz.OtVarAxisT.OtVarAxisT])
    -- ^ /@axesArray@/: The array of variation axes found
    -> m ((Word32, Maybe [HarfBuzz.OtVarAxisT.OtVarAxisT]))
otVarGetAxes face startOffset axesArray = liftIO $ do
    let axesCount = case axesArray of
            Nothing -> 0
            Just jAxesArray -> fromIntegral $ P.length jAxesArray
    face' <- unsafeManagedPtrGetPtr face
    maybeAxesArray <- case axesArray of
        Nothing -> return FP.nullPtr
        Just jAxesArray -> do
            jAxesArray' <- mapM unsafeManagedPtrGetPtr jAxesArray
            jAxesArray'' <- packBlockArray 20 jAxesArray'
            return jAxesArray''
    result <- hb_ot_var_get_axes face' startOffset axesCount maybeAxesArray
    maybeMaybeAxesArray <- convertIfNonNull maybeAxesArray $ \maybeAxesArray' -> do
        maybeAxesArray'' <- (unpackBlockArrayWithLength 20 axesCount) maybeAxesArray'
        maybeAxesArray''' <- mapM (wrapPtr HarfBuzz.OtVarAxisT.OtVarAxisT) maybeAxesArray''
        freeMem maybeAxesArray'
        return maybeAxesArray'''
    touchManagedPtr face
    whenJust axesArray (mapM_ touchManagedPtr)
    return (result, maybeMaybeAxesArray)


-- function ot_var_find_axis_info
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "axis_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_tag_t of the variation axis to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "axis_info"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_var_axis_info_t" }
--           , argCType = Just "hb_ot_var_axis_info_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The #hb_ot_var_axis_info_t of the axis tag queried"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_var_find_axis_info" hb_ot_var_find_axis_info :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- axis_tag : TBasicType TUInt32
    Ptr HarfBuzz.OtVarAxisInfoT.OtVarAxisInfoT -> -- axis_info : TInterface (Name {namespace = "HarfBuzz", name = "ot_var_axis_info_t"})
    IO Int32

-- | Fetches the variation-axis information corresponding to the specified axis tag
-- in the specified face.
-- 
-- /Since: 2.2.0/
otVarFindAxisInfo ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@axisTag@/: The @/hb_tag_t/@ of the variation axis to query
    -> m ((Int32, HarfBuzz.OtVarAxisInfoT.OtVarAxisInfoT))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
otVarFindAxisInfo face axisTag = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    axisInfo <- SP.callocBoxedBytes 32 :: IO (Ptr HarfBuzz.OtVarAxisInfoT.OtVarAxisInfoT)
    result <- hb_ot_var_find_axis_info face' axisTag axisInfo
    axisInfo' <- (wrapBoxed HarfBuzz.OtVarAxisInfoT.OtVarAxisInfoT) axisInfo
    touchManagedPtr face
    return (result, axisInfo')


-- function ot_var_find_axis
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "axis_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_tag_t of the variation axis to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "axis_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the variation axis"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "axis_info"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "ot_var_axis_t" }
--           , argCType = Just "hb_ot_var_axis_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The #hb_ot_var_axis_info_t of the axis tag queried"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_var_find_axis" hb_ot_var_find_axis :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- axis_tag : TBasicType TUInt32
    Word32 ->                               -- axis_index : TBasicType TUInt
    Ptr HarfBuzz.OtVarAxisT.OtVarAxisT ->   -- axis_info : TInterface (Name {namespace = "HarfBuzz", name = "ot_var_axis_t"})
    IO Int32

{-# DEPRECATED otVarFindAxis ["(Since version 2.2.0)","use 'GI.HarfBuzz.Functions.otVarFindAxisInfo' instead"] #-}
-- | Fetches the variation-axis information corresponding to the specified axis tag
-- in the specified face.
-- 
-- /Since: 1.4.2/
otVarFindAxis ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@axisTag@/: The @/hb_tag_t/@ of the variation axis to query
    -> Word32
    -- ^ /@axisIndex@/: The index of the variation axis
    -> m ((Int32, HarfBuzz.OtVarAxisT.OtVarAxisT))
otVarFindAxis face axisTag axisIndex = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    axisInfo <- SP.callocBytes 20 :: IO (Ptr HarfBuzz.OtVarAxisT.OtVarAxisT)
    result <- hb_ot_var_find_axis face' axisTag axisIndex axisInfo
    axisInfo' <- (wrapPtr HarfBuzz.OtVarAxisT.OtVarAxisT) axisInfo
    touchManagedPtr face
    return (result, axisInfo')


-- function ot_tags_to_script_and_language
-- XXX Could not generate function ot_tags_to_script_and_language

-- Not implemented: Don't know how to allocate "language" of type TInterface (Name {namespace = "HarfBuzz", name = "language_t"})

-- function ot_tags_from_script_and_language
-- Args: [ Arg
--           { argCName = "script"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "script_t" }
--           , argCType = Just "hb_script_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_script_t to convert."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "language_t" }
--           , argCType = Just "hb_language_t"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_language_t to convert."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "maximum number of script tags to retrieve (IN)\nand actual number of script tags retrieved (OUT)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "script_tags"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "array of size at least @script_count to store the\nscript tag results"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "language_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "maximum number of language tags to retrieve\n(IN) and actual number of language tags retrieved (OUT)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "language_tags"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "array of size at least @language_count to store\nthe language tag results"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_tags_from_script_and_language" hb_ot_tags_from_script_and_language :: 
    CUInt ->                                -- script : TInterface (Name {namespace = "HarfBuzz", name = "script_t"})
    Ptr HarfBuzz.LanguageT.LanguageT ->     -- language : TInterface (Name {namespace = "HarfBuzz", name = "language_t"})
    Ptr Word32 ->                           -- script_count : TBasicType TUInt
    Ptr Word32 ->                           -- script_tags : TBasicType TUInt32
    Ptr Word32 ->                           -- language_count : TBasicType TUInt
    Ptr Word32 ->                           -- language_tags : TBasicType TUInt32
    IO ()

-- | Converts an t'GI.HarfBuzz.Enums.ScriptT' and an t'GI.HarfBuzz.Structs.LanguageT.LanguageT' to script and language tags.
-- 
-- /Since: 2.0.0/
otTagsFromScriptAndLanguage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.Enums.ScriptT
    -- ^ /@script@/: an t'GI.HarfBuzz.Enums.ScriptT' to convert.
    -> Maybe (HarfBuzz.LanguageT.LanguageT)
    -- ^ /@language@/: an t'GI.HarfBuzz.Structs.LanguageT.LanguageT' to convert.
    -> Word32
    -- ^ /@scriptCount@/: maximum number of script tags to retrieve (IN)
    -- and actual number of script tags retrieved (OUT)
    -> Word32
    -- ^ /@languageCount@/: maximum number of language tags to retrieve
    -- (IN) and actual number of language tags retrieved (OUT)
    -> m ((Word32, Word32, Word32, Word32))
otTagsFromScriptAndLanguage script language scriptCount languageCount = liftIO $ do
    let script' = (fromIntegral . fromEnum) script
    maybeLanguage <- case language of
        Nothing -> return FP.nullPtr
        Just jLanguage -> do
            jLanguage' <- unsafeManagedPtrGetPtr jLanguage
            return jLanguage'
    scriptCount' <- allocMem :: IO (Ptr Word32)
    poke scriptCount' scriptCount
    scriptTags <- allocMem :: IO (Ptr Word32)
    languageCount' <- allocMem :: IO (Ptr Word32)
    poke languageCount' languageCount
    languageTags <- allocMem :: IO (Ptr Word32)
    hb_ot_tags_from_script_and_language script' maybeLanguage scriptCount' scriptTags languageCount' languageTags
    scriptCount'' <- peek scriptCount'
    scriptTags' <- peek scriptTags
    languageCount'' <- peek languageCount'
    languageTags' <- peek languageTags
    whenJust language touchManagedPtr
    freeMem scriptCount'
    freeMem scriptTags
    freeMem languageCount'
    freeMem languageTags
    return (scriptCount'', scriptTags', languageCount'', languageTags')


-- function ot_tags_from_script
-- Args: [ Arg
--           { argCName = "script"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "script_t" }
--           , argCType = Just "hb_script_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_script_t to convert."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_tag_1"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "output #hb_tag_t." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "script_tag_2"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "output #hb_tag_t." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_tags_from_script" hb_ot_tags_from_script :: 
    CUInt ->                                -- script : TInterface (Name {namespace = "HarfBuzz", name = "script_t"})
    Ptr Word32 ->                           -- script_tag_1 : TBasicType TUInt32
    Ptr Word32 ->                           -- script_tag_2 : TBasicType TUInt32
    IO ()

{-# DEPRECATED otTagsFromScript ["(Since version 2.0.0)","use 'GI.HarfBuzz.Functions.otTagsFromScriptAndLanguage' instead"] #-}
-- | Converts an t'GI.HarfBuzz.Enums.ScriptT' to script tags.
-- 
-- /Since: 0.6.0/
otTagsFromScript ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.Enums.ScriptT
    -- ^ /@script@/: an t'GI.HarfBuzz.Enums.ScriptT' to convert.
    -> m ((Word32, Word32))
otTagsFromScript script = liftIO $ do
    let script' = (fromIntegral . fromEnum) script
    scriptTag1 <- allocMem :: IO (Ptr Word32)
    scriptTag2 <- allocMem :: IO (Ptr Word32)
    hb_ot_tags_from_script script' scriptTag1 scriptTag2
    scriptTag1' <- peek scriptTag1
    scriptTag2' <- peek scriptTag2
    freeMem scriptTag1
    freeMem scriptTag2
    return (scriptTag1', scriptTag2')


-- function ot_tag_to_script
-- Args: [ Arg
--           { argCName = "tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a script tag" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "script_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_tag_to_script" hb_ot_tag_to_script :: 
    Word32 ->                               -- tag : TBasicType TUInt32
    IO CUInt

-- | Converts a script tag to an t'GI.HarfBuzz.Enums.ScriptT'.
otTagToScript ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@tag@/: a script tag
    -> m HarfBuzz.Enums.ScriptT
    -- ^ __Returns:__ The t'GI.HarfBuzz.Enums.ScriptT' corresponding to /@tag@/.
otTagToScript tag = liftIO $ do
    result <- hb_ot_tag_to_script tag
    let result' = (toEnum . fromIntegral) result
    return result'


-- function ot_tag_to_language
-- Args: [ Arg
--           { argCName = "tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an language tag" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "language_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_tag_to_language" hb_ot_tag_to_language :: 
    Word32 ->                               -- tag : TBasicType TUInt32
    IO (Ptr HarfBuzz.LanguageT.LanguageT)

-- | Converts a language tag to an t'GI.HarfBuzz.Structs.LanguageT.LanguageT'.
-- 
-- /Since: 0.9.2/
otTagToLanguage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@tag@/: an language tag
    -> m (Maybe HarfBuzz.LanguageT.LanguageT)
    -- ^ __Returns:__ 
    -- The t'GI.HarfBuzz.Structs.LanguageT.LanguageT' corresponding to /@tag@/.
otTagToLanguage tag = liftIO $ do
    result <- hb_ot_tag_to_language tag
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newPtr HarfBuzz.LanguageT.LanguageT) result'
        return result''
    return maybeResult


-- function ot_tag_from_language
-- Args: [ Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "language_t" }
--           , argCType = Just "hb_language_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_language_t to convert."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_tag_from_language" hb_ot_tag_from_language :: 
    Ptr HarfBuzz.LanguageT.LanguageT ->     -- language : TInterface (Name {namespace = "HarfBuzz", name = "language_t"})
    IO Word32

{-# DEPRECATED otTagFromLanguage ["(Since version 2.0.0)","use 'GI.HarfBuzz.Functions.otTagsFromScriptAndLanguage' instead"] #-}
-- | Converts an t'GI.HarfBuzz.Structs.LanguageT.LanguageT' to an @/hb_tag_t/@.
-- 
-- /Since: 0.6.0/
otTagFromLanguage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.LanguageT.LanguageT
    -- ^ /@language@/: an t'GI.HarfBuzz.Structs.LanguageT.LanguageT' to convert.
    -> m Word32
otTagFromLanguage language = liftIO $ do
    language' <- unsafeManagedPtrGetPtr language
    result <- hb_ot_tag_from_language language'
    touchManagedPtr language
    return result


-- function ot_shape_plan_get_feature_tags
-- Args: [ Arg
--           { argCName = "shape_plan"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "shape_plan_t" }
--           , argCType = Just "hb_shape_plan_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A shaping plan" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of first feature to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "tag_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of features to return;\n                     Output = the actual number of features returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "tags"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt32)
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The array of enabled feature"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "tag_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of features to return;\n                     Output = the actual number of features returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_shape_plan_get_feature_tags" hb_ot_shape_plan_get_feature_tags :: 
    Ptr HarfBuzz.ShapePlanT.ShapePlanT ->   -- shape_plan : TInterface (Name {namespace = "HarfBuzz", name = "shape_plan_t"})
    Word32 ->                               -- start_offset : TBasicType TUInt
    Ptr Word32 ->                           -- tag_count : TBasicType TUInt
    Ptr (Ptr Word32) ->                     -- tags : TCArray False (-1) 2 (TBasicType TUInt32)
    IO Word32

-- | Fetches the list of OpenType feature tags enabled for a shaping plan, if possible.
-- 
-- /Since: 10.3.0/
otShapePlanGetFeatureTags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.ShapePlanT.ShapePlanT
    -- ^ /@shapePlan@/: A shaping plan
    -> Word32
    -- ^ /@startOffset@/: The index of first feature to retrieve
    -> m ((Word32, [Word32]))
    -- ^ __Returns:__ Total number of feature tagss.
otShapePlanGetFeatureTags shapePlan startOffset = liftIO $ do
    shapePlan' <- unsafeManagedPtrGetPtr shapePlan
    tagCount <- allocMem :: IO (Ptr Word32)
    tags <- callocMem :: IO (Ptr (Ptr Word32))
    result <- hb_ot_shape_plan_get_feature_tags shapePlan' startOffset tagCount tags
    tagCount' <- peek tagCount
    tags' <- peek tags
    tags'' <- (unpackStorableArrayWithLength tagCount') tags'
    freeMem tags'
    touchManagedPtr shapePlan
    freeMem tagCount
    freeMem tags
    return (result, tags'')


-- function ot_shape_plan_collect_lookups
-- XXX Could not generate function ot_shape_plan_collect_lookups

-- Not implemented: Don't know how to allocate "lookup_indexes" of type TInterface (Name {namespace = "HarfBuzz", name = "set_t"})

-- function ot_shape_glyphs_closure
-- XXX Could not generate function ot_shape_glyphs_closure

-- Not implemented: Don't know how to allocate "glyphs" of type TInterface (Name {namespace = "HarfBuzz", name = "set_t"})

-- function ot_shape_get_buffer_format_serial
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_shape_get_buffer_format_serial" hb_ot_shape_get_buffer_format_serial :: 
    IO Word32

-- | Returns the serial number of the current internal buffer format.
-- See 'GI.HarfBuzz.Constants.OT_SHAPE_BUFFER_FORMAT_SERIAL' for more information.
-- 
-- /Since: 13.2.0/
otShapeGetBufferFormatSerial ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
    -- ^ __Returns:__ The current buffer-format serial number.
otShapeGetBufferFormatSerial  = liftIO $ do
    result <- hb_ot_shape_get_buffer_format_serial
    return result


-- function ot_name_list_names
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "font face." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_entries"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of returned entries."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "num_entries"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "number of returned entries."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just
--               (TCArray
--                  False
--                  (-1)
--                  1
--                  (TInterface
--                     Name { namespace = "HarfBuzz" , name = "ot_name_entry_t" }))
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_name_list_names" hb_ot_name_list_names :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Ptr Word32 ->                           -- num_entries : TBasicType TUInt
    IO (Ptr HarfBuzz.OtNameEntryT.OtNameEntryT)

-- | Enumerates all available name IDs and language combinations. Returned
-- array is owned by the /@face@/ and should not be modified.  It can be
-- used as long as /@face@/ is alive.
-- 
-- /Since: 2.1.0/
otNameListNames ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: font face.
    -> m [HarfBuzz.OtNameEntryT.OtNameEntryT]
    -- ^ __Returns:__ Array of available name entries.
otNameListNames face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    numEntries <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_name_list_names face' numEntries
    numEntries' <- peek numEntries
    checkUnexpectedReturnNULL "otNameListNames" result
    result' <- (unpackBlockArrayWithLength 16 numEntries') result
    result'' <- mapM (newPtr HarfBuzz.OtNameEntryT.OtNameEntryT) result'
    touchManagedPtr face
    freeMem numEntries
    return result''


-- function ot_name_get_utf8
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "font face." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name_id"
--           , argType = TBasicType TUInt
--           , argCType = Just "hb_ot_name_id_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "OpenType name identifier to fetch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "language_t" }
--           , argCType = Just "hb_language_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "language to fetch the name for."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text_size"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "input size of @text buffer, and output size of\n                                  text written to buffer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "text"
--           , argType = TCArray False (-1) 3 (TBasicType TUTF8)
--           , argCType = Just "char*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "buffer to write fetched name into."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "text_size"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "input size of @text buffer, and output size of\n                                  text written to buffer."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_name_get_utf8" hb_ot_name_get_utf8 :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- name_id : TBasicType TUInt
    Ptr HarfBuzz.LanguageT.LanguageT ->     -- language : TInterface (Name {namespace = "HarfBuzz", name = "language_t"})
    Word32 ->                               -- text_size : TBasicType TUInt
    Ptr CString ->                          -- text : TCArray False (-1) 3 (TBasicType TUTF8)
    IO Word32

-- | Fetches a font name from the OpenType \'name\' table.
-- If /@language@/ is 'GI.HarfBuzz.Constants.LANGUAGE_INVALID', English (\"en\") is assumed.
-- Returns string in UTF-8 encoding. A NUL terminator is always written
-- for convenience, and isn\'t included in the output /@textSize@/.
-- 
-- /Since: 2.1.0/
otNameGetUtf8 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: font face.
    -> Word32
    -- ^ /@nameId@/: OpenType name identifier to fetch.
    -> HarfBuzz.LanguageT.LanguageT
    -- ^ /@language@/: language to fetch the name for.
    -> [T.Text]
    -- ^ /@text@/: buffer to write fetched name into.
    -> m ((Word32, [T.Text]))
    -- ^ __Returns:__ full length of the requested string, or 0 if not found.
otNameGetUtf8 face nameId language text = liftIO $ do
    let textSize = fromIntegral $ P.length text
    face' <- unsafeManagedPtrGetPtr face
    language' <- unsafeManagedPtrGetPtr language
    text' <- packUTF8CArray text
    result <- hb_ot_name_get_utf8 face' nameId language' textSize text'
    text'' <- (unpackUTF8CArrayWithLength textSize) text'
    (mapCArrayWithLength textSize) freeMem text'
    freeMem text'
    touchManagedPtr face
    touchManagedPtr language
    return (result, text'')


-- function ot_name_get_utf32
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "font face." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name_id"
--           , argType = TBasicType TUInt
--           , argCType = Just "hb_ot_name_id_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "OpenType name identifier to fetch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "language_t" }
--           , argCType = Just "hb_language_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "language to fetch the name for."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text_size"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "input size of @text buffer, and output size of\n                                  text written to buffer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "text"
--           , argType = TCArray False (-1) 3 (TBasicType TUInt32)
--           , argCType = Just "uint32_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "buffer to write fetched name into."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "text_size"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "input size of @text buffer, and output size of\n                                  text written to buffer."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_name_get_utf32" hb_ot_name_get_utf32 :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- name_id : TBasicType TUInt
    Ptr HarfBuzz.LanguageT.LanguageT ->     -- language : TInterface (Name {namespace = "HarfBuzz", name = "language_t"})
    Word32 ->                               -- text_size : TBasicType TUInt
    Ptr Word32 ->                           -- text : TCArray False (-1) 3 (TBasicType TUInt32)
    IO Word32

-- | Fetches a font name from the OpenType \'name\' table.
-- If /@language@/ is 'GI.HarfBuzz.Constants.LANGUAGE_INVALID', English (\"en\") is assumed.
-- Returns string in UTF-32 encoding. A NUL terminator is always written
-- for convenience, and isn\'t included in the output /@textSize@/.
-- 
-- /Since: 2.1.0/
otNameGetUtf32 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: font face.
    -> Word32
    -- ^ /@nameId@/: OpenType name identifier to fetch.
    -> HarfBuzz.LanguageT.LanguageT
    -- ^ /@language@/: language to fetch the name for.
    -> [Word32]
    -- ^ /@text@/: buffer to write fetched name into.
    -> m ((Word32, [Word32]))
    -- ^ __Returns:__ full length of the requested string, or 0 if not found.
otNameGetUtf32 face nameId language text = liftIO $ do
    let textSize = fromIntegral $ P.length text
    face' <- unsafeManagedPtrGetPtr face
    language' <- unsafeManagedPtrGetPtr language
    text' <- packStorableArray text
    result <- hb_ot_name_get_utf32 face' nameId language' textSize text'
    text'' <- (unpackStorableArrayWithLength textSize) text'
    freeMem text'
    touchManagedPtr face
    touchManagedPtr language
    return (result, text'')


-- function ot_name_get_utf16
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "font face." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name_id"
--           , argType = TBasicType TUInt
--           , argCType = Just "hb_ot_name_id_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "OpenType name identifier to fetch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "language_t" }
--           , argCType = Just "hb_language_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "language to fetch the name for."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text_size"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "input size of @text buffer, and output size of\n                                  text written to buffer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "text"
--           , argType = TCArray False (-1) 3 (TBasicType TUInt16)
--           , argCType = Just "uint16_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "buffer to write fetched name into."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "text_size"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "input size of @text buffer, and output size of\n                                  text written to buffer."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_name_get_utf16" hb_ot_name_get_utf16 :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- name_id : TBasicType TUInt
    Ptr HarfBuzz.LanguageT.LanguageT ->     -- language : TInterface (Name {namespace = "HarfBuzz", name = "language_t"})
    Word32 ->                               -- text_size : TBasicType TUInt
    Ptr Word16 ->                           -- text : TCArray False (-1) 3 (TBasicType TUInt16)
    IO Word32

-- | Fetches a font name from the OpenType \'name\' table.
-- If /@language@/ is 'GI.HarfBuzz.Constants.LANGUAGE_INVALID', English (\"en\") is assumed.
-- Returns string in UTF-16 encoding. A NUL terminator is always written
-- for convenience, and isn\'t included in the output /@textSize@/.
-- 
-- /Since: 2.1.0/
otNameGetUtf16 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: font face.
    -> Word32
    -- ^ /@nameId@/: OpenType name identifier to fetch.
    -> HarfBuzz.LanguageT.LanguageT
    -- ^ /@language@/: language to fetch the name for.
    -> [Word16]
    -- ^ /@text@/: buffer to write fetched name into.
    -> m ((Word32, [Word16]))
    -- ^ __Returns:__ full length of the requested string, or 0 if not found.
otNameGetUtf16 face nameId language text = liftIO $ do
    let textSize = fromIntegral $ P.length text
    face' <- unsafeManagedPtrGetPtr face
    language' <- unsafeManagedPtrGetPtr language
    text' <- packStorableArray text
    result <- hb_ot_name_get_utf16 face' nameId language' textSize text'
    text'' <- (unpackStorableArrayWithLength textSize) text'
    freeMem text'
    touchManagedPtr face
    touchManagedPtr language
    return (result, text'')


-- function ot_metrics_get_y_variation
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_font_t object."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "metrics_tag"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_metrics_tag_t" }
--           , argCType = Just "hb_ot_metrics_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "tag of metrics value you like to fetch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_metrics_get_y_variation" hb_ot_metrics_get_y_variation :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- metrics_tag : TInterface (Name {namespace = "HarfBuzz", name = "ot_metrics_tag_t"})
    IO Int32

-- | Fetches vertical metrics value corresponding to /@metricsTag@/ from /@font@/ with
-- the current font variation settings applied.
-- 
-- /Since: 2.6.0/
otMetricsGetYVariation ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: an t'GI.HarfBuzz.Structs.FontT.FontT' object.
    -> HarfBuzz.Enums.OtMetricsTagT
    -- ^ /@metricsTag@/: tag of metrics value you like to fetch.
    -> m Int32
    -- ^ __Returns:__ The requested metric value.
otMetricsGetYVariation font metricsTag = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let metricsTag' = (fromIntegral . fromEnum) metricsTag
    result <- hb_ot_metrics_get_y_variation font' metricsTag'
    touchManagedPtr font
    return result


-- function ot_metrics_get_x_variation
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_font_t object."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "metrics_tag"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_metrics_tag_t" }
--           , argCType = Just "hb_ot_metrics_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "tag of metrics value you like to fetch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_metrics_get_x_variation" hb_ot_metrics_get_x_variation :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- metrics_tag : TInterface (Name {namespace = "HarfBuzz", name = "ot_metrics_tag_t"})
    IO Int32

-- | Fetches horizontal metrics value corresponding to /@metricsTag@/ from /@font@/
-- with the current font variation settings applied.
-- 
-- /Since: 2.6.0/
otMetricsGetXVariation ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: an t'GI.HarfBuzz.Structs.FontT.FontT' object.
    -> HarfBuzz.Enums.OtMetricsTagT
    -- ^ /@metricsTag@/: tag of metrics value you like to fetch.
    -> m Int32
    -- ^ __Returns:__ The requested metric value.
otMetricsGetXVariation font metricsTag = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let metricsTag' = (fromIntegral . fromEnum) metricsTag
    result <- hb_ot_metrics_get_x_variation font' metricsTag'
    touchManagedPtr font
    return result


-- function ot_metrics_get_variation
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_font_t object."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "metrics_tag"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_metrics_tag_t" }
--           , argCType = Just "hb_ot_metrics_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "tag of metrics value you like to fetch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_metrics_get_variation" hb_ot_metrics_get_variation :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- metrics_tag : TInterface (Name {namespace = "HarfBuzz", name = "ot_metrics_tag_t"})
    IO CFloat

-- | Fetches metrics value corresponding to /@metricsTag@/ from /@font@/ with the
-- current font variation settings applied.
-- 
-- /Since: 2.6.0/
otMetricsGetVariation ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: an t'GI.HarfBuzz.Structs.FontT.FontT' object.
    -> HarfBuzz.Enums.OtMetricsTagT
    -- ^ /@metricsTag@/: tag of metrics value you like to fetch.
    -> m Float
    -- ^ __Returns:__ The requested metric value.
otMetricsGetVariation font metricsTag = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let metricsTag' = (fromIntegral . fromEnum) metricsTag
    result <- hb_ot_metrics_get_variation font' metricsTag'
    let result' = realToFrac result
    touchManagedPtr font
    return result'


-- function ot_metrics_get_position_with_fallback
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_font_t object."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "metrics_tag"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_metrics_tag_t" }
--           , argCType = Just "hb_ot_metrics_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "tag of metrics value you like to fetch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "position"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "result of metrics value from the font."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_metrics_get_position_with_fallback" hb_ot_metrics_get_position_with_fallback :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- metrics_tag : TInterface (Name {namespace = "HarfBuzz", name = "ot_metrics_tag_t"})
    Ptr Int32 ->                            -- position : TBasicType TInt32
    IO ()

-- | Fetches metrics value corresponding to /@metricsTag@/ from /@font@/,
-- and synthesizes a value if it the value is missing in the font.
-- 
-- /Since: 4.0.0/
otMetricsGetPositionWithFallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: an t'GI.HarfBuzz.Structs.FontT.FontT' object.
    -> HarfBuzz.Enums.OtMetricsTagT
    -- ^ /@metricsTag@/: tag of metrics value you like to fetch.
    -> m (Int32)
otMetricsGetPositionWithFallback font metricsTag = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let metricsTag' = (fromIntegral . fromEnum) metricsTag
    position <- allocMem :: IO (Ptr Int32)
    hb_ot_metrics_get_position_with_fallback font' metricsTag' position
    position' <- peek position
    touchManagedPtr font
    freeMem position
    return position'


-- function ot_metrics_get_position
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_font_t object."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "metrics_tag"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_metrics_tag_t" }
--           , argCType = Just "hb_ot_metrics_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "tag of metrics value you like to fetch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "position"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "result of metrics value from the font."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_metrics_get_position" hb_ot_metrics_get_position :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- metrics_tag : TInterface (Name {namespace = "HarfBuzz", name = "ot_metrics_tag_t"})
    Ptr Int32 ->                            -- position : TBasicType TInt32
    IO Int32

-- | Fetches metrics value corresponding to /@metricsTag@/ from /@font@/.
-- 
-- /Since: 2.6.0/
otMetricsGetPosition ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: an t'GI.HarfBuzz.Structs.FontT.FontT' object.
    -> HarfBuzz.Enums.OtMetricsTagT
    -- ^ /@metricsTag@/: tag of metrics value you like to fetch.
    -> m ((Int32, Int32))
    -- ^ __Returns:__ Whether found the requested metrics in the font.
otMetricsGetPosition font metricsTag = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let metricsTag' = (fromIntegral . fromEnum) metricsTag
    position <- allocMem :: IO (Ptr Int32)
    result <- hb_ot_metrics_get_position font' metricsTag' position
    position' <- peek position
    touchManagedPtr font
    freeMem position
    return (result, position')


-- function ot_meta_reference_entry
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #hb_face_t object."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "meta_tag"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "ot_meta_tag_t" }
--           , argCType = Just "hb_ot_meta_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "tag of metadata you like to have."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "blob_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_meta_reference_entry" hb_ot_meta_reference_entry :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    CUInt ->                                -- meta_tag : TInterface (Name {namespace = "HarfBuzz", name = "ot_meta_tag_t"})
    IO (Ptr HarfBuzz.BlobT.BlobT)

-- | It fetches metadata entry of a given tag from a font.
-- 
-- /Since: 2.6.0/
otMetaReferenceEntry ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: a t'GI.HarfBuzz.Structs.FaceT.FaceT' object.
    -> HarfBuzz.Enums.OtMetaTagT
    -- ^ /@metaTag@/: tag of metadata you like to have.
    -> m HarfBuzz.BlobT.BlobT
    -- ^ __Returns:__ A blob containing the blob.
otMetaReferenceEntry face metaTag = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    let metaTag' = (fromIntegral . fromEnum) metaTag
    result <- hb_ot_meta_reference_entry face' metaTag'
    checkUnexpectedReturnNULL "otMetaReferenceEntry" result
    result' <- (wrapBoxed HarfBuzz.BlobT.BlobT) result
    touchManagedPtr face
    return result'


-- function ot_meta_get_entry_tags
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a face object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "iteration's start offset"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "entries_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "buffer size as input, filled size as output"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "entries"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 2
--                 (TInterface
--                    Name { namespace = "HarfBuzz" , name = "ot_meta_tag_t" })
--           , argCType = Just "hb_ot_meta_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "entries tags buffer"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "entries_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "buffer size as input, filled size as output"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_meta_get_entry_tags" hb_ot_meta_get_entry_tags :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- start_offset : TBasicType TUInt
    Word32 ->                               -- entries_count : TBasicType TUInt
    Ptr CUInt ->                            -- entries : TCArray False (-1) 2 (TInterface (Name {namespace = "HarfBuzz", name = "ot_meta_tag_t"}))
    IO Word32

-- | Fetches all available feature types.
-- 
-- /Since: 2.6.0/
otMetaGetEntryTags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: a face object
    -> Word32
    -- ^ /@startOffset@/: iteration\'s start offset
    -> Maybe ([HarfBuzz.Enums.OtMetaTagT])
    -- ^ /@entries@/: entries tags buffer
    -> m ((Word32, Maybe [HarfBuzz.Enums.OtMetaTagT]))
    -- ^ __Returns:__ Number of all available feature types.
otMetaGetEntryTags face startOffset entries = liftIO $ do
    let entriesCount = case entries of
            Nothing -> 0
            Just jEntries -> fromIntegral $ P.length jEntries
    face' <- unsafeManagedPtrGetPtr face
    maybeEntries <- case entries of
        Nothing -> return FP.nullPtr
        Just jEntries -> do
            let jEntries' = map (fromIntegral . fromEnum) jEntries
            jEntries'' <- packStorableArray jEntries'
            return jEntries''
    result <- hb_ot_meta_get_entry_tags face' startOffset entriesCount maybeEntries
    maybeMaybeEntries <- convertIfNonNull maybeEntries $ \maybeEntries' -> do
        maybeEntries'' <- (unpackStorableArrayWithLength entriesCount) maybeEntries'
        let maybeEntries''' = map (toEnum . fromIntegral) maybeEntries''
        freeMem maybeEntries'
        return maybeEntries'''
    touchManagedPtr face
    return (result, maybeMaybeEntries)


-- function ot_math_is_glyph_extended_shape
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph index to test"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_math_is_glyph_extended_shape" hb_ot_math_is_glyph_extended_shape :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    IO Int32

-- | Tests whether the given glyph index is an extended shape in the face.
-- 
-- /Since: 1.3.3/
otMathIsGlyphExtendedShape ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph index to test
    -> m Int32
    -- ^ __Returns:__ @true@ if the glyph is an extended shape, @false@ otherwise
otMathIsGlyphExtendedShape face glyph = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_math_is_glyph_extended_shape face' glyph
    touchManagedPtr face
    return result


-- function ot_math_has_data
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to test" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_math_has_data" hb_ot_math_has_data :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests whether a face has a @MATH@ table.
-- 
-- /Since: 1.3.3/
otMathHasData ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to test
    -> m Int32
    -- ^ __Returns:__ @true@ if the table is found, @false@ otherwise
otMathHasData face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_math_has_data face'
    touchManagedPtr face
    return result


-- function ot_math_get_min_connector_overlap
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "direction of the stretching (horizontal or vertical)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_math_get_min_connector_overlap" hb_ot_math_get_min_connector_overlap :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    IO Int32

-- | Fetches the MathVariants table for the specified font and returns the
-- minimum overlap of connecting glyphs that are required to draw a glyph
-- assembly in the specified direction.
-- 
-- \<note>The /@direction@/ parameter is only used to select between horizontal
-- or vertical directions for the construction. Even though all t'GI.HarfBuzz.Enums.DirectionT'
-- values are accepted, only the result of @/HB_DIRECTION_IS_HORIZONTAL/@ is
-- considered.\<\/note>
-- 
-- /Since: 1.3.3/
otMathGetMinConnectorOverlap ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: direction of the stretching (horizontal or vertical)
    -> m Int32
    -- ^ __Returns:__ requested minimum connector overlap or zero
otMathGetMinConnectorOverlap font direction = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    result <- hb_ot_math_get_min_connector_overlap font' direction'
    touchManagedPtr font
    return result


-- function ot_math_get_glyph_variants
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the glyph to stretch"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The direction of the stretching (horizontal or vertical)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first variant to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "variants_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of variants to return;\n                          Output = the actual number of variants returned"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "variants"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 4
--                 (TInterface
--                    Name { namespace = "HarfBuzz" , name = "ot_math_glyph_variant_t" })
--           , argCType = Just "hb_ot_math_glyph_variant_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "array of variants returned"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "variants_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of variants to return;\n                          Output = the actual number of variants returned"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_math_get_glyph_variants" hb_ot_math_get_glyph_variants :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Word32 ->                               -- start_offset : TBasicType TUInt
    Word32 ->                               -- variants_count : TBasicType TUInt
    Ptr HarfBuzz.OtMathGlyphVariantT.OtMathGlyphVariantT -> -- variants : TCArray False (-1) 4 (TInterface (Name {namespace = "HarfBuzz", name = "ot_math_glyph_variant_t"}))
    IO Word32

-- | Fetches the MathGlyphConstruction for the specified font, glyph index, and
-- direction. The corresponding list of size variants is returned as a list of
-- t'GI.HarfBuzz.Structs.OtMathGlyphVariantT.OtMathGlyphVariantT' structs.
-- 
-- \<note>The /@direction@/ parameter is only used to select between horizontal
-- or vertical directions for the construction. Even though all t'GI.HarfBuzz.Enums.DirectionT'
-- values are accepted, only the result of @/HB_DIRECTION_IS_HORIZONTAL/@ is
-- considered.\<\/note>
-- 
-- /Since: 1.3.3/
otMathGetGlyphVariants ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The index of the glyph to stretch
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: The direction of the stretching (horizontal or vertical)
    -> Word32
    -- ^ /@startOffset@/: offset of the first variant to retrieve
    -> Maybe ([HarfBuzz.OtMathGlyphVariantT.OtMathGlyphVariantT])
    -- ^ /@variants@/: array of variants returned
    -> m ((Word32, Maybe [HarfBuzz.OtMathGlyphVariantT.OtMathGlyphVariantT]))
    -- ^ __Returns:__ the total number of size variants available or zero
otMathGetGlyphVariants font glyph direction startOffset variants = liftIO $ do
    let variantsCount = case variants of
            Nothing -> 0
            Just jVariants -> fromIntegral $ P.length jVariants
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    maybeVariants <- case variants of
        Nothing -> return FP.nullPtr
        Just jVariants -> do
            jVariants' <- mapM B.ManagedPtr.disownBoxed jVariants
            jVariants'' <- packBlockArray 8 jVariants'
            return jVariants''
    result <- hb_ot_math_get_glyph_variants font' glyph direction' startOffset variantsCount maybeVariants
    maybeMaybeVariants <- convertIfNonNull maybeVariants $ \maybeVariants' -> do
        maybeVariants'' <- (unpackBoxedArrayWithLength 8 variantsCount) maybeVariants'
        maybeVariants''' <- mapM (wrapBoxed HarfBuzz.OtMathGlyphVariantT.OtMathGlyphVariantT) maybeVariants''
        freeMem maybeVariants'
        return maybeVariants'''
    touchManagedPtr font
    whenJust variants (mapM_ touchManagedPtr)
    return (result, maybeMaybeVariants)


-- function ot_math_get_glyph_top_accent_attachment
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The glyph index from which to retrieve the value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_math_get_glyph_top_accent_attachment" hb_ot_math_get_glyph_top_accent_attachment :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    IO Int32

-- | Fetches a top-accent-attachment value (if one exists) for the specified
-- glyph index.
-- 
-- For any glyph that does not have a top-accent-attachment value - that is,
-- a glyph not covered by the @MathTopAccentAttachment@ table (or, when
-- /@font@/ has no @MathTopAccentAttachment@ table or no @MATH@ table, any
-- glyph) - the function synthesizes a value, returning the position at
-- one-half the glyph\'s advance width.
-- 
-- /Since: 1.3.3/
otMathGetGlyphTopAccentAttachment ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph index from which to retrieve the value
    -> m Int32
    -- ^ __Returns:__ the top accent attachment of the glyph or 0.5 * the advance
    --               width of /@glyph@/
otMathGetGlyphTopAccentAttachment font glyph = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_ot_math_get_glyph_top_accent_attachment font' glyph
    touchManagedPtr font
    return result


-- function ot_math_get_glyph_kernings
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The glyph index from which to retrieve the kernings"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "kern"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_math_kern_t" }
--           , argCType = Just "hb_ot_math_kern_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The #hb_ot_math_kern_t from which to retrieve the kernings"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first kern entry to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "entries_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of kern entries to return;\n                                    Output = the actual number of kern entries returned"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "kern_entries"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 4
--                 (TInterface
--                    Name { namespace = "HarfBuzz" , name = "ot_math_kern_entry_t" })
--           , argCType = Just "hb_ot_math_kern_entry_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "array of kern entries returned"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "entries_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of kern entries to return;\n                                    Output = the actual number of kern entries returned"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_math_get_glyph_kernings" hb_ot_math_get_glyph_kernings :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    CUInt ->                                -- kern : TInterface (Name {namespace = "HarfBuzz", name = "ot_math_kern_t"})
    Word32 ->                               -- start_offset : TBasicType TUInt
    Word32 ->                               -- entries_count : TBasicType TUInt
    Ptr HarfBuzz.OtMathKernEntryT.OtMathKernEntryT -> -- kern_entries : TCArray False (-1) 4 (TInterface (Name {namespace = "HarfBuzz", name = "ot_math_kern_entry_t"}))
    IO Word32

-- | Fetches the raw MathKern (cut-in) data for the specified font, glyph index,
-- and /@kern@/. The corresponding list of kern values and correction heights is
-- returned as a list of t'GI.HarfBuzz.Structs.OtMathKernEntryT.OtMathKernEntryT' structs.
-- 
-- See also @/hb_ot_math_get_glyph_kerning/@, which handles selecting the
-- appropriate kern value for a given correction height.
-- 
-- \<note>For a glyph with /@n@/ defined kern values (where /@n@/ > 0), there are only
-- /@n@/−1 defined correction heights, as each correction height defines a boundary
-- past which the next kern value should be selected. Therefore, only the
-- t'GI.HarfBuzz.Structs.OtMathKernEntryT.OtMathKernEntryT'.@/kern_value/@ of the uppermost t'GI.HarfBuzz.Structs.OtMathKernEntryT.OtMathKernEntryT'
-- actually comes from the font; its corresponding
-- t'GI.HarfBuzz.Structs.OtMathKernEntryT.OtMathKernEntryT'.@/max_correction_height/@ is always set to
-- \<code>INT32_MAX\<\/code>.\<\/note>
-- 
-- /Since: 3.4.0/
otMathGetGlyphKernings ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph index from which to retrieve the kernings
    -> HarfBuzz.Enums.OtMathKernT
    -- ^ /@kern@/: The t'GI.HarfBuzz.Enums.OtMathKernT' from which to retrieve the kernings
    -> Word32
    -- ^ /@startOffset@/: offset of the first kern entry to retrieve
    -> Maybe ([HarfBuzz.OtMathKernEntryT.OtMathKernEntryT])
    -- ^ /@kernEntries@/: array of kern entries returned
    -> m ((Word32, Maybe [HarfBuzz.OtMathKernEntryT.OtMathKernEntryT]))
    -- ^ __Returns:__ the total number of kern values available or zero
otMathGetGlyphKernings font glyph kern startOffset kernEntries = liftIO $ do
    let entriesCount = case kernEntries of
            Nothing -> 0
            Just jKernEntries -> fromIntegral $ P.length jKernEntries
    font' <- unsafeManagedPtrGetPtr font
    let kern' = (fromIntegral . fromEnum) kern
    maybeKernEntries <- case kernEntries of
        Nothing -> return FP.nullPtr
        Just jKernEntries -> do
            jKernEntries' <- mapM unsafeManagedPtrGetPtr jKernEntries
            jKernEntries'' <- packBlockArray 8 jKernEntries'
            return jKernEntries''
    result <- hb_ot_math_get_glyph_kernings font' glyph kern' startOffset entriesCount maybeKernEntries
    maybeMaybeKernEntries <- convertIfNonNull maybeKernEntries $ \maybeKernEntries' -> do
        maybeKernEntries'' <- (unpackBlockArrayWithLength 8 entriesCount) maybeKernEntries'
        maybeKernEntries''' <- mapM (wrapPtr HarfBuzz.OtMathKernEntryT.OtMathKernEntryT) maybeKernEntries''
        freeMem maybeKernEntries'
        return maybeKernEntries'''
    touchManagedPtr font
    whenJust kernEntries (mapM_ touchManagedPtr)
    return (result, maybeMaybeKernEntries)


-- function ot_math_get_glyph_kerning
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The glyph index from which to retrieve the value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "kern"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_math_kern_t" }
--           , argCType = Just "hb_ot_math_kern_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The #hb_ot_math_kern_t from which to retrieve the value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "correction_height"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the correction height to use to determine the kerning."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_math_get_glyph_kerning" hb_ot_math_get_glyph_kerning :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    CUInt ->                                -- kern : TInterface (Name {namespace = "HarfBuzz", name = "ot_math_kern_t"})
    Int32 ->                                -- correction_height : TBasicType TInt32
    IO Int32

-- | Fetches the math kerning (cut-ins) value for the specified font, glyph index, and
-- /@kern@/.
-- 
-- If the MathKern table is found, the function examines it to find a height
-- value that is greater or equal to /@correctionHeight@/. If such a height
-- value is found, corresponding kerning value from the table is returned. If
-- no such height value is found, the last kerning value is returned.
-- 
-- /Since: 1.3.3/
otMathGetGlyphKerning ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph index from which to retrieve the value
    -> HarfBuzz.Enums.OtMathKernT
    -- ^ /@kern@/: The t'GI.HarfBuzz.Enums.OtMathKernT' from which to retrieve the value
    -> Int32
    -- ^ /@correctionHeight@/: the correction height to use to determine the kerning.
    -> m Int32
    -- ^ __Returns:__ requested kerning value or zero
otMathGetGlyphKerning font glyph kern correctionHeight = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let kern' = (fromIntegral . fromEnum) kern
    result <- hb_ot_math_get_glyph_kerning font' glyph kern' correctionHeight
    touchManagedPtr font
    return result


-- function ot_math_get_glyph_italics_correction
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The glyph index from which to retrieve the value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_math_get_glyph_italics_correction" hb_ot_math_get_glyph_italics_correction :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    IO Int32

-- | Fetches an italics-correction value (if one exists) for the specified
-- glyph index.
-- 
-- /Since: 1.3.3/
otMathGetGlyphItalicsCorrection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph index from which to retrieve the value
    -> m Int32
    -- ^ __Returns:__ the italics correction of the glyph or zero
otMathGetGlyphItalicsCorrection font glyph = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_ot_math_get_glyph_italics_correction font' glyph
    touchManagedPtr font
    return result


-- function ot_math_get_glyph_assembly
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the glyph to stretch"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "direction of the stretching (horizontal or vertical)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first glyph part to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "parts_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = maximum number of glyph parts to return;\n              Output = actual number of parts returned"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "parts"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 4
--                 (TInterface
--                    Name { namespace = "HarfBuzz" , name = "ot_math_glyph_part_t" })
--           , argCType = Just "hb_ot_math_glyph_part_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the glyph parts returned"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "italics_correction"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "italics correction of the glyph assembly"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "parts_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = maximum number of glyph parts to return;\n              Output = actual number of parts returned"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_math_get_glyph_assembly" hb_ot_math_get_glyph_assembly :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Word32 ->                               -- start_offset : TBasicType TUInt
    Word32 ->                               -- parts_count : TBasicType TUInt
    Ptr HarfBuzz.OtMathGlyphPartT.OtMathGlyphPartT -> -- parts : TCArray False (-1) 4 (TInterface (Name {namespace = "HarfBuzz", name = "ot_math_glyph_part_t"}))
    Ptr Int32 ->                            -- italics_correction : TBasicType TInt32
    IO Word32

-- | Fetches the GlyphAssembly for the specified font, glyph index, and direction.
-- Returned are a list of t'GI.HarfBuzz.Structs.OtMathGlyphPartT.OtMathGlyphPartT' glyph parts that can be
-- used to draw the glyph and an italics-correction value (if one is defined
-- in the font).
-- 
-- \<note>The /@direction@/ parameter is only used to select between horizontal
-- or vertical directions for the construction. Even though all t'GI.HarfBuzz.Enums.DirectionT'
-- values are accepted, only the result of @/HB_DIRECTION_IS_HORIZONTAL/@ is
-- considered.\<\/note>
-- 
-- /Since: 1.3.3/
otMathGetGlyphAssembly ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The index of the glyph to stretch
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: direction of the stretching (horizontal or vertical)
    -> Word32
    -- ^ /@startOffset@/: offset of the first glyph part to retrieve
    -> Maybe ([HarfBuzz.OtMathGlyphPartT.OtMathGlyphPartT])
    -- ^ /@parts@/: the glyph parts returned
    -> m ((Word32, Maybe [HarfBuzz.OtMathGlyphPartT.OtMathGlyphPartT], Int32))
    -- ^ __Returns:__ the total number of parts in the glyph assembly
otMathGetGlyphAssembly font glyph direction startOffset parts = liftIO $ do
    let partsCount = case parts of
            Nothing -> 0
            Just jParts -> fromIntegral $ P.length jParts
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    maybeParts <- case parts of
        Nothing -> return FP.nullPtr
        Just jParts -> do
            jParts' <- mapM B.ManagedPtr.disownBoxed jParts
            jParts'' <- packBlockArray 20 jParts'
            return jParts''
    italicsCorrection <- allocMem :: IO (Ptr Int32)
    result <- hb_ot_math_get_glyph_assembly font' glyph direction' startOffset partsCount maybeParts italicsCorrection
    maybeMaybeParts <- convertIfNonNull maybeParts $ \maybeParts' -> do
        maybeParts'' <- (unpackBoxedArrayWithLength 20 partsCount) maybeParts'
        maybeParts''' <- mapM (wrapBoxed HarfBuzz.OtMathGlyphPartT.OtMathGlyphPartT) maybeParts''
        freeMem maybeParts'
        return maybeParts'''
    italicsCorrection' <- peek italicsCorrection
    touchManagedPtr font
    whenJust parts (mapM_ touchManagedPtr)
    freeMem italicsCorrection
    return (result, maybeMaybeParts, italicsCorrection')


-- function ot_math_get_constant
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "constant"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_math_constant_t" }
--           , argCType = Just "hb_ot_math_constant_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "#hb_ot_math_constant_t the constant to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_math_get_constant" hb_ot_math_get_constant :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- constant : TInterface (Name {namespace = "HarfBuzz", name = "ot_math_constant_t"})
    IO Int32

-- | Fetches the specified math constant. For most constants, the value returned
-- is an @/hb_position_t/@.
-- 
-- However, if the requested constant is @/HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN/@,
-- @/HB_OT_MATH_CONSTANT_SCRIPT_SCRIPT_PERCENT_SCALE_DOWN/@ or
-- @/HB_OT_MATH_CONSTANT_RADICAL_DEGREE_BOTTOM_RAISE_PERCENT/@, then the return value is
-- an integer between 0 and 100 representing that percentage.
-- 
-- /Since: 1.3.3/
otMathGetConstant ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> HarfBuzz.Enums.OtMathConstantT
    -- ^ /@constant@/: t'GI.HarfBuzz.Enums.OtMathConstantT' the constant to retrieve
    -> m Int32
    -- ^ __Returns:__ the requested constant or zero
otMathGetConstant font constant = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let constant' = (fromIntegral . fromEnum) constant
    result <- hb_ot_math_get_constant font' constant'
    touchManagedPtr font
    return result


-- function ot_layout_table_select_script
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Number of script tags in the array"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_tags"
--           , argType = TBasicType TUInt32
--           , argCType = Just "const hb_tag_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Array of #hb_tag_t script tags"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested script"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "chosen_script"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_tag_t of the requested script"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_table_select_script" hb_ot_layout_table_select_script :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- script_count : TBasicType TUInt
    Word32 ->                               -- script_tags : TBasicType TUInt32
    Ptr Word32 ->                           -- script_index : TBasicType TUInt
    Ptr Word32 ->                           -- chosen_script : TBasicType TUInt32
    IO Int32

-- | Selects an OpenType script for /@tableTag@/ from the /@scriptTags@/ array.
-- 
-- If the table does not have any of the requested scripts, then @DFLT@,
-- @dflt@, and @latn@ tags are tried in that order. If the table still does not
-- have any of these scripts, /@scriptIndex@/ is set to
-- 'GI.HarfBuzz.Constants.OT_LAYOUT_NO_SCRIPT_INDEX' and /@chosenScript@/ is set to @/HB_TAG_NONE/@.
-- 
-- /Since: 2.0.0/
otLayoutTableSelectScript ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@scriptCount@/: Number of script tags in the array
    -> Word32
    -- ^ /@scriptTags@/: Array of @/hb_tag_t/@ script tags
    -> m ((Int32, Word32, Word32))
    -- ^ __Returns:__ @true@ if one of the requested scripts is selected, @false@ if a fallback
    -- script is selected or if no scripts are selected.
otLayoutTableSelectScript face tableTag scriptCount scriptTags = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    scriptIndex <- allocMem :: IO (Ptr Word32)
    chosenScript <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_layout_table_select_script face' tableTag scriptCount scriptTags scriptIndex chosenScript
    scriptIndex' <- peek scriptIndex
    chosenScript' <- peek chosenScript
    touchManagedPtr face
    freeMem scriptIndex
    freeMem chosenScript
    return (result, scriptIndex', chosenScript')


-- function ot_layout_table_get_script_tags
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first script tag to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of script tags to return;\n               Output = the actual number of script tags returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "script_tags"
--           , argType = TCArray False (-1) 3 (TBasicType TUInt32)
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The array of #hb_tag_t script tags found for the query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "script_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = True
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of script tags to return;\n               Output = the actual number of script tags returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_table_get_script_tags" hb_ot_layout_table_get_script_tags :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- start_offset : TBasicType TUInt
    Ptr Word32 ->                           -- script_count : TBasicType TUInt
    Ptr (Ptr Word32) ->                     -- script_tags : TCArray False (-1) 3 (TBasicType TUInt32)
    IO Word32

-- | Fetches a list of all scripts enumerated in the specified face\'s GSUB table
-- or GPOS table. The list returned will begin at the offset provided.
otLayoutTableGetScriptTags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@startOffset@/: offset of the first script tag to retrieve
    -> m ((Word32, Maybe [Word32]))
    -- ^ __Returns:__ Total number of script tags.
otLayoutTableGetScriptTags face tableTag startOffset = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    scriptCount <- allocMem :: IO (Ptr Word32)
    scriptTags <- callocMem :: IO (Ptr (Ptr Word32))
    result <- hb_ot_layout_table_get_script_tags face' tableTag startOffset scriptCount scriptTags
    scriptCount' <- peek scriptCount
    scriptTags' <- peek scriptTags
    maybeScriptTags' <- convertIfNonNull scriptTags' $ \scriptTags'' -> do
        scriptTags''' <- (unpackStorableArrayWithLength scriptCount') scriptTags''
        freeMem scriptTags''
        return scriptTags'''
    touchManagedPtr face
    freeMem scriptCount
    freeMem scriptTags
    return (result, maybeScriptTags')


-- function ot_layout_table_get_lookup_count
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_table_get_lookup_count" hb_ot_layout_table_get_lookup_count :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    IO Word32

-- | Fetches the total number of lookups enumerated in the specified
-- face\'s GSUB table or GPOS table.
-- 
-- /Since: 0.9.22/
otLayoutTableGetLookupCount ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> m Word32
    -- ^ __Returns:__ Total number of lookups.
otLayoutTableGetLookupCount face tableTag = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_layout_table_get_lookup_count face' tableTag
    touchManagedPtr face
    return result


-- function ot_layout_table_get_feature_tags
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first feature tag to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of feature tags to return;\n                Output = the actual number of feature tags returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "feature_tags"
--           , argType = TCArray False (-1) 3 (TBasicType TUInt32)
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Array of feature tags found in the table"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "feature_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = True
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of feature tags to return;\n                Output = the actual number of feature tags returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_table_get_feature_tags" hb_ot_layout_table_get_feature_tags :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- start_offset : TBasicType TUInt
    Ptr Word32 ->                           -- feature_count : TBasicType TUInt
    Ptr (Ptr Word32) ->                     -- feature_tags : TCArray False (-1) 3 (TBasicType TUInt32)
    IO Word32

-- | Fetches a list of all feature tags in the given face\'s GSUB or GPOS table.
-- Note that there might be duplicate feature tags, belonging to different
-- script\/language-system pairs of the table.
-- 
-- /Since: 0.6.0/
otLayoutTableGetFeatureTags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@startOffset@/: offset of the first feature tag to retrieve
    -> m ((Word32, Maybe [Word32]))
    -- ^ __Returns:__ Total number of feature tags.
otLayoutTableGetFeatureTags face tableTag startOffset = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    featureCount <- allocMem :: IO (Ptr Word32)
    featureTags <- callocMem :: IO (Ptr (Ptr Word32))
    result <- hb_ot_layout_table_get_feature_tags face' tableTag startOffset featureCount featureTags
    featureCount' <- peek featureCount
    featureTags' <- peek featureTags
    maybeFeatureTags' <- convertIfNonNull featureTags' $ \featureTags'' -> do
        featureTags''' <- (unpackStorableArrayWithLength featureCount') featureTags''
        freeMem featureTags''
        return featureTags'''
    touchManagedPtr face
    freeMem featureCount
    freeMem featureTags
    return (result, maybeFeatureTags')


-- function ot_layout_table_find_script
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_tag_t of the script tag requested"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested script tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_table_find_script" hb_ot_layout_table_find_script :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- script_tag : TBasicType TUInt32
    Ptr Word32 ->                           -- script_index : TBasicType TUInt
    IO Int32

-- | Fetches the index if a given script tag in the specified face\'s GSUB table
-- or GPOS table.
otLayoutTableFindScript ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@scriptTag@/: @/hb_tag_t/@ of the script tag requested
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if the script is found, @false@ otherwise
otLayoutTableFindScript face tableTag scriptTag = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    scriptIndex <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_layout_table_find_script face' tableTag scriptTag scriptIndex
    scriptIndex' <- peek scriptIndex
    touchManagedPtr face
    freeMem scriptIndex
    return (result, scriptIndex')


-- function ot_layout_table_find_feature_variations
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coords"
--           , argType = TBasicType TInt
--           , argCType = Just "const int*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The variation coordinates to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "num_coords"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The number of variation coordinates"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "variations_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The array of feature variations found for the query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_table_find_feature_variations" hb_ot_layout_table_find_feature_variations :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Int32 ->                                -- coords : TBasicType TInt
    Word32 ->                               -- num_coords : TBasicType TUInt
    Ptr Word32 ->                           -- variations_index : TBasicType TUInt
    IO Int32

-- | Fetches a list of feature variations in the specified face\'s GSUB table
-- or GPOS table, at the specified variation coordinates.
-- 
-- /Since: 1.4.0/
otLayoutTableFindFeatureVariations ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Int32
    -- ^ /@coords@/: The variation coordinates to query
    -> Word32
    -- ^ /@numCoords@/: The number of variation coordinates
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if feature variations were found, @false@ otherwise.
otLayoutTableFindFeatureVariations face tableTag coords numCoords = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    variationsIndex <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_layout_table_find_feature_variations face' tableTag coords numCoords variationsIndex
    variationsIndex' <- peek variationsIndex
    touchManagedPtr face
    freeMem variationsIndex
    return (result, variationsIndex')


-- function ot_layout_table_choose_script
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_tags"
--           , argType = TBasicType TUInt32
--           , argCType = Just "const hb_tag_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Array of #hb_tag_t script tags"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the chosen script"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "chosen_script"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_tag_t of the chosen script"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_table_choose_script" hb_ot_layout_table_choose_script :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- script_tags : TBasicType TUInt32
    Ptr Word32 ->                           -- script_index : TBasicType TUInt
    Ptr Word32 ->                           -- chosen_script : TBasicType TUInt32
    IO Int32

-- | Deprecated since 2.0.0
otLayoutTableChooseScript ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@scriptTags@/: Array of @/hb_tag_t/@ script tags
    -> m ((Int32, Word32, Word32))
otLayoutTableChooseScript face tableTag scriptTags = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    scriptIndex <- allocMem :: IO (Ptr Word32)
    chosenScript <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_layout_table_choose_script face' tableTag scriptTags scriptIndex chosenScript
    scriptIndex' <- peek scriptIndex
    chosenScript' <- peek chosenScript
    touchManagedPtr face
    freeMem scriptIndex
    freeMem chosenScript
    return (result, scriptIndex', chosenScript')


-- function ot_layout_script_select_language2
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested script tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The number of languages in the specified script"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_tags"
--           , argType = TBasicType TUInt32
--           , argCType = Just "const hb_tag_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The array of language tags"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the chosen language"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "chosen_language"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_tag_t of the chosen language"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_script_select_language2" hb_ot_layout_script_select_language2 :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- script_index : TBasicType TUInt
    Word32 ->                               -- language_count : TBasicType TUInt
    Word32 ->                               -- language_tags : TBasicType TUInt32
    Ptr Word32 ->                           -- language_index : TBasicType TUInt
    Ptr Word32 ->                           -- chosen_language : TBasicType TUInt32
    IO Int32

-- | Fetches the index of the first language tag fom /@languageTags@/ that is present
-- in the specified face\'s GSUB or GPOS table, underneath the specified script
-- index.
-- 
-- If none of the given language tags is found, @false@ is returned and
-- /@languageIndex@/ is set to 'GI.HarfBuzz.Constants.OT_LAYOUT_DEFAULT_LANGUAGE_INDEX' and
-- /@chosenLanguage@/ is set to @/HB_TAG_NONE/@.
-- 
-- /Since: 7.0.0/
otLayoutScriptSelectLanguage2 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@scriptIndex@/: The index of the requested script tag
    -> Word32
    -- ^ /@languageCount@/: The number of languages in the specified script
    -> Word32
    -- ^ /@languageTags@/: The array of language tags
    -> m ((Int32, Word32, Word32))
    -- ^ __Returns:__ @true@ if one of the given language tags is found, @false@ otherwise
otLayoutScriptSelectLanguage2 face tableTag scriptIndex languageCount languageTags = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    languageIndex <- allocMem :: IO (Ptr Word32)
    chosenLanguage <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_layout_script_select_language2 face' tableTag scriptIndex languageCount languageTags languageIndex chosenLanguage
    languageIndex' <- peek languageIndex
    chosenLanguage' <- peek chosenLanguage
    touchManagedPtr face
    freeMem languageIndex
    freeMem chosenLanguage
    return (result, languageIndex', chosenLanguage')


-- function ot_layout_script_select_language
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested script tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The number of languages in the specified script"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_tags"
--           , argType = TBasicType TUInt32
--           , argCType = Just "const hb_tag_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The array of language tags"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested language"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_script_select_language" hb_ot_layout_script_select_language :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- script_index : TBasicType TUInt
    Word32 ->                               -- language_count : TBasicType TUInt
    Word32 ->                               -- language_tags : TBasicType TUInt32
    Ptr Word32 ->                           -- language_index : TBasicType TUInt
    IO Int32

-- | Fetches the index of the first language tag fom /@languageTags@/ that is present
-- in the specified face\'s GSUB or GPOS table, underneath the specified script
-- index.
-- 
-- If none of the given language tags is found, @false@ is returned and
-- /@languageIndex@/ is set to the default language index.
-- 
-- /Since: 2.0.0/
otLayoutScriptSelectLanguage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@scriptIndex@/: The index of the requested script tag
    -> Word32
    -- ^ /@languageCount@/: The number of languages in the specified script
    -> Word32
    -- ^ /@languageTags@/: The array of language tags
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if one of the given language tags is found, @false@ otherwise
otLayoutScriptSelectLanguage face tableTag scriptIndex languageCount languageTags = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    languageIndex <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_layout_script_select_language face' tableTag scriptIndex languageCount languageTags languageIndex
    languageIndex' <- peek languageIndex
    touchManagedPtr face
    freeMem languageIndex
    return (result, languageIndex')


-- function ot_layout_script_get_language_tags
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested script tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first language tag to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of language tags to return;\n                 Output = the actual number of language tags returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "language_tags"
--           , argType = TCArray False (-1) 4 (TBasicType TUInt32)
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Array of language tags found in the table"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "language_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = True
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of language tags to return;\n                 Output = the actual number of language tags returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_script_get_language_tags" hb_ot_layout_script_get_language_tags :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- script_index : TBasicType TUInt
    Word32 ->                               -- start_offset : TBasicType TUInt
    Ptr Word32 ->                           -- language_count : TBasicType TUInt
    Ptr (Ptr Word32) ->                     -- language_tags : TCArray False (-1) 4 (TBasicType TUInt32)
    IO Word32

-- | Fetches a list of language tags in the given face\'s GSUB or GPOS table, underneath
-- the specified script index. The list returned will begin at the offset provided.
-- 
-- /Since: 0.6.0/
otLayoutScriptGetLanguageTags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@scriptIndex@/: The index of the requested script tag
    -> Word32
    -- ^ /@startOffset@/: offset of the first language tag to retrieve
    -> m ((Word32, Maybe [Word32]))
    -- ^ __Returns:__ Total number of language tags.
otLayoutScriptGetLanguageTags face tableTag scriptIndex startOffset = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    languageCount <- allocMem :: IO (Ptr Word32)
    languageTags <- callocMem :: IO (Ptr (Ptr Word32))
    result <- hb_ot_layout_script_get_language_tags face' tableTag scriptIndex startOffset languageCount languageTags
    languageCount' <- peek languageCount
    languageTags' <- peek languageTags
    maybeLanguageTags' <- convertIfNonNull languageTags' $ \languageTags'' -> do
        languageTags''' <- (unpackStorableArrayWithLength languageCount') languageTags''
        freeMem languageTags''
        return languageTags'''
    touchManagedPtr face
    freeMem languageCount
    freeMem languageTags
    return (result, maybeLanguageTags')


-- function ot_layout_script_find_language
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested script tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_tag_t of the requested language"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested language"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_script_find_language" hb_ot_layout_script_find_language :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- script_index : TBasicType TUInt
    Word32 ->                               -- language_tag : TBasicType TUInt32
    Word32 ->                               -- language_index : TBasicType TUInt
    IO Int32

{-# DEPRECATED otLayoutScriptFindLanguage ["(Since version 2.0.0)"] #-}
-- | Fetches the index of a given language tag in the specified face\'s GSUB table
-- or GPOS table, underneath the specified script tag.
-- 
-- /Since: 0.6.0/
otLayoutScriptFindLanguage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@scriptIndex@/: The index of the requested script tag
    -> Word32
    -- ^ /@languageTag@/: The @/hb_tag_t/@ of the requested language
    -> Word32
    -- ^ /@languageIndex@/: The index of the requested language
    -> m Int32
    -- ^ __Returns:__ @true@ if the language tag is found, @false@ otherwise
otLayoutScriptFindLanguage face tableTag scriptIndex languageTag languageIndex = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_layout_script_find_language face' tableTag scriptIndex languageTag languageIndex
    touchManagedPtr face
    return result


-- function ot_layout_lookups_substitute_closure
-- XXX Could not generate function ot_layout_lookups_substitute_closure

-- Not implemented: Don't know how to allocate "glyphs" of type TInterface (Name {namespace = "HarfBuzz", name = "set_t"})

-- function ot_layout_lookup_would_substitute
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "lookup_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the lookup to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyphs"
--           , argType = TBasicType TUInt32
--           , argCType = Just "const hb_codepoint_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The sequence of glyphs to query for substitution"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyphs_length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The length of the glyph sequence"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "zero_context"
--           , argType = TBasicType TInt
--           , argCType = Just "hb_bool_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "#hb_bool_t indicating whether pre-/post-context are disallowed\nin substitutions"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_lookup_would_substitute" hb_ot_layout_lookup_would_substitute :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- lookup_index : TBasicType TUInt
    Word32 ->                               -- glyphs : TBasicType TUInt32
    Word32 ->                               -- glyphs_length : TBasicType TUInt
    Int32 ->                                -- zero_context : TBasicType TInt
    IO Int32

-- | Tests whether a specified lookup in the specified face would
-- trigger a substitution on the given glyph sequence.
-- 
-- /Since: 0.9.7/
otLayoutLookupWouldSubstitute ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@lookupIndex@/: The index of the lookup to query
    -> Word32
    -- ^ /@glyphs@/: The sequence of glyphs to query for substitution
    -> Word32
    -- ^ /@glyphsLength@/: The length of the glyph sequence
    -> Int32
    -- ^ /@zeroContext@/: @/hb_bool_t/@ indicating whether pre-\/post-context are disallowed
    -- in substitutions
    -> m Int32
    -- ^ __Returns:__ @true@ if a substitution would be triggered, @false@ otherwise
otLayoutLookupWouldSubstitute face lookupIndex glyphs glyphsLength zeroContext = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_layout_lookup_would_substitute face' lookupIndex glyphs glyphsLength zeroContext
    touchManagedPtr face
    return result


-- function ot_layout_lookup_substitute_closure
-- XXX Could not generate function ot_layout_lookup_substitute_closure

-- Not implemented: Don't know how to allocate "glyphs" of type TInterface (Name {namespace = "HarfBuzz", name = "set_t"})

-- function ot_layout_lookup_get_optical_bound
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a font." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "lookup_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "index of the feature lookup to query."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "edge of the glyph to query."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a glyph id." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_lookup_get_optical_bound" hb_ot_layout_lookup_get_optical_bound :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- lookup_index : TBasicType TUInt
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    IO Int32

-- | Fetches the optical bound of a glyph positioned at the margin of text.
-- The direction identifies which edge of the glyph to query.
-- 
-- /Since: 5.3.0/
otLayoutLookupGetOpticalBound ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: a font.
    -> Word32
    -- ^ /@lookupIndex@/: index of the feature lookup to query.
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: edge of the glyph to query.
    -> Word32
    -- ^ /@glyph@/: a glyph id.
    -> m Int32
    -- ^ __Returns:__ Adjustment value. Negative values mean the glyph will stick out of the margin.
otLayoutLookupGetOpticalBound font lookupIndex direction glyph = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    result <- hb_ot_layout_lookup_get_optical_bound font' lookupIndex direction' glyph
    touchManagedPtr font
    return result


-- function ot_layout_lookup_get_glyph_alternates
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a face." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "lookup_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "index of the feature lookup to query."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a glyph id." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "starting offset." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "alternate_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of alternate glyphs to return;\n                  Output = the actual number of alternate glyphs returned (may be zero)."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "alternate_glyphs"
--           , argType = TCArray False (-1) 4 (TBasicType TUInt32)
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "A glyphs buffer.\n                   Alternate glyphs associated with the glyph id."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "alternate_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned*"
--              , direction = DirectionOut
--              , mayBeNull = True
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of alternate glyphs to return;\n                  Output = the actual number of alternate glyphs returned (may be zero)."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_lookup_get_glyph_alternates" hb_ot_layout_lookup_get_glyph_alternates :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- lookup_index : TBasicType TUInt
    Word32 ->                               -- glyph : TBasicType TUInt32
    Word32 ->                               -- start_offset : TBasicType TUInt
    Word32 ->                               -- alternate_count : TBasicType TUInt
    Ptr Word32 ->                           -- alternate_glyphs : TCArray False (-1) 4 (TBasicType TUInt32)
    IO Word32

-- | Fetches alternates of a glyph from a given GSUB lookup index. Note that for one-to-one GSUB
-- glyph substitutions, this function fetches the substituted glyph.
-- 
-- /Since: 2.6.8/
otLayoutLookupGetGlyphAlternates ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: a face.
    -> Word32
    -- ^ /@lookupIndex@/: index of the feature lookup to query.
    -> Word32
    -- ^ /@glyph@/: a glyph id.
    -> Word32
    -- ^ /@startOffset@/: starting offset.
    -> Maybe ([Word32])
    -- ^ /@alternateGlyphs@/: A glyphs buffer.
    --                    Alternate glyphs associated with the glyph id.
    -> m ((Word32, Maybe [Word32]))
    -- ^ __Returns:__ Total number of alternates found in the specific lookup index for the given glyph id.
otLayoutLookupGetGlyphAlternates face lookupIndex glyph startOffset alternateGlyphs = liftIO $ do
    let alternateCount = case alternateGlyphs of
            Nothing -> 0
            Just jAlternateGlyphs -> fromIntegral $ P.length jAlternateGlyphs
    face' <- unsafeManagedPtrGetPtr face
    maybeAlternateGlyphs <- case alternateGlyphs of
        Nothing -> return FP.nullPtr
        Just jAlternateGlyphs -> do
            jAlternateGlyphs' <- packStorableArray jAlternateGlyphs
            return jAlternateGlyphs'
    result <- hb_ot_layout_lookup_get_glyph_alternates face' lookupIndex glyph startOffset alternateCount maybeAlternateGlyphs
    maybeMaybeAlternateGlyphs <- convertIfNonNull maybeAlternateGlyphs $ \maybeAlternateGlyphs' -> do
        maybeAlternateGlyphs'' <- (unpackStorableArrayWithLength alternateCount) maybeAlternateGlyphs'
        freeMem maybeAlternateGlyphs'
        return maybeAlternateGlyphs''
    touchManagedPtr face
    return (result, maybeMaybeAlternateGlyphs)


-- function ot_layout_lookup_collect_glyphs
-- XXX Could not generate function ot_layout_lookup_collect_glyphs

-- Not implemented: Don't know how to allocate "glyphs_before" of type TInterface (Name {namespace = "HarfBuzz", name = "set_t"})

-- function ot_layout_lookup_collect_glyph_alternates
-- XXX Could not generate function ot_layout_lookup_collect_glyph_alternates

-- Bad introspection data: C type for argument ‘alternate_count’ is not a pointer to a pointer

-- function ot_layout_language_get_required_feature_index
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested script tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested language tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested feature"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_language_get_required_feature_index" hb_ot_layout_language_get_required_feature_index :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- script_index : TBasicType TUInt
    Word32 ->                               -- language_index : TBasicType TUInt
    Ptr Word32 ->                           -- feature_index : TBasicType TUInt
    IO Int32

-- | Fetches the index of a requested feature in the given face\'s GSUB or GPOS table,
-- underneath the specified script and language.
-- 
-- /Since: 0.6.0/
otLayoutLanguageGetRequiredFeatureIndex ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@scriptIndex@/: The index of the requested script tag
    -> Word32
    -- ^ /@languageIndex@/: The index of the requested language tag
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if the feature is found, @false@ otherwise
otLayoutLanguageGetRequiredFeatureIndex face tableTag scriptIndex languageIndex = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    featureIndex <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_layout_language_get_required_feature_index face' tableTag scriptIndex languageIndex featureIndex
    featureIndex' <- peek featureIndex
    touchManagedPtr face
    freeMem featureIndex
    return (result, featureIndex')


-- function ot_layout_language_get_required_feature
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested script tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested language tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested feature"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "feature_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_tag_t of the requested feature"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_language_get_required_feature" hb_ot_layout_language_get_required_feature :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- script_index : TBasicType TUInt
    Word32 ->                               -- language_index : TBasicType TUInt
    Ptr Word32 ->                           -- feature_index : TBasicType TUInt
    Ptr Word32 ->                           -- feature_tag : TBasicType TUInt32
    IO Int32

-- | Fetches the tag of a requested feature index in the given face\'s GSUB or GPOS table,
-- underneath the specified script and language.
-- 
-- /Since: 0.9.30/
otLayoutLanguageGetRequiredFeature ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@scriptIndex@/: The index of the requested script tag
    -> Word32
    -- ^ /@languageIndex@/: The index of the requested language tag
    -> m ((Int32, Word32, Word32))
    -- ^ __Returns:__ @true@ if the feature is found, @false@ otherwise
otLayoutLanguageGetRequiredFeature face tableTag scriptIndex languageIndex = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    featureIndex <- allocMem :: IO (Ptr Word32)
    featureTag <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_layout_language_get_required_feature face' tableTag scriptIndex languageIndex featureIndex featureTag
    featureIndex' <- peek featureIndex
    featureTag' <- peek featureTag
    touchManagedPtr face
    freeMem featureIndex
    freeMem featureTag
    return (result, featureIndex', featureTag')


-- function ot_layout_language_get_feature_tags
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested script tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested language tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first feature tag to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of feature tags to return;\n                Output = the actual number of feature tags returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "feature_tags"
--           , argType = TCArray False (-1) 5 (TBasicType TUInt32)
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The array of #hb_tag_t feature tags found for the query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "feature_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = True
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of feature tags to return;\n                Output = the actual number of feature tags returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_language_get_feature_tags" hb_ot_layout_language_get_feature_tags :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- script_index : TBasicType TUInt
    Word32 ->                               -- language_index : TBasicType TUInt
    Word32 ->                               -- start_offset : TBasicType TUInt
    Ptr Word32 ->                           -- feature_count : TBasicType TUInt
    Ptr (Ptr Word32) ->                     -- feature_tags : TCArray False (-1) 5 (TBasicType TUInt32)
    IO Word32

-- | Fetches a list of all features in the specified face\'s GSUB table
-- or GPOS table, underneath the specified script and language. The list
-- returned will begin at the offset provided.
-- 
-- /Since: 0.6.0/
otLayoutLanguageGetFeatureTags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@scriptIndex@/: The index of the requested script tag
    -> Word32
    -- ^ /@languageIndex@/: The index of the requested language tag
    -> Word32
    -- ^ /@startOffset@/: offset of the first feature tag to retrieve
    -> m ((Word32, Maybe [Word32]))
    -- ^ __Returns:__ Total number of feature tags.
otLayoutLanguageGetFeatureTags face tableTag scriptIndex languageIndex startOffset = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    featureCount <- allocMem :: IO (Ptr Word32)
    featureTags <- callocMem :: IO (Ptr (Ptr Word32))
    result <- hb_ot_layout_language_get_feature_tags face' tableTag scriptIndex languageIndex startOffset featureCount featureTags
    featureCount' <- peek featureCount
    featureTags' <- peek featureTags
    maybeFeatureTags' <- convertIfNonNull featureTags' $ \featureTags'' -> do
        featureTags''' <- (unpackStorableArrayWithLength featureCount') featureTags''
        freeMem featureTags''
        return featureTags'''
    touchManagedPtr face
    freeMem featureCount
    freeMem featureTags
    return (result, maybeFeatureTags')


-- function ot_layout_language_get_feature_indexes
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested script tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested language tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first feature tag to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of feature tags to return;\n                Output: the actual number of feature tags returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "feature_indexes"
--           , argType = TCArray False (-1) 5 (TBasicType TUInt)
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The array of feature indexes found for the query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "feature_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = True
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of feature tags to return;\n                Output: the actual number of feature tags returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_language_get_feature_indexes" hb_ot_layout_language_get_feature_indexes :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- script_index : TBasicType TUInt
    Word32 ->                               -- language_index : TBasicType TUInt
    Word32 ->                               -- start_offset : TBasicType TUInt
    Ptr Word32 ->                           -- feature_count : TBasicType TUInt
    Ptr (Ptr Word32) ->                     -- feature_indexes : TCArray False (-1) 5 (TBasicType TUInt)
    IO Word32

-- | Fetches a list of all features in the specified face\'s GSUB table
-- or GPOS table, underneath the specified script and language. The list
-- returned will begin at the offset provided.
-- 
-- /Since: 0.6.0/
otLayoutLanguageGetFeatureIndexes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@scriptIndex@/: The index of the requested script tag
    -> Word32
    -- ^ /@languageIndex@/: The index of the requested language tag
    -> Word32
    -- ^ /@startOffset@/: offset of the first feature tag to retrieve
    -> m ((Word32, Maybe [Word32]))
    -- ^ __Returns:__ Total number of features.
otLayoutLanguageGetFeatureIndexes face tableTag scriptIndex languageIndex startOffset = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    featureCount <- allocMem :: IO (Ptr Word32)
    featureIndexes <- callocMem :: IO (Ptr (Ptr Word32))
    result <- hb_ot_layout_language_get_feature_indexes face' tableTag scriptIndex languageIndex startOffset featureCount featureIndexes
    featureCount' <- peek featureCount
    featureIndexes' <- peek featureIndexes
    maybeFeatureIndexes' <- convertIfNonNull featureIndexes' $ \featureIndexes'' -> do
        featureIndexes''' <- (unpackStorableArrayWithLength featureCount') featureIndexes''
        freeMem featureIndexes''
        return featureIndexes'''
    touchManagedPtr face
    freeMem featureCount
    freeMem featureIndexes
    return (result, maybeFeatureIndexes')


-- function ot_layout_language_find_feature
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested script tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested language tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_tag_t of the feature tag requested"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested feature"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_language_find_feature" hb_ot_layout_language_find_feature :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- script_index : TBasicType TUInt
    Word32 ->                               -- language_index : TBasicType TUInt
    Word32 ->                               -- feature_tag : TBasicType TUInt32
    Ptr Word32 ->                           -- feature_index : TBasicType TUInt
    IO Int32

-- | Fetches the index of a given feature tag in the specified face\'s GSUB table
-- or GPOS table, underneath the specified script and language.
-- 
-- /Since: 0.6.0/
otLayoutLanguageFindFeature ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@scriptIndex@/: The index of the requested script tag
    -> Word32
    -- ^ /@languageIndex@/: The index of the requested language tag
    -> Word32
    -- ^ /@featureTag@/: @/hb_tag_t/@ of the feature tag requested
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if the feature is found, @false@ otherwise
otLayoutLanguageFindFeature face tableTag scriptIndex languageIndex featureTag = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    featureIndex <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_layout_language_find_feature face' tableTag scriptIndex languageIndex featureTag featureIndex
    featureIndex' <- peek featureIndex
    touchManagedPtr face
    freeMem featureIndex
    return (result, featureIndex')


-- function ot_layout_has_substitution
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_has_substitution" hb_ot_layout_has_substitution :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests whether the specified face includes any GSUB substitutions.
-- 
-- /Since: 0.6.0/
otLayoutHasSubstitution ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> m Int32
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
otLayoutHasSubstitution face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_layout_has_substitution face'
    touchManagedPtr face
    return result


-- function ot_layout_has_positioning
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_has_positioning" hb_ot_layout_has_positioning :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests whether the specified face includes any GPOS positioning.
otLayoutHasPositioning ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> m Int32
    -- ^ __Returns:__ @true@ if the face has GPOS data, @false@ otherwise
otLayoutHasPositioning face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_layout_has_positioning face'
    touchManagedPtr face
    return result


-- function ot_layout_has_glyph_classes
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_has_glyph_classes" hb_ot_layout_has_glyph_classes :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests whether a face has any glyph classes defined in its GDEF table.
otLayoutHasGlyphClasses ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> m Int32
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
otLayoutHasGlyphClasses face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_layout_has_glyph_classes face'
    touchManagedPtr face
    return result


-- function ot_layout_get_size_params
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "design_size"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The design size of the face"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "subfamily_id"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The identifier of the face within the font subfamily"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "subfamily_name_id"
--           , argType = TBasicType TUInt
--           , argCType = Just "hb_ot_name_id_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The \8216name\8217 table name ID of the face within the font subfamily"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "range_start"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The minimum size of the recommended size range for the face"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "range_end"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The maximum size of the recommended size range for the face"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_get_size_params" hb_ot_layout_get_size_params :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Ptr Word32 ->                           -- design_size : TBasicType TUInt
    Ptr Word32 ->                           -- subfamily_id : TBasicType TUInt
    Ptr Word32 ->                           -- subfamily_name_id : TBasicType TUInt
    Ptr Word32 ->                           -- range_start : TBasicType TUInt
    Ptr Word32 ->                           -- range_end : TBasicType TUInt
    IO Int32

-- | Fetches optical-size feature data (i.e., the @size@ feature from GPOS). Note that
-- the subfamily_id and the subfamily name string (accessible via the subfamily_name_id)
-- as used here are defined as pertaining only to fonts within a font family that differ
-- specifically in their respective size ranges; other ways to differentiate fonts within
-- a subfamily are not covered by the @size@ feature.
-- 
-- For more information on this distinction, see the <http://developer.gnome.org/harfbuzz/stable/
-- https://docs.microsoft.com/en-us/typography/opentype/spec/features_pt#tag-size `size` feature documentation>.
-- 
-- /Since: 0.9.10/
otLayoutGetSizeParams ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> m ((Int32, Word32, Word32, Word32, Word32, Word32))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
otLayoutGetSizeParams face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    designSize <- allocMem :: IO (Ptr Word32)
    subfamilyId <- allocMem :: IO (Ptr Word32)
    subfamilyNameId <- allocMem :: IO (Ptr Word32)
    rangeStart <- allocMem :: IO (Ptr Word32)
    rangeEnd <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_layout_get_size_params face' designSize subfamilyId subfamilyNameId rangeStart rangeEnd
    designSize' <- peek designSize
    subfamilyId' <- peek subfamilyId
    subfamilyNameId' <- peek subfamilyNameId
    rangeStart' <- peek rangeStart
    rangeEnd' <- peek rangeEnd
    touchManagedPtr face
    freeMem designSize
    freeMem subfamilyId
    freeMem subfamilyNameId
    freeMem rangeStart
    freeMem rangeEnd
    return (result, designSize', subfamilyId', subfamilyNameId', rangeStart', rangeEnd')


-- function ot_layout_get_ligature_carets
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_font_t to work on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_direction_t text direction to use"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_codepoint_t code point to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "offset of the first caret position to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "caret_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of caret positions to return;\n              Output = the actual number of caret positions returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "caret_array"
--           , argType = TCArray False (-1) 4 (TBasicType TInt32)
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The array of caret positions found for the query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "caret_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = True
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of caret positions to return;\n              Output = the actual number of caret positions returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_get_ligature_carets" hb_ot_layout_get_ligature_carets :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Word32 ->                               -- start_offset : TBasicType TUInt
    Ptr Word32 ->                           -- caret_count : TBasicType TUInt
    Ptr (Ptr Int32) ->                      -- caret_array : TCArray False (-1) 4 (TBasicType TInt32)
    IO Word32

-- | Fetches a list of the caret positions defined for a ligature glyph in the GDEF
-- table of the font. The list returned will begin at the offset provided.
-- 
-- Note that a ligature that is formed from n characters will have n-1
-- caret positions. The first character is not represented in the array,
-- since its caret position is the glyph position.
-- 
-- The positions returned by this function are \'unshaped\', and will have to
-- be fixed up for kerning that may be applied to the ligature glyph.
otLayoutGetLigatureCarets ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: The t'GI.HarfBuzz.Structs.FontT.FontT' to work on
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: The t'GI.HarfBuzz.Enums.DirectionT' text direction to use
    -> Word32
    -- ^ /@glyph@/: The @/hb_codepoint_t/@ code point to query
    -> Word32
    -- ^ /@startOffset@/: offset of the first caret position to retrieve
    -> m ((Word32, Maybe [Int32]))
    -- ^ __Returns:__ Total number of ligature caret positions for /@glyph@/.
otLayoutGetLigatureCarets font direction glyph startOffset = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    caretCount <- allocMem :: IO (Ptr Word32)
    caretArray <- callocMem :: IO (Ptr (Ptr Int32))
    result <- hb_ot_layout_get_ligature_carets font' direction' glyph startOffset caretCount caretArray
    caretCount' <- peek caretCount
    caretArray' <- peek caretArray
    maybeCaretArray' <- convertIfNonNull caretArray' $ \caretArray'' -> do
        caretArray''' <- (unpackStorableArrayWithLength caretCount') caretArray''
        freeMem caretArray''
        return caretArray'''
    touchManagedPtr font
    freeMem caretCount
    freeMem caretArray
    return (result, maybeCaretArray')


-- function ot_layout_get_horizontal_baseline_tag_for_script
-- Args: [ Arg
--           { argCName = "script"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "script_t" }
--           , argCType = Just "hb_script_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a script tag." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name
--                    { namespace = "HarfBuzz" , name = "ot_layout_baseline_tag_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_get_horizontal_baseline_tag_for_script" hb_ot_layout_get_horizontal_baseline_tag_for_script :: 
    CUInt ->                                -- script : TInterface (Name {namespace = "HarfBuzz", name = "script_t"})
    IO CUInt

-- | Fetches the dominant horizontal baseline tag used by /@script@/.
-- 
-- /Since: 4.0.0/
otLayoutGetHorizontalBaselineTagForScript ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.Enums.ScriptT
    -- ^ /@script@/: a script tag.
    -> m HarfBuzz.Enums.OtLayoutBaselineTagT
    -- ^ __Returns:__ dominant baseline tag for the /@script@/.
otLayoutGetHorizontalBaselineTagForScript script = liftIO $ do
    let script' = (fromIntegral . fromEnum) script
    result <- hb_ot_layout_get_horizontal_baseline_tag_for_script script'
    let result' = (toEnum . fromIntegral) result
    return result'


-- function ot_layout_get_glyphs_in_class
-- XXX Could not generate function ot_layout_get_glyphs_in_class

-- Not implemented: Don't know how to allocate "glyphs" of type TInterface (Name {namespace = "HarfBuzz", name = "set_t"})

-- function ot_layout_get_glyph_class
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_face_t to work on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_codepoint_t code point to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "ot_layout_glyph_class_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_get_glyph_class" hb_ot_layout_get_glyph_class :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    IO CUInt

-- | Fetches the GDEF class of the requested glyph in the specified face.
-- 
-- /Since: 0.9.7/
otLayoutGetGlyphClass ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: The t'GI.HarfBuzz.Structs.FaceT.FaceT' to work on
    -> Word32
    -- ^ /@glyph@/: The @/hb_codepoint_t/@ code point to query
    -> m HarfBuzz.Enums.OtLayoutGlyphClassT
    -- ^ __Returns:__ The t'GI.HarfBuzz.Enums.OtLayoutGlyphClassT' glyph class of the given code
    -- point in the GDEF table of the face.
otLayoutGetGlyphClass face glyph = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_layout_get_glyph_class face' glyph
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr face
    return result'


-- function ot_layout_get_font_extents2
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a font" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "text direction." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "script_t" }
--           , argCType = Just "hb_script_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "script." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "language_t" }
--           , argCType = Just "hb_language_t"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "language." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "extents"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "font_extents_t" }
--           , argCType = Just "hb_font_extents_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "font extents if found."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_get_font_extents2" hb_ot_layout_get_font_extents2 :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    CUInt ->                                -- script : TInterface (Name {namespace = "HarfBuzz", name = "script_t"})
    Ptr HarfBuzz.LanguageT.LanguageT ->     -- language : TInterface (Name {namespace = "HarfBuzz", name = "language_t"})
    Ptr HarfBuzz.FontExtentsT.FontExtentsT -> -- extents : TInterface (Name {namespace = "HarfBuzz", name = "font_extents_t"})
    IO Int32

-- | Fetches script\/language-specific font extents.  These values are
-- looked up in the @BASE@ table\'s @MinMax@ records.
-- 
-- If no such extents are found, the default extents for the font are
-- fetched. As such, the return value of this function can for the
-- most part be ignored.  Note that the per-script\/language extents
-- do not have a line-gap value, and the line-gap is set to zero in
-- that case.
-- 
-- This function is like 'GI.HarfBuzz.Functions.otLayoutGetFontExtents' but takes
-- t'GI.HarfBuzz.Enums.ScriptT' and t'GI.HarfBuzz.Structs.LanguageT.LanguageT' instead of OpenType @/hb_tag_t/@.
-- 
-- /Since: 8.0.0/
otLayoutGetFontExtents2 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: a font
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: text direction.
    -> HarfBuzz.Enums.ScriptT
    -- ^ /@script@/: script.
    -> Maybe (HarfBuzz.LanguageT.LanguageT)
    -- ^ /@language@/: language.
    -> m ((Int32, Maybe HarfBuzz.FontExtentsT.FontExtentsT))
    -- ^ __Returns:__ @true@ if found script\/language-specific font extents.
otLayoutGetFontExtents2 font direction script language = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    let script' = (fromIntegral . fromEnum) script
    maybeLanguage <- case language of
        Nothing -> return FP.nullPtr
        Just jLanguage -> do
            jLanguage' <- unsafeManagedPtrGetPtr jLanguage
            return jLanguage'
    extents <- SP.callocBytes 48 :: IO (Ptr HarfBuzz.FontExtentsT.FontExtentsT)
    result <- hb_ot_layout_get_font_extents2 font' direction' script' maybeLanguage extents
    maybeExtents <- convertIfNonNull extents $ \extents' -> do
        extents'' <- (wrapPtr HarfBuzz.FontExtentsT.FontExtentsT) extents'
        return extents''
    touchManagedPtr font
    whenJust language touchManagedPtr
    return (result, maybeExtents)


-- function ot_layout_get_font_extents
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a font" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "text direction." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "script tag." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "language tag." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "extents"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "font_extents_t" }
--           , argCType = Just "hb_font_extents_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "font extents if found."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_get_font_extents" hb_ot_layout_get_font_extents :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Word32 ->                               -- script_tag : TBasicType TUInt32
    Word32 ->                               -- language_tag : TBasicType TUInt32
    Ptr HarfBuzz.FontExtentsT.FontExtentsT -> -- extents : TInterface (Name {namespace = "HarfBuzz", name = "font_extents_t"})
    IO Int32

-- | Fetches script\/language-specific font extents.  These values are
-- looked up in the @BASE@ table\'s @MinMax@ records.
-- 
-- If no such extents are found, the default extents for the font are
-- fetched. As such, the return value of this function can for the
-- most part be ignored.  Note that the per-script\/language extents
-- do not have a line-gap value, and the line-gap is set to zero in
-- that case.
-- 
-- /Since: 8.0.0/
otLayoutGetFontExtents ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: a font
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: text direction.
    -> Word32
    -- ^ /@scriptTag@/: script tag.
    -> Word32
    -- ^ /@languageTag@/: language tag.
    -> m ((Int32, Maybe HarfBuzz.FontExtentsT.FontExtentsT))
    -- ^ __Returns:__ @true@ if found script\/language-specific font extents.
otLayoutGetFontExtents font direction scriptTag languageTag = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    extents <- SP.callocBytes 48 :: IO (Ptr HarfBuzz.FontExtentsT.FontExtentsT)
    result <- hb_ot_layout_get_font_extents font' direction' scriptTag languageTag extents
    maybeExtents <- convertIfNonNull extents $ \extents' -> do
        extents'' <- (wrapPtr HarfBuzz.FontExtentsT.FontExtentsT) extents'
        return extents''
    touchManagedPtr font
    return (result, maybeExtents)


-- function ot_layout_get_baseline_with_fallback2
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a font" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "baseline_tag"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_layout_baseline_tag_t" }
--           , argCType = Just "hb_ot_layout_baseline_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a baseline tag" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "text direction." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "script_t" }
--           , argCType = Just "hb_script_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "script." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "language_t" }
--           , argCType = Just "hb_language_t"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "language, currently unused."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coord"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "baseline value if found."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_get_baseline_with_fallback2" hb_ot_layout_get_baseline_with_fallback2 :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- baseline_tag : TInterface (Name {namespace = "HarfBuzz", name = "ot_layout_baseline_tag_t"})
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    CUInt ->                                -- script : TInterface (Name {namespace = "HarfBuzz", name = "script_t"})
    Ptr HarfBuzz.LanguageT.LanguageT ->     -- language : TInterface (Name {namespace = "HarfBuzz", name = "language_t"})
    Ptr Int32 ->                            -- coord : TBasicType TInt32
    IO ()

-- | Fetches a baseline value from the font, and synthesizes
-- it if the font does not have it.
-- 
-- This function is like 'GI.HarfBuzz.Functions.otLayoutGetBaselineWithFallback' but takes
-- t'GI.HarfBuzz.Enums.ScriptT' and t'GI.HarfBuzz.Structs.LanguageT.LanguageT' instead of OpenType @/hb_tag_t/@.
-- 
-- /Since: 8.0.0/
otLayoutGetBaselineWithFallback2 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: a font
    -> HarfBuzz.Enums.OtLayoutBaselineTagT
    -- ^ /@baselineTag@/: a baseline tag
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: text direction.
    -> HarfBuzz.Enums.ScriptT
    -- ^ /@script@/: script.
    -> Maybe (HarfBuzz.LanguageT.LanguageT)
    -- ^ /@language@/: language, currently unused.
    -> m (Int32)
otLayoutGetBaselineWithFallback2 font baselineTag direction script language = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let baselineTag' = (fromIntegral . fromEnum) baselineTag
    let direction' = (fromIntegral . fromEnum) direction
    let script' = (fromIntegral . fromEnum) script
    maybeLanguage <- case language of
        Nothing -> return FP.nullPtr
        Just jLanguage -> do
            jLanguage' <- unsafeManagedPtrGetPtr jLanguage
            return jLanguage'
    coord <- allocMem :: IO (Ptr Int32)
    hb_ot_layout_get_baseline_with_fallback2 font' baselineTag' direction' script' maybeLanguage coord
    coord' <- peek coord
    touchManagedPtr font
    whenJust language touchManagedPtr
    freeMem coord
    return coord'


-- function ot_layout_get_baseline_with_fallback
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a font" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "baseline_tag"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_layout_baseline_tag_t" }
--           , argCType = Just "hb_ot_layout_baseline_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a baseline tag" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "text direction." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "script tag." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "language tag, currently unused."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coord"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "baseline value if found."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_get_baseline_with_fallback" hb_ot_layout_get_baseline_with_fallback :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- baseline_tag : TInterface (Name {namespace = "HarfBuzz", name = "ot_layout_baseline_tag_t"})
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Word32 ->                               -- script_tag : TBasicType TUInt32
    Word32 ->                               -- language_tag : TBasicType TUInt32
    Ptr Int32 ->                            -- coord : TBasicType TInt32
    IO ()

-- | Fetches a baseline value from the font, and synthesizes
-- it if the font does not have it.
-- 
-- /Since: 4.0.0/
otLayoutGetBaselineWithFallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: a font
    -> HarfBuzz.Enums.OtLayoutBaselineTagT
    -- ^ /@baselineTag@/: a baseline tag
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: text direction.
    -> Word32
    -- ^ /@scriptTag@/: script tag.
    -> Word32
    -- ^ /@languageTag@/: language tag, currently unused.
    -> m (Int32)
otLayoutGetBaselineWithFallback font baselineTag direction scriptTag languageTag = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let baselineTag' = (fromIntegral . fromEnum) baselineTag
    let direction' = (fromIntegral . fromEnum) direction
    coord <- allocMem :: IO (Ptr Int32)
    hb_ot_layout_get_baseline_with_fallback font' baselineTag' direction' scriptTag languageTag coord
    coord' <- peek coord
    touchManagedPtr font
    freeMem coord
    return coord'


-- function ot_layout_get_baseline2
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a font" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "baseline_tag"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_layout_baseline_tag_t" }
--           , argCType = Just "hb_ot_layout_baseline_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a baseline tag" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "text direction." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "script_t" }
--           , argCType = Just "hb_script_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "script." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "language_t" }
--           , argCType = Just "hb_language_t"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "language, currently unused."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coord"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "baseline value if found."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_get_baseline2" hb_ot_layout_get_baseline2 :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- baseline_tag : TInterface (Name {namespace = "HarfBuzz", name = "ot_layout_baseline_tag_t"})
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    CUInt ->                                -- script : TInterface (Name {namespace = "HarfBuzz", name = "script_t"})
    Ptr HarfBuzz.LanguageT.LanguageT ->     -- language : TInterface (Name {namespace = "HarfBuzz", name = "language_t"})
    Ptr Int32 ->                            -- coord : TBasicType TInt32
    IO Int32

-- | Fetches a baseline value from the font.
-- 
-- This function is like 'GI.HarfBuzz.Functions.otLayoutGetBaseline' but takes
-- t'GI.HarfBuzz.Enums.ScriptT' and t'GI.HarfBuzz.Structs.LanguageT.LanguageT' instead of OpenType @/hb_tag_t/@.
-- 
-- /Since: 8.0.0/
otLayoutGetBaseline2 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: a font
    -> HarfBuzz.Enums.OtLayoutBaselineTagT
    -- ^ /@baselineTag@/: a baseline tag
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: text direction.
    -> HarfBuzz.Enums.ScriptT
    -- ^ /@script@/: script.
    -> Maybe (HarfBuzz.LanguageT.LanguageT)
    -- ^ /@language@/: language, currently unused.
    -> m ((Int32, Int32))
    -- ^ __Returns:__ @true@ if found baseline value in the font.
otLayoutGetBaseline2 font baselineTag direction script language = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let baselineTag' = (fromIntegral . fromEnum) baselineTag
    let direction' = (fromIntegral . fromEnum) direction
    let script' = (fromIntegral . fromEnum) script
    maybeLanguage <- case language of
        Nothing -> return FP.nullPtr
        Just jLanguage -> do
            jLanguage' <- unsafeManagedPtrGetPtr jLanguage
            return jLanguage'
    coord <- allocMem :: IO (Ptr Int32)
    result <- hb_ot_layout_get_baseline2 font' baselineTag' direction' script' maybeLanguage coord
    coord' <- peek coord
    touchManagedPtr font
    whenJust language touchManagedPtr
    freeMem coord
    return (result, coord')


-- function ot_layout_get_baseline
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a font" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "baseline_tag"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_layout_baseline_tag_t" }
--           , argCType = Just "hb_ot_layout_baseline_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a baseline tag" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "text direction." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "script tag." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "language tag, currently unused."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coord"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "baseline value if found."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_get_baseline" hb_ot_layout_get_baseline :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- baseline_tag : TInterface (Name {namespace = "HarfBuzz", name = "ot_layout_baseline_tag_t"})
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Word32 ->                               -- script_tag : TBasicType TUInt32
    Word32 ->                               -- language_tag : TBasicType TUInt32
    Ptr Int32 ->                            -- coord : TBasicType TInt32
    IO Int32

-- | Fetches a baseline value from the font.
-- 
-- /Since: 2.6.0/
otLayoutGetBaseline ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: a font
    -> HarfBuzz.Enums.OtLayoutBaselineTagT
    -- ^ /@baselineTag@/: a baseline tag
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: text direction.
    -> Word32
    -- ^ /@scriptTag@/: script tag.
    -> Word32
    -- ^ /@languageTag@/: language tag, currently unused.
    -> m ((Int32, Int32))
    -- ^ __Returns:__ @true@ if found baseline value in the font.
otLayoutGetBaseline font baselineTag direction scriptTag languageTag = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let baselineTag' = (fromIntegral . fromEnum) baselineTag
    let direction' = (fromIntegral . fromEnum) direction
    coord <- allocMem :: IO (Ptr Int32)
    result <- hb_ot_layout_get_baseline font' baselineTag' direction' scriptTag languageTag coord
    coord' <- peek coord
    touchManagedPtr font
    freeMem coord
    return (result, coord')


-- function ot_layout_get_attach_points
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_face_t to work on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_codepoint_t code point to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "offset of the first attachment point to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "point_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of attachment points to return;\n              Output = the actual number of attachment points returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "point_array"
--           , argType = TCArray False (-1) 3 (TBasicType TUInt)
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The array of attachment points found for the query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "point_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = True
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of attachment points to return;\n              Output = the actual number of attachment points returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_get_attach_points" hb_ot_layout_get_attach_points :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Word32 ->                               -- start_offset : TBasicType TUInt
    Ptr Word32 ->                           -- point_count : TBasicType TUInt
    Ptr (Ptr Word32) ->                     -- point_array : TCArray False (-1) 3 (TBasicType TUInt)
    IO Word32

-- | Fetches a list of all attachment points for the specified glyph in the GDEF
-- table of the face. The list returned will begin at the offset provided.
-- 
-- Useful if the client program wishes to cache the list.
otLayoutGetAttachPoints ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: The t'GI.HarfBuzz.Structs.FaceT.FaceT' to work on
    -> Word32
    -- ^ /@glyph@/: The @/hb_codepoint_t/@ code point to query
    -> Word32
    -- ^ /@startOffset@/: offset of the first attachment point to retrieve
    -> m ((Word32, Maybe [Word32]))
    -- ^ __Returns:__ Total number of attachment points for /@glyph@/.
otLayoutGetAttachPoints face glyph startOffset = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    pointCount <- allocMem :: IO (Ptr Word32)
    pointArray <- callocMem :: IO (Ptr (Ptr Word32))
    result <- hb_ot_layout_get_attach_points face' glyph startOffset pointCount pointArray
    pointCount' <- peek pointCount
    pointArray' <- peek pointArray
    maybePointArray' <- convertIfNonNull pointArray' $ \pointArray'' -> do
        pointArray''' <- (unpackStorableArrayWithLength pointCount') pointArray''
        freeMem pointArray''
        return pointArray'''
    touchManagedPtr face
    freeMem pointCount
    freeMem pointArray
    return (result, maybePointArray')


-- function ot_layout_feature_with_variations_get_lookups
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the feature to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "variations_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the feature variation to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first lookup to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "lookup_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of lookups to return;\n               Output = the actual number of lookups returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "lookup_indexes"
--           , argType = TCArray False (-1) 5 (TBasicType TUInt)
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The array of lookups found for the query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "lookup_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = True
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of lookups to return;\n               Output = the actual number of lookups returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_feature_with_variations_get_lookups" hb_ot_layout_feature_with_variations_get_lookups :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- feature_index : TBasicType TUInt
    Word32 ->                               -- variations_index : TBasicType TUInt
    Word32 ->                               -- start_offset : TBasicType TUInt
    Ptr Word32 ->                           -- lookup_count : TBasicType TUInt
    Ptr (Ptr Word32) ->                     -- lookup_indexes : TCArray False (-1) 5 (TBasicType TUInt)
    IO Word32

-- | Fetches a list of all lookups enumerated for the specified feature, in
-- the specified face\'s GSUB table or GPOS table, enabled at the specified
-- variations index. The list returned will begin at the offset provided.
-- 
-- /Since: 1.4.0/
otLayoutFeatureWithVariationsGetLookups ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@featureIndex@/: The index of the feature to query
    -> Word32
    -- ^ /@variationsIndex@/: The index of the feature variation to query
    -> Word32
    -- ^ /@startOffset@/: offset of the first lookup to retrieve
    -> m ((Word32, Maybe [Word32]))
    -- ^ __Returns:__ Total number of lookups.
otLayoutFeatureWithVariationsGetLookups face tableTag featureIndex variationsIndex startOffset = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    lookupCount <- allocMem :: IO (Ptr Word32)
    lookupIndexes <- callocMem :: IO (Ptr (Ptr Word32))
    result <- hb_ot_layout_feature_with_variations_get_lookups face' tableTag featureIndex variationsIndex startOffset lookupCount lookupIndexes
    lookupCount' <- peek lookupCount
    lookupIndexes' <- peek lookupIndexes
    maybeLookupIndexes' <- convertIfNonNull lookupIndexes' $ \lookupIndexes'' -> do
        lookupIndexes''' <- (unpackStorableArrayWithLength lookupCount') lookupIndexes''
        freeMem lookupIndexes''
        return lookupIndexes'''
    touchManagedPtr face
    freeMem lookupCount
    freeMem lookupIndexes
    return (result, maybeLookupIndexes')


-- function ot_layout_feature_get_name_ids
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "table tag to query, \"GSUB\" or \"GPOS\"."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "index of feature to query."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "label_id"
--           , argType = TBasicType TUInt
--           , argCType = Just "hb_ot_name_id_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The \8216name\8217 table name ID that specifies a string\n           for a user-interface label for this feature."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "tooltip_id"
--           , argType = TBasicType TUInt
--           , argCType = Just "hb_ot_name_id_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The \8216name\8217 table name ID that specifies a string\n             that an application can use for tooltip text for this\n             feature."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "sample_id"
--           , argType = TBasicType TUInt
--           , argCType = Just "hb_ot_name_id_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The \8216name\8217 table name ID that specifies sample text\n            that illustrates the effect of this feature."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "num_named_parameters"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Number of named parameters."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "first_param_id"
--           , argType = TBasicType TUInt
--           , argCType = Just "hb_ot_name_id_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The first \8216name\8217 table name ID used to specify\n                 strings for user-interface labels for the feature\n                 parameters. (Must be zero if numParameters is zero.)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_feature_get_name_ids" hb_ot_layout_feature_get_name_ids :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- feature_index : TBasicType TUInt
    Ptr Word32 ->                           -- label_id : TBasicType TUInt
    Ptr Word32 ->                           -- tooltip_id : TBasicType TUInt
    Ptr Word32 ->                           -- sample_id : TBasicType TUInt
    Ptr Word32 ->                           -- num_named_parameters : TBasicType TUInt
    Ptr Word32 ->                           -- first_param_id : TBasicType TUInt
    IO Int32

-- | Fetches name indices from feature parameters for \"Stylistic Set\" (\'ssXX\') or
-- \"Character Variant\" (\'cvXX\') features.
-- 
-- /Since: 2.0.0/
otLayoutFeatureGetNameIds ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: table tag to query, \"GSUB\" or \"GPOS\".
    -> Word32
    -- ^ /@featureIndex@/: index of feature to query.
    -> m ((Int32, Word32, Word32, Word32, Word32, Word32))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
otLayoutFeatureGetNameIds face tableTag featureIndex = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    labelId <- allocMem :: IO (Ptr Word32)
    tooltipId <- allocMem :: IO (Ptr Word32)
    sampleId <- allocMem :: IO (Ptr Word32)
    numNamedParameters <- allocMem :: IO (Ptr Word32)
    firstParamId <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_layout_feature_get_name_ids face' tableTag featureIndex labelId tooltipId sampleId numNamedParameters firstParamId
    labelId' <- peek labelId
    tooltipId' <- peek tooltipId
    sampleId' <- peek sampleId
    numNamedParameters' <- peek numNamedParameters
    firstParamId' <- peek firstParamId
    touchManagedPtr face
    freeMem labelId
    freeMem tooltipId
    freeMem sampleId
    freeMem numNamedParameters
    freeMem firstParamId
    return (result, labelId', tooltipId', sampleId', numNamedParameters', firstParamId')


-- function ot_layout_feature_get_lookups
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the requested feature"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first lookup to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "lookup_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of lookups to return;\n               Output = the actual number of lookups returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "lookup_indexes"
--           , argType = TCArray False (-1) 4 (TBasicType TUInt)
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The array of lookup indexes found for the query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "lookup_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = True
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of lookups to return;\n               Output = the actual number of lookups returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_feature_get_lookups" hb_ot_layout_feature_get_lookups :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- feature_index : TBasicType TUInt
    Word32 ->                               -- start_offset : TBasicType TUInt
    Ptr Word32 ->                           -- lookup_count : TBasicType TUInt
    Ptr (Ptr Word32) ->                     -- lookup_indexes : TCArray False (-1) 4 (TBasicType TUInt)
    IO Word32

-- | Fetches a list of all lookups enumerated for the specified feature, in
-- the specified face\'s GSUB table or GPOS table. The list returned will
-- begin at the offset provided.
-- 
-- /Since: 0.9.7/
otLayoutFeatureGetLookups ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: @/HB_OT_TAG_GSUB/@ or @/HB_OT_TAG_GPOS/@
    -> Word32
    -- ^ /@featureIndex@/: The index of the requested feature
    -> Word32
    -- ^ /@startOffset@/: offset of the first lookup to retrieve
    -> m ((Word32, Maybe [Word32]))
    -- ^ __Returns:__ Total number of lookups.
otLayoutFeatureGetLookups face tableTag featureIndex startOffset = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    lookupCount <- allocMem :: IO (Ptr Word32)
    lookupIndexes <- callocMem :: IO (Ptr (Ptr Word32))
    result <- hb_ot_layout_feature_get_lookups face' tableTag featureIndex startOffset lookupCount lookupIndexes
    lookupCount' <- peek lookupCount
    lookupIndexes' <- peek lookupIndexes
    maybeLookupIndexes' <- convertIfNonNull lookupIndexes' $ \lookupIndexes'' -> do
        lookupIndexes''' <- (unpackStorableArrayWithLength lookupCount') lookupIndexes''
        freeMem lookupIndexes''
        return lookupIndexes'''
    touchManagedPtr face
    freeMem lookupCount
    freeMem lookupIndexes
    return (result, maybeLookupIndexes')


-- function ot_layout_feature_get_characters
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "table tag to query, \"GSUB\" or \"GPOS\"."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "index of feature to query."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first character to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "char_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of characters to return;\n             Output = the actual number of characters returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "characters"
--           , argType = TCArray False (-1) 4 (TBasicType TUInt32)
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "A buffer pointer.\n             The Unicode codepoints of the characters for which this feature provides\n              glyph variants."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "char_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = True
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of characters to return;\n             Output = the actual number of characters returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_layout_feature_get_characters" hb_ot_layout_feature_get_characters :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- table_tag : TBasicType TUInt32
    Word32 ->                               -- feature_index : TBasicType TUInt
    Word32 ->                               -- start_offset : TBasicType TUInt
    Word32 ->                               -- char_count : TBasicType TUInt
    Ptr Word32 ->                           -- characters : TCArray False (-1) 4 (TBasicType TUInt32)
    IO Word32

-- | Fetches a list of the characters defined as having a variant under the specified
-- \"Character Variant\" (\"cvXX\") feature tag.
-- 
-- /Since: 2.0.0/
otLayoutFeatureGetCharacters ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@tableTag@/: table tag to query, \"GSUB\" or \"GPOS\".
    -> Word32
    -- ^ /@featureIndex@/: index of feature to query.
    -> Word32
    -- ^ /@startOffset@/: offset of the first character to retrieve
    -> Maybe ([Word32])
    -- ^ /@characters@/: A buffer pointer.
    --              The Unicode codepoints of the characters for which this feature provides
    --               glyph variants.
    -> m ((Word32, Maybe [Word32]))
    -- ^ __Returns:__ Number of total sample characters in the cvXX feature.
otLayoutFeatureGetCharacters face tableTag featureIndex startOffset characters = liftIO $ do
    let charCount = case characters of
            Nothing -> 0
            Just jCharacters -> fromIntegral $ P.length jCharacters
    face' <- unsafeManagedPtrGetPtr face
    maybeCharacters <- case characters of
        Nothing -> return FP.nullPtr
        Just jCharacters -> do
            jCharacters' <- packStorableArray jCharacters
            return jCharacters'
    result <- hb_ot_layout_feature_get_characters face' tableTag featureIndex startOffset charCount maybeCharacters
    maybeMaybeCharacters <- convertIfNonNull maybeCharacters $ \maybeCharacters' -> do
        maybeCharacters'' <- (unpackStorableArrayWithLength charCount) maybeCharacters'
        freeMem maybeCharacters'
        return maybeCharacters''
    touchManagedPtr face
    return (result, maybeMaybeCharacters)


-- function ot_layout_collect_lookups
-- XXX Could not generate function ot_layout_collect_lookups

-- Not implemented: Don't know how to allocate "lookup_indexes" of type TInterface (Name {namespace = "HarfBuzz", name = "set_t"})

-- function ot_layout_collect_features_map
-- XXX Could not generate function ot_layout_collect_features_map

-- Not implemented: Don't know how to allocate "feature_map" of type TInterface (Name {namespace = "HarfBuzz", name = "map_t"})

-- function ot_layout_collect_features
-- XXX Could not generate function ot_layout_collect_features

-- Not implemented: Don't know how to allocate "feature_indexes" of type TInterface (Name {namespace = "HarfBuzz", name = "set_t"})

-- function ot_font_set_funcs
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_font_set_funcs" hb_ot_font_set_funcs :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO ()

-- | Sets the font functions to use when working with /@font@/ to
-- the HarfBuzz\'s native implementation. This is the default
-- for fonts newly created.
-- 
-- /Since: 0.9.28/
otFontSetFuncs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m ()
otFontSetFuncs font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    hb_ot_font_set_funcs font'
    touchManagedPtr font
    return ()


-- function ot_fetch_number
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "tag"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "ot_number_tag_t" }
--           , argCType = Just "hb_ot_number_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "tag of the number to fetch"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_fetch_number" hb_ot_fetch_number :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    CUInt ->                                -- tag : TInterface (Name {namespace = "HarfBuzz", name = "ot_number_tag_t"})
    IO Int32

-- | Fetches a number of /@face@/ in font units.
-- 
-- /Since: 14.3.0/
otFetchNumber ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> HarfBuzz.Enums.OtNumberTagT
    -- ^ /@tag@/: tag of the number to fetch
    -> m Int32
    -- ^ __Returns:__ the number, or zero if the font does not have it.
otFetchNumber face tag = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    let tag' = (fromIntegral . fromEnum) tag
    result <- hb_ot_fetch_number face' tag'
    touchManagedPtr face
    return result


-- function ot_fetch_bits
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "tag"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "ot_bits_tag_t" }
--           , argCType = Just "hb_ot_bits_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "tag of the bit field to fetch"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_fetch_bits" hb_ot_fetch_bits :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    CUInt ->                                -- tag : TInterface (Name {namespace = "HarfBuzz", name = "ot_bits_tag_t"})
    IO Word32

-- | Fetches a bit field of /@face@/.
-- 
-- /Since: 14.3.0/
otFetchBits ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> HarfBuzz.Enums.OtBitsTagT
    -- ^ /@tag@/: tag of the bit field to fetch
    -> m Word32
    -- ^ __Returns:__ the bit field, or zero if the font does not have it.
otFetchBits face tag = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    let tag' = (fromIntegral . fromEnum) tag
    result <- hb_ot_fetch_bits face' tag'
    touchManagedPtr face
    return result


-- function ot_color_palette_get_name_id
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "palette_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the color palette"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_palette_get_name_id" hb_ot_color_palette_get_name_id :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- palette_index : TBasicType TUInt
    IO Word32

-- | Fetches the @name@ table Name ID that provides display names for
-- a @CPAL@ color palette.
-- 
-- Palette display names can be generic (e.g., \"Default\") or provide
-- specific, themed names (e.g., \"Spring\", \"Summer\", \"Fall\", and \"Winter\").
-- 
-- /Since: 2.1.0/
otColorPaletteGetNameId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@paletteIndex@/: The index of the color palette
    -> m Word32
    -- ^ __Returns:__ the Named ID found for the palette.
    -- If the requested palette has no name the result is @/HB_OT_NAME_ID_INVALID/@.
otColorPaletteGetNameId face paletteIndex = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_color_palette_get_name_id face' paletteIndex
    touchManagedPtr face
    return result


-- function ot_color_palette_get_flags
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "palette_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the color palette"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name
--                    { namespace = "HarfBuzz" , name = "ot_color_palette_flags_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_palette_get_flags" hb_ot_color_palette_get_flags :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- palette_index : TBasicType TUInt
    IO CUInt

-- | Fetches the flags defined for a color palette.
-- 
-- /Since: 2.1.0/
otColorPaletteGetFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@paletteIndex@/: The index of the color palette
    -> m [HarfBuzz.Flags.OtColorPaletteFlagsT]
    -- ^ __Returns:__ the t'GI.HarfBuzz.Flags.OtColorPaletteFlagsT' of the requested color palette
otColorPaletteGetFlags face paletteIndex = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_color_palette_get_flags face' paletteIndex
    let result' = wordToGFlags result
    touchManagedPtr face
    return result'


-- function ot_color_palette_get_count
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_palette_get_count" hb_ot_color_palette_get_count :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Word32

-- | Fetches the number of color palettes in a face.
-- 
-- /Since: 2.1.0/
otColorPaletteGetCount ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> m Word32
    -- ^ __Returns:__ the number of palettes found
otColorPaletteGetCount face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_color_palette_get_count face'
    touchManagedPtr face
    return result


-- function ot_color_palette_get_colors
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "palette_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the index of the color palette to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first color to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "color_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of colors to return;\n              Output = the actual number of colors returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "colors"
--           , argType = TCArray False (-1) 3 (TBasicType TUInt32)
--           , argCType = Just "hb_color_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The array of #hb_color_t records found"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "color_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of colors to return;\n              Output = the actual number of colors returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_palette_get_colors" hb_ot_color_palette_get_colors :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- palette_index : TBasicType TUInt
    Word32 ->                               -- start_offset : TBasicType TUInt
    Ptr Word32 ->                           -- color_count : TBasicType TUInt
    Ptr (Ptr Word32) ->                     -- colors : TCArray False (-1) 3 (TBasicType TUInt32)
    IO Word32

-- | Fetches a list of the colors in a color palette.
-- 
-- After calling this function, /@colors@/ will be filled with the palette
-- colors. If /@colors@/ is NULL, the function will just return the number
-- of total colors without storing any actual colors; this can be used
-- for allocating a buffer of suitable size before calling
-- 'GI.HarfBuzz.Functions.otColorPaletteGetColors' a second time.
-- 
-- The RGBA values in the palette are unpremultiplied. See the
-- OpenType spec <https://learn.microsoft.com/en-us/typography/opentype/spec/cpal CPAL>
-- section for details.
-- 
-- /Since: 2.1.0/
otColorPaletteGetColors ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@paletteIndex@/: the index of the color palette to query
    -> Word32
    -- ^ /@startOffset@/: offset of the first color to retrieve
    -> m ((Word32, Maybe [Word32]))
    -- ^ __Returns:__ the total number of colors in the palette
otColorPaletteGetColors face paletteIndex startOffset = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    colorCount <- allocMem :: IO (Ptr Word32)
    colors <- callocMem :: IO (Ptr (Ptr Word32))
    result <- hb_ot_color_palette_get_colors face' paletteIndex startOffset colorCount colors
    colorCount' <- peek colorCount
    colors' <- peek colors
    maybeColors' <- convertIfNonNull colors' $ \colors'' -> do
        colors''' <- (unpackStorableArrayWithLength colorCount') colors''
        freeMem colors''
        return colors'''
    touchManagedPtr face
    freeMem colorCount
    freeMem colors
    return (result, maybeColors')


-- function ot_color_palette_color_get_name_id
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "color_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the color"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_palette_color_get_name_id" hb_ot_color_palette_color_get_name_id :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- color_index : TBasicType TUInt
    IO Word32

-- | Fetches the @name@ table Name ID that provides display names for
-- the specified color in a face\'s @CPAL@ color palette.
-- 
-- Display names can be generic (e.g., \"Background\") or specific
-- (e.g., \"Eye color\").
-- 
-- /Since: 2.1.0/
otColorPaletteColorGetNameId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@colorIndex@/: The index of the color
    -> m Word32
    -- ^ __Returns:__ the Name ID found for the color.
otColorPaletteColorGetNameId face colorIndex = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_color_palette_color_get_name_id face' colorIndex
    touchManagedPtr face
    return result


-- function ot_color_has_svg
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_has_svg" hb_ot_color_has_svg :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests whether a face includes any @SVG@ glyph images.
-- 
-- /Since: 2.1.0/
otColorHasSvg ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon.
    -> m Int32
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise.
otColorHasSvg face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_color_has_svg face'
    touchManagedPtr face
    return result


-- function ot_color_has_png
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_has_png" hb_ot_color_has_png :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests whether a face has PNG glyph images (either in @CBDT@ or @sbix@ tables).
-- 
-- /Since: 2.1.0/
otColorHasPng ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> m Int32
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
otColorHasPng face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_color_has_png face'
    touchManagedPtr face
    return result


-- function ot_color_has_palettes
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_has_palettes" hb_ot_color_has_palettes :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests whether a face includes a @CPAL@ color-palette table.
-- 
-- /Since: 2.1.0/
otColorHasPalettes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> m Int32
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
otColorHasPalettes face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_color_has_palettes face'
    touchManagedPtr face
    return result


-- function ot_color_has_paint
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_has_paint" hb_ot_color_has_paint :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests where a face includes a @COLR@ table
-- with data according to COLRv1.
-- 
-- /Since: 7.0.0/
otColorHasPaint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> m Int32
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
otColorHasPaint face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_color_has_paint face'
    touchManagedPtr face
    return result


-- function ot_color_has_layers
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_has_layers" hb_ot_color_has_layers :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests whether a face includes a @COLR@ table
-- with data according to COLRv0.
-- 
-- /Since: 2.1.0/
otColorHasLayers ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> m Int32
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
otColorHasLayers face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_color_has_layers face'
    touchManagedPtr face
    return result


-- function ot_color_glyph_reference_svg
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a svg glyph index" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "blob_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_glyph_reference_svg" hb_ot_color_glyph_reference_svg :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    IO (Ptr HarfBuzz.BlobT.BlobT)

-- | Fetches the SVG document for a glyph. The blob may be either plain text or gzip-encoded.
-- 
-- If the glyph has no SVG document, the singleton empty blob is returned.
-- 
-- /Since: 2.1.0/
otColorGlyphReferenceSvg ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@glyph@/: a svg glyph index
    -> m HarfBuzz.BlobT.BlobT
    -- ^ __Returns:__ An t'GI.HarfBuzz.Structs.BlobT.BlobT' containing the SVG document of the glyph, if available
otColorGlyphReferenceSvg face glyph = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_color_glyph_reference_svg face' glyph
    checkUnexpectedReturnNULL "otColorGlyphReferenceSvg" result
    result' <- (wrapBoxed HarfBuzz.BlobT.BlobT) result
    touchManagedPtr face
    return result'


-- function ot_color_glyph_reference_png
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a glyph index" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "blob_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_glyph_reference_png" hb_ot_color_glyph_reference_png :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    IO (Ptr HarfBuzz.BlobT.BlobT)

-- | Fetches the PNG image for a glyph. This function takes a font object, not a face object,
-- as input. To get an optimally sized PNG blob, the PPEM values must be set on the /@font@/
-- object. If PPEM is unset, the blob returned will be the largest PNG available.
-- 
-- If the glyph has no PNG image, the singleton empty blob is returned.
-- 
-- /Since: 2.1.0/
otColorGlyphReferencePng ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: a glyph index
    -> m HarfBuzz.BlobT.BlobT
    -- ^ __Returns:__ An t'GI.HarfBuzz.Structs.BlobT.BlobT' containing the PNG image for the glyph, if available
otColorGlyphReferencePng font glyph = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_ot_color_glyph_reference_png font' glyph
    checkUnexpectedReturnNULL "otColorGlyphReferencePng" result
    result' <- (wrapBoxed HarfBuzz.BlobT.BlobT) result
    touchManagedPtr font
    return result'


-- function ot_color_glyph_has_paint
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph index to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_glyph_has_paint" hb_ot_color_glyph_has_paint :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    IO Int32

-- | Tests where a face includes COLRv1 paint
-- data for /@glyph@/.
-- 
-- /Since: 7.0.0/
otColorGlyphHasPaint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph index to query
    -> m Int32
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
otColorGlyphHasPaint face glyph = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_color_glyph_has_paint face' glyph
    touchManagedPtr face
    return result


-- function ot_color_glyph_get_svg_document_index
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "glyph ID to query." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "svg_document_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "output SVG document index."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_glyph_get_svg_document_index" hb_ot_color_glyph_get_svg_document_index :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr Word32 ->                           -- svg_document_index : TBasicType TUInt
    IO Int32

-- | Gets the @SVG@-table document index associated with a glyph.
-- 
-- /Since: 12.1.0/
otColorGlyphGetSvgDocumentIndex ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon.
    -> Word32
    -- ^ /@glyph@/: glyph ID to query.
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if /@glyph@/ maps to an SVG document, @false@ otherwise.
otColorGlyphGetSvgDocumentIndex face glyph = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    svgDocumentIndex <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_color_glyph_get_svg_document_index face' glyph svgDocumentIndex
    svgDocumentIndex' <- peek svgDocumentIndex
    touchManagedPtr face
    freeMem svgDocumentIndex
    return (result, svgDocumentIndex')


-- function ot_color_glyph_get_layers
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph index to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first layer to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "layer_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of layers to return;\n        Output = the actual number of layers returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "layers"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 3
--                 (TInterface
--                    Name { namespace = "HarfBuzz" , name = "ot_color_layer_t" })
--           , argCType = Just "hb_ot_color_layer_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The array of layers found"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "layer_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of layers to return;\n        Output = the actual number of layers returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_glyph_get_layers" hb_ot_color_glyph_get_layers :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Word32 ->                               -- start_offset : TBasicType TUInt
    Word32 ->                               -- layer_count : TBasicType TUInt
    Ptr HarfBuzz.OtColorLayerT.OtColorLayerT -> -- layers : TCArray False (-1) 3 (TInterface (Name {namespace = "HarfBuzz", name = "ot_color_layer_t"}))
    IO Word32

-- | Fetches a list of all color layers for the specified glyph index in the specified
-- face. The list returned will begin at the offset provided.
-- 
-- /Since: 2.1.0/
otColorGlyphGetLayers ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph index to query
    -> Word32
    -- ^ /@startOffset@/: offset of the first layer to retrieve
    -> Maybe ([HarfBuzz.OtColorLayerT.OtColorLayerT])
    -- ^ /@layers@/: The array of layers found
    -> m ((Word32, Maybe [HarfBuzz.OtColorLayerT.OtColorLayerT]))
    -- ^ __Returns:__ Total number of layers available for the glyph index queried
otColorGlyphGetLayers face glyph startOffset layers = liftIO $ do
    let layerCount = case layers of
            Nothing -> 0
            Just jLayers -> fromIntegral $ P.length jLayers
    face' <- unsafeManagedPtrGetPtr face
    maybeLayers <- case layers of
        Nothing -> return FP.nullPtr
        Just jLayers -> do
            jLayers' <- mapM unsafeManagedPtrGetPtr jLayers
            jLayers'' <- packBlockArray 8 jLayers'
            return jLayers''
    result <- hb_ot_color_glyph_get_layers face' glyph startOffset layerCount maybeLayers
    maybeMaybeLayers <- convertIfNonNull maybeLayers $ \maybeLayers' -> do
        maybeLayers'' <- (unpackBlockArrayWithLength 8 layerCount) maybeLayers'
        maybeLayers''' <- mapM (wrapPtr HarfBuzz.OtColorLayerT.OtColorLayerT) maybeLayers''
        freeMem maybeLayers'
        return maybeLayers'''
    touchManagedPtr face
    whenJust layers (mapM_ touchManagedPtr)
    return (result, maybeMaybeLayers)


-- function ot_color_get_svg_document_glyph_range
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "svg_document_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "SVG document index."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_glyph_id"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "output start glyph ID."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "end_glyph_id"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "output end glyph ID."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_get_svg_document_glyph_range" hb_ot_color_get_svg_document_glyph_range :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- svg_document_index : TBasicType TUInt
    Ptr Word32 ->                           -- start_glyph_id : TBasicType TUInt32
    Ptr Word32 ->                           -- end_glyph_id : TBasicType TUInt32
    IO Int32

-- | Gets the glyph range covered by an @SVG@-table document index.
-- 
-- /Since: 13.0.0/
otColorGetSvgDocumentGlyphRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon.
    -> Word32
    -- ^ /@svgDocumentIndex@/: SVG document index.
    -> m ((Int32, Word32, Word32))
    -- ^ __Returns:__ @true@ if /@svgDocumentIndex@/ is valid, @false@ otherwise.
otColorGetSvgDocumentGlyphRange face svgDocumentIndex = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    startGlyphId <- allocMem :: IO (Ptr Word32)
    endGlyphId <- allocMem :: IO (Ptr Word32)
    result <- hb_ot_color_get_svg_document_glyph_range face' svgDocumentIndex startGlyphId endGlyphId
    startGlyphId' <- peek startGlyphId
    endGlyphId' <- peek endGlyphId
    touchManagedPtr face
    freeMem startGlyphId
    freeMem endGlyphId
    return (result, startGlyphId', endGlyphId')


-- function ot_color_get_svg_document_count
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ot_color_get_svg_document_count" hb_ot_color_get_svg_document_count :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Word32

-- | Gets the number of SVG documents in the face @SVG@ table.
-- 
-- /Since: 12.1.0/
otColorGetSvgDocumentCount ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon.
    -> m Word32
    -- ^ __Returns:__ number of SVG documents in the face.
otColorGetSvgDocumentCount face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_ot_color_get_svg_document_count face'
    touchManagedPtr face
    return result


-- function map_values
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "const hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "values"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_values" hb_map_values :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    Ptr HarfBuzz.SetT.SetT ->               -- values : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO ()

-- | Add the values of /@map@/ to /@values@/.
-- 
-- /Since: 7.0.0/
mapValues ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> HarfBuzz.SetT.SetT
    -- ^ /@values@/: A set
    -> m ()
mapValues map_ values = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    values' <- unsafeManagedPtrGetPtr values
    hb_map_values map_' values'
    touchManagedPtr map_
    touchManagedPtr values
    return ()


-- function map_update
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "other"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "const hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Another map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_update" hb_map_update :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    Ptr HarfBuzz.MapT.MapT ->               -- other : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    IO ()

-- | Add the contents of /@other@/ to /@map@/.
-- 
-- /Since: 7.0.0/
mapUpdate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> HarfBuzz.MapT.MapT
    -- ^ /@other@/: Another map
    -> m ()
mapUpdate map_ other = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    other' <- unsafeManagedPtrGetPtr other
    hb_map_update map_' other'
    touchManagedPtr map_
    touchManagedPtr other
    return ()


-- function map_set
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "key"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The key to store in the map"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The value to store for @key"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_set" hb_map_set :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    Word32 ->                               -- key : TBasicType TUInt32
    Word32 ->                               -- value : TBasicType TUInt32
    IO ()

-- | Stores /@key@/:/@value@/ in the map.
-- 
-- /Since: 1.7.7/
mapSet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> Word32
    -- ^ /@key@/: The key to store in the map
    -> Word32
    -- ^ /@value@/: The value to store for /@key@/
    -> m ()
mapSet map_ key value = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    hb_map_set map_' key value
    touchManagedPtr map_
    return ()


-- function map_next
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "const hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "idx"
--           , argType = TBasicType TInt
--           , argCType = Just "int*"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Iterator internal state"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "key"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Key retrieved" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Value retrieved" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_next" hb_map_next :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    Ptr Int32 ->                            -- idx : TBasicType TInt
    Ptr Word32 ->                           -- key : TBasicType TUInt32
    Ptr Word32 ->                           -- value : TBasicType TUInt32
    IO Int32

-- | Fetches the next key\/value pair in /@map@/.
-- 
-- Set /@idx@/ to -1 to get started.
-- 
-- If the map is modified during iteration, the behavior is undefined.
-- 
-- The order in which the key\/values are returned is undefined.
-- 
-- /Since: 7.0.0/
mapNext ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> Int32
    -- ^ /@idx@/: Iterator internal state
    -> m ((Int32, Int32, Word32, Word32))
    -- ^ __Returns:__ @true@ if there was a next value, @false@ otherwise
mapNext map_ idx = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    idx' <- allocMem :: IO (Ptr Int32)
    poke idx' idx
    key <- allocMem :: IO (Ptr Word32)
    value <- allocMem :: IO (Ptr Word32)
    result <- hb_map_next map_' idx' key value
    idx'' <- peek idx'
    key' <- peek key
    value' <- peek value
    touchManagedPtr map_
    freeMem idx'
    freeMem key
    freeMem value
    return (result, idx'', key', value')


-- function map_keys
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "const hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "keys"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "set_t" }
--           , argCType = Just "hb_set_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_keys" hb_map_keys :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    Ptr HarfBuzz.SetT.SetT ->               -- keys : TInterface (Name {namespace = "HarfBuzz", name = "set_t"})
    IO ()

-- | Add the keys of /@map@/ to /@keys@/.
-- 
-- /Since: 7.0.0/
mapKeys ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> HarfBuzz.SetT.SetT
    -- ^ /@keys@/: A set
    -> m ()
mapKeys map_ keys = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    keys' <- unsafeManagedPtrGetPtr keys
    hb_map_keys map_' keys'
    touchManagedPtr map_
    touchManagedPtr keys
    return ()


-- function map_is_equal
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "const hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "other"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "const hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Another map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_is_equal" hb_map_is_equal :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    Ptr HarfBuzz.MapT.MapT ->               -- other : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    IO Int32

-- | Tests whether /@map@/ and /@other@/ are equal (contain the same
-- elements).
-- 
-- /Since: 4.3.0/
mapIsEqual ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> HarfBuzz.MapT.MapT
    -- ^ /@other@/: Another map
    -> m Int32
    -- ^ __Returns:__ @true@ if the two maps are equal, @false@ otherwise.
mapIsEqual map_ other = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    other' <- unsafeManagedPtrGetPtr other
    result <- hb_map_is_equal map_' other'
    touchManagedPtr map_
    touchManagedPtr other
    return result


-- function map_is_empty
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "const hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_is_empty" hb_map_is_empty :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    IO Int32

-- | Tests whether /@map@/ is empty (contains no elements).
-- 
-- /Since: 1.7.7/
mapIsEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> m Int32
    -- ^ __Returns:__ @true@ if /@map@/ is empty
mapIsEmpty map_ = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    result <- hb_map_is_empty map_'
    touchManagedPtr map_
    return result


-- function map_hash
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "const hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_hash" hb_map_hash :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    IO Word32

-- | Creates a hash representing /@map@/.
-- 
-- /Since: 4.4.0/
mapHash ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> m Word32
    -- ^ __Returns:__ A hash of /@map@/.
mapHash map_ = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    result <- hb_map_hash map_'
    touchManagedPtr map_
    return result


-- function map_has
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "const hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "key"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The key to query" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_has" hb_map_has :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    Word32 ->                               -- key : TBasicType TUInt32
    IO Int32

-- | Tests whether /@key@/ is an element of /@map@/.
-- 
-- /Since: 1.7.7/
mapHas ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> Word32
    -- ^ /@key@/: The key to query
    -> m Int32
    -- ^ __Returns:__ @true@ if /@key@/ is found in /@map@/, @false@ otherwise
mapHas map_ key = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    result <- hb_map_has map_' key
    touchManagedPtr map_
    return result


-- function map_get_population
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "const hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_get_population" hb_map_get_population :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    IO Word32

-- | Returns the number of key-value pairs in the map.
-- 
-- /Since: 1.7.7/
mapGetPopulation ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> m Word32
    -- ^ __Returns:__ The population of /@map@/
mapGetPopulation map_ = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    result <- hb_map_get_population map_'
    touchManagedPtr map_
    return result


-- function map_get_empty
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "map_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_get_empty" hb_map_get_empty :: 
    IO (Ptr HarfBuzz.MapT.MapT)

-- | Fetches the singleton empty t'GI.HarfBuzz.Structs.MapT.MapT'.
-- 
-- /Since: 1.7.7/
mapGetEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.MapT.MapT
    -- ^ __Returns:__ The empty t'GI.HarfBuzz.Structs.MapT.MapT'
mapGetEmpty  = liftIO $ do
    result <- hb_map_get_empty
    checkUnexpectedReturnNULL "mapGetEmpty" result
    result' <- (wrapBoxed HarfBuzz.MapT.MapT) result
    return result'


-- function map_get
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "const hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "key"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The key to query" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_get" hb_map_get :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    Word32 ->                               -- key : TBasicType TUInt32
    IO Word32

-- | Fetches the value stored for /@key@/ in /@map@/.
-- 
-- /Since: 1.7.7/
mapGet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> Word32
    -- ^ /@key@/: The key to query
    -> m Word32
mapGet map_ key = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    result <- hb_map_get map_' key
    touchManagedPtr map_
    return result


-- function map_del
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "key"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The key to delete" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_del" hb_map_del :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    Word32 ->                               -- key : TBasicType TUInt32
    IO ()

-- | Removes /@key@/ and its stored value from /@map@/.
-- 
-- /Since: 1.7.7/
mapDel ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> Word32
    -- ^ /@key@/: The key to delete
    -> m ()
mapDel map_ key = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    hb_map_del map_' key
    touchManagedPtr map_
    return ()


-- function map_create
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "map_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_create" hb_map_create :: 
    IO (Ptr HarfBuzz.MapT.MapT)

-- | Creates a new, initially empty map.
-- 
-- /Since: 1.7.7/
mapCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.MapT.MapT
    -- ^ __Returns:__ The new t'GI.HarfBuzz.Structs.MapT.MapT'
mapCreate  = liftIO $ do
    result <- hb_map_create
    checkUnexpectedReturnNULL "mapCreate" result
    result' <- (wrapBoxed HarfBuzz.MapT.MapT) result
    return result'


-- function map_copy
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "const hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "map_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_copy" hb_map_copy :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    IO (Ptr HarfBuzz.MapT.MapT)

-- | Allocate a copy of /@map@/.
-- 
-- /Since: 4.4.0/
mapCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> m HarfBuzz.MapT.MapT
    -- ^ __Returns:__ Newly-allocated map.
mapCopy map_ = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    result <- hb_map_copy map_'
    checkUnexpectedReturnNULL "mapCopy" result
    result' <- (wrapBoxed HarfBuzz.MapT.MapT) result
    touchManagedPtr map_
    return result'


-- function map_clear
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_clear" hb_map_clear :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    IO ()

-- | Clears out the contents of /@map@/.
-- 
-- /Since: 1.7.7/
mapClear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> m ()
mapClear map_ = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    hb_map_clear map_'
    touchManagedPtr map_
    return ()


-- function map_allocation_successful
-- Args: [ Arg
--           { argCName = "map"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "map_t" }
--           , argCType = Just "const hb_map_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A map" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_map_allocation_successful" hb_map_allocation_successful :: 
    Ptr HarfBuzz.MapT.MapT ->               -- map : TInterface (Name {namespace = "HarfBuzz", name = "map_t"})
    IO Int32

-- | Tests whether memory allocation for a set was successful.
-- 
-- /Since: 1.7.7/
mapAllocationSuccessful ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.MapT.MapT
    -- ^ /@map@/: A map
    -> m Int32
    -- ^ __Returns:__ @true@ if allocation succeeded, @false@ otherwise
mapAllocationSuccessful map_ = liftIO $ do
    map_' <- unsafeManagedPtrGetPtr map_
    result <- hb_map_allocation_successful map_'
    touchManagedPtr map_
    return result


-- function malloc
-- Args: [ Arg
--           { argCName = "size"
--           , argType = TBasicType TSize
--           , argCType = Just "size_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The size of the memory to allocate."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "hb_malloc" hb_malloc :: 
    FCT.CSize ->                            -- size : TBasicType TSize
    IO (Ptr ())

-- | Allocates /@size@/ bytes of memory, using the allocator set at
-- compile-time. Typically just @/malloc()/@.
-- 
-- /Since: 11.0.0/
malloc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FCT.CSize
    -- ^ /@size@/: The size of the memory to allocate.
    -> m (Ptr ())
    -- ^ __Returns:__ A pointer to the allocated memory.
malloc size = liftIO $ do
    result <- hb_malloc size
    return result


-- function language_to_string
-- Args: [ Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "language_t" }
--           , argCType = Just "hb_language_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_language_t to convert"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "hb_language_to_string" hb_language_to_string :: 
    Ptr HarfBuzz.LanguageT.LanguageT ->     -- language : TInterface (Name {namespace = "HarfBuzz", name = "language_t"})
    IO CString

-- | Converts an t'GI.HarfBuzz.Structs.LanguageT.LanguageT' to a string.
-- 
-- /Since: 0.9.2/
languageToString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.LanguageT.LanguageT
    -- ^ /@language@/: The t'GI.HarfBuzz.Structs.LanguageT.LanguageT' to convert
    -> m T.Text
    -- ^ __Returns:__ 
    -- A @NULL@-terminated string representing the /@language@/. Must not be freed by
    -- the caller.
languageToString language = liftIO $ do
    language' <- unsafeManagedPtrGetPtr language
    result <- hb_language_to_string language'
    checkUnexpectedReturnNULL "languageToString" result
    result' <- cstringToText result
    touchManagedPtr language
    return result'


-- function language_matches
-- Args: [ Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "language_t" }
--           , argCType = Just "hb_language_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_language_t to work on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "specific"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "language_t" }
--           , argCType = Just "hb_language_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Another #hb_language_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_language_matches" hb_language_matches :: 
    Ptr HarfBuzz.LanguageT.LanguageT ->     -- language : TInterface (Name {namespace = "HarfBuzz", name = "language_t"})
    Ptr HarfBuzz.LanguageT.LanguageT ->     -- specific : TInterface (Name {namespace = "HarfBuzz", name = "language_t"})
    IO Int32

-- | Check whether a second language tag is the same or a more
-- specific version of the provided language tag.  For example,
-- \"fa_IR.utf8\" is a more specific tag for \"fa\" or for \"fa_IR\".
-- 
-- /Since: 5.0.0/
languageMatches ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.LanguageT.LanguageT
    -- ^ /@language@/: The t'GI.HarfBuzz.Structs.LanguageT.LanguageT' to work on
    -> HarfBuzz.LanguageT.LanguageT
    -- ^ /@specific@/: Another t'GI.HarfBuzz.Structs.LanguageT.LanguageT'
    -> m Int32
    -- ^ __Returns:__ @true@ if languages match, @false@ otherwise.
languageMatches language specific = liftIO $ do
    language' <- unsafeManagedPtrGetPtr language
    specific' <- unsafeManagedPtrGetPtr specific
    result <- hb_language_matches language' specific'
    touchManagedPtr language
    touchManagedPtr specific
    return result


-- function language_get_default
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "language_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_language_get_default" hb_language_get_default :: 
    IO (Ptr HarfBuzz.LanguageT.LanguageT)

-- | Fetch the default language from current locale.
-- 
-- \<note>Note that the first time this function is called, it calls
-- \"setlocale (LC_CTYPE, nullptr)\" to fetch current locale.  The underlying
-- setlocale function is, in many implementations, NOT threadsafe.  To avoid
-- problems, call this function once before multiple threads can call it.
-- This function is only used from 'GI.HarfBuzz.Functions.bufferGuessSegmentProperties' by
-- HarfBuzz itself.\<\/note>
-- 
-- /Since: 0.9.2/
languageGetDefault ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.LanguageT.LanguageT
    -- ^ __Returns:__ The default language of the locale as
    -- an t'GI.HarfBuzz.Structs.LanguageT.LanguageT'
languageGetDefault  = liftIO $ do
    result <- hb_language_get_default
    checkUnexpectedReturnNULL "languageGetDefault" result
    result' <- (newPtr HarfBuzz.LanguageT.LanguageT) result
    return result'


-- function language_from_string
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a string representing\n      a BCP 47 language tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "length of the @str, or -1 if it is `NULL`-terminated."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "length of the @str, or -1 if it is `NULL`-terminated."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "language_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_language_from_string" hb_language_from_string :: 
    Ptr Word8 ->                            -- str : TCArray False (-1) 1 (TBasicType TUInt8)
    Int32 ->                                -- len : TBasicType TInt
    IO (Ptr HarfBuzz.LanguageT.LanguageT)

-- | Converts /@str@/ representing a BCP 47 language tag to the corresponding
-- t'GI.HarfBuzz.Structs.LanguageT.LanguageT'.
-- 
-- /Since: 0.9.2/
languageFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@str@/: a string representing
    --       a BCP 47 language tag
    -> m HarfBuzz.LanguageT.LanguageT
    -- ^ __Returns:__ 
    -- The t'GI.HarfBuzz.Structs.LanguageT.LanguageT' corresponding to the BCP 47 language tag.
languageFromString str = liftIO $ do
    let len = fromIntegral $ B.length str
    str' <- packByteString str
    result <- hb_language_from_string str' len
    checkUnexpectedReturnNULL "languageFromString" result
    result' <- (newPtr HarfBuzz.LanguageT.LanguageT) result
    freeMem str'
    return result'


-- function glyph_info_get_glyph_flags
-- Args: [ Arg
--           { argCName = "info"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "glyph_info_t" }
--           , argCType = Just "const hb_glyph_info_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #hb_glyph_info_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "glyph_flags_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_glyph_info_get_glyph_flags" hb_glyph_info_get_glyph_flags :: 
    Ptr HarfBuzz.GlyphInfoT.GlyphInfoT ->   -- info : TInterface (Name {namespace = "HarfBuzz", name = "glyph_info_t"})
    IO CUInt

-- | Returns glyph flags encoded within a t'GI.HarfBuzz.Structs.GlyphInfoT.GlyphInfoT'.
-- 
-- /Since: 1.5.0/
glyphInfoGetGlyphFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.GlyphInfoT.GlyphInfoT
    -- ^ /@info@/: a t'GI.HarfBuzz.Structs.GlyphInfoT.GlyphInfoT'
    -> m [HarfBuzz.Flags.GlyphFlagsT]
    -- ^ __Returns:__ The t'GI.HarfBuzz.Flags.GlyphFlagsT' encoded within /@info@/
glyphInfoGetGlyphFlags info = liftIO $ do
    info' <- unsafeManagedPtrGetPtr info
    result <- hb_glyph_info_get_glyph_flags info'
    let result' = wordToGFlags result
    touchManagedPtr info
    return result'


-- function glib_script_to_script
-- Args: [ Arg
--           { argCName = "script"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "UnicodeScript" }
--           , argCType = Just "GUnicodeScript"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The GUnicodeScript identifier to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "script_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_glib_script_to_script" hb_glib_script_to_script :: 
    CInt ->                                 -- script : TInterface (Name {namespace = "GLib", name = "UnicodeScript"})
    IO CUInt

-- | Fetches the t'GI.HarfBuzz.Enums.ScriptT' script that corresponds to the
-- specified GUnicodeScript identifier.
-- 
-- /Since: 0.9.38/
glibScriptToScript ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Enums.UnicodeScript
    -- ^ /@script@/: The GUnicodeScript identifier to query
    -> m HarfBuzz.Enums.ScriptT
    -- ^ __Returns:__ the t'GI.HarfBuzz.Enums.ScriptT' script found
glibScriptToScript script = liftIO $ do
    let script' = (fromIntegral . fromEnum) script
    result <- hb_glib_script_to_script script'
    let result' = (toEnum . fromIntegral) result
    return result'


-- function glib_script_from_script
-- Args: [ Arg
--           { argCName = "script"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "script_t" }
--           , argCType = Just "hb_script_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_script_t to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "GLib" , name = "UnicodeScript" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_glib_script_from_script" hb_glib_script_from_script :: 
    CUInt ->                                -- script : TInterface (Name {namespace = "HarfBuzz", name = "script_t"})
    IO CInt

-- | Fetches the GUnicodeScript identifier that corresponds to the
-- specified t'GI.HarfBuzz.Enums.ScriptT' script.
-- 
-- /Since: 0.9.38/
glibScriptFromScript ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.Enums.ScriptT
    -- ^ /@script@/: The t'GI.HarfBuzz.Enums.ScriptT' to query
    -> m GLib.Enums.UnicodeScript
    -- ^ __Returns:__ the GUnicodeScript identifier found
glibScriptFromScript script = liftIO $ do
    let script' = (fromIntegral . fromEnum) script
    result <- hb_glib_script_from_script script'
    let result' = (toEnum . fromIntegral) result
    return result'


-- function glib_get_unicode_funcs
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_glib_get_unicode_funcs" hb_glib_get_unicode_funcs :: 
    IO (Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT)

-- | Fetches a Unicode-functions structure that is populated
-- with the appropriate GLib function for each method.
-- 
-- /Since: 0.9.38/
glibGetUnicodeFuncs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ __Returns:__ a pointer to the t'GI.HarfBuzz.Structs.UnicodeFuncsT.UnicodeFuncsT' Unicode-functions structure
glibGetUnicodeFuncs  = liftIO $ do
    result <- hb_glib_get_unicode_funcs
    checkUnexpectedReturnNULL "glibGetUnicodeFuncs" result
    result' <- (newBoxed HarfBuzz.UnicodeFuncsT.UnicodeFuncsT) result
    return result'


-- function glib_blob_create
-- Args: [ Arg
--           { argCName = "gbytes"
--           , argType = TInterface Name { namespace = "GLib" , name = "Bytes" }
--           , argCType = Just "GBytes*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the GBytes structure to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "blob_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_glib_blob_create" hb_glib_blob_create :: 
    Ptr GLib.Bytes.Bytes ->                 -- gbytes : TInterface (Name {namespace = "GLib", name = "Bytes"})
    IO (Ptr HarfBuzz.BlobT.BlobT)

-- | Creates an t'GI.HarfBuzz.Structs.BlobT.BlobT' blob from the specified
-- GBytes data structure.
-- 
-- /Since: 0.9.38/
glibBlobCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Bytes.Bytes
    -- ^ /@gbytes@/: the GBytes structure to work upon
    -> m HarfBuzz.BlobT.BlobT
    -- ^ __Returns:__ the new t'GI.HarfBuzz.Structs.BlobT.BlobT' blob object
glibBlobCreate gbytes = liftIO $ do
    gbytes' <- unsafeManagedPtrGetPtr gbytes
    result <- hb_glib_blob_create gbytes'
    checkUnexpectedReturnNULL "glibBlobCreate" result
    result' <- (wrapBoxed HarfBuzz.BlobT.BlobT) result
    touchManagedPtr gbytes
    return result'


-- function ft_hb_font_changed
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ft_hb_font_changed" hb_ft_hb_font_changed :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO Int32

-- | Refreshes the state of the underlying FT_Face of /@font@/ when the hb_font_t
-- /@font@/ has changed.
-- This function should be called after changing the size or
-- variation-axis settings on the /@font@/.
-- This call is fast if nothing has changed on /@font@/.
-- 
-- Note that as of version 11.0.0, calling this function is not necessary,
-- as HarfBuzz will automatically detect changes to the font and update
-- the underlying FT_Face as needed.
-- 
-- /Since: 4.4.0/
ftHbFontChanged ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m Int32
    -- ^ __Returns:__ true if changed, false otherwise
ftHbFontChanged font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_ft_hb_font_changed font'
    touchManagedPtr font
    return result


-- function ft_font_set_load_flags
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "load_flags"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The FreeType load flags to set"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_ft_font_set_load_flags" hb_ft_font_set_load_flags :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Int32 ->                                -- load_flags : TBasicType TInt
    IO ()

-- | Sets the FT_Load_Glyph load flags for the specified t'GI.HarfBuzz.Structs.FontT.FontT'.
-- 
-- For more information, see
-- \<https:\/\/freetype.org\/freetype2\/docs\/reference\/ft2-glyph_retrieval.html@/ft_load_xxx/@>
-- 
-- This function works with t'GI.HarfBuzz.Structs.FontT.FontT' objects created by
-- 'GI.HarfBuzz.Functions.ftFontCreate' or 'GI.HarfBuzz.Functions.ftFontCreateReferenced'.
-- 
-- /Since: 1.0.5/
ftFontSetLoadFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Int32
    -- ^ /@loadFlags@/: The FreeType load flags to set
    -> m ()
ftFontSetLoadFlags font loadFlags = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    hb_ft_font_set_load_flags font' loadFlags
    touchManagedPtr font
    return ()


-- function ft_font_set_funcs
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_ft_font_set_funcs" hb_ft_font_set_funcs :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO ()

-- | Configures the font-functions structure of the specified
-- t'GI.HarfBuzz.Structs.FontT.FontT' font object to use FreeType font functions.
-- 
-- In particular, you can use this function to configure an
-- existing t'GI.HarfBuzz.Structs.FaceT.FaceT' face object for use with FreeType font
-- functions even if that t'GI.HarfBuzz.Structs.FaceT.FaceT' face object was initially
-- created with 'GI.HarfBuzz.Functions.faceCreate', and therefore was not
-- initially configured to use FreeType font functions.
-- 
-- An t'GI.HarfBuzz.Structs.FontT.FontT' object created with 'GI.HarfBuzz.Functions.ftFontCreate'
-- is preconfigured for FreeType font functions and does not
-- require this function to be used.
-- 
-- Note that if you modify the underlying t'GI.HarfBuzz.Structs.FontT.FontT' after
-- calling this function, you need to call 'GI.HarfBuzz.Functions.ftHbFontChanged'
-- to update the underlying FT_Face.
-- 
-- \<note>Note: Internally, this function creates an FT_Face.
-- \<\/note>
-- 
-- /Since: 1.0.5/
ftFontSetFuncs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m ()
ftFontSetFuncs font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    hb_ft_font_set_funcs font'
    touchManagedPtr font
    return ()


-- function ft_font_get_load_flags
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_ft_font_get_load_flags" hb_ft_font_get_load_flags :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO Int32

-- | Fetches the FT_Load_Glyph load flags of the specified t'GI.HarfBuzz.Structs.FontT.FontT'.
-- 
-- For more information, see
-- \<https:\/\/freetype.org\/freetype2\/docs\/reference\/ft2-glyph_retrieval.html@/ft_load_xxx/@>
-- 
-- This function works with t'GI.HarfBuzz.Structs.FontT.FontT' objects created by
-- 'GI.HarfBuzz.Functions.ftFontCreate' or 'GI.HarfBuzz.Functions.ftFontCreateReferenced'.
-- 
-- /Since: 1.0.5/
ftFontGetLoadFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m Int32
    -- ^ __Returns:__ FT_Load_Glyph flags found, or 0
ftFontGetLoadFlags font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_ft_font_get_load_flags font'
    touchManagedPtr font
    return result


-- function ft_font_create_referenced
-- Args: [ Arg
--           { argCName = "ft_face"
--           , argType =
--               TInterface Name { namespace = "freetype2" , name = "Face" }
--           , argCType = Just "FT_Face"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "FT_Face to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "font_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ft_font_create_referenced" hb_ft_font_create_referenced :: 
    Ptr Freetype2.Face.Face ->              -- ft_face : TInterface (Name {namespace = "freetype2", name = "Face"})
    IO (Ptr HarfBuzz.FontT.FontT)

-- | Creates an t'GI.HarfBuzz.Structs.FontT.FontT' font object from the specified FT_Face.
-- 
-- \<note>Note: You must set the face size on /@ftFace@/ before calling
-- 'GI.HarfBuzz.Functions.ftFontCreateReferenced' on it. HarfBuzz assumes size is always set
-- and will access @size@ member of FT_Face unconditionally.\<\/note>
-- 
-- This is the preferred variant of the hb_ft_font_create*
-- function family, because it calls @/FT_Reference_Face()/@ on /@ftFace@/,
-- ensuring that /@ftFace@/ remains alive as long as the resulting
-- t'GI.HarfBuzz.Structs.FontT.FontT' font object remains alive.
-- 
-- Use this version unless you know you have good reasons not to.
-- 
-- /Since: 0.9.38/
ftFontCreateReferenced ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Freetype2.Face.Face
    -- ^ /@ftFace@/: FT_Face to work upon
    -> m HarfBuzz.FontT.FontT
    -- ^ __Returns:__ the new t'GI.HarfBuzz.Structs.FontT.FontT' font object
ftFontCreateReferenced ftFace = liftIO $ do
    ftFace' <- unsafeManagedPtrGetPtr ftFace
    result <- hb_ft_font_create_referenced ftFace'
    checkUnexpectedReturnNULL "ftFontCreateReferenced" result
    result' <- (wrapBoxed HarfBuzz.FontT.FontT) result
    touchManagedPtr ftFace
    return result'


-- function ft_font_create
-- Args: [ Arg
--           { argCName = "ft_face"
--           , argType =
--               TInterface Name { namespace = "freetype2" , name = "Face" }
--           , argCType = Just "FT_Face"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "FT_Face to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "destroy"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "destroy_func_t" }
--           , argCType = Just "hb_destroy_func_t"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "A callback to call when the font object is not needed anymore"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "font_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ft_font_create" hb_ft_font_create :: 
    Ptr Freetype2.Face.Face ->              -- ft_face : TInterface (Name {namespace = "freetype2", name = "Face"})
    FunPtr HarfBuzz.Callbacks.C_DestroyFuncT -> -- destroy : TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})
    IO (Ptr HarfBuzz.FontT.FontT)

-- | Creates an t'GI.HarfBuzz.Structs.FontT.FontT' font object from the specified FT_Face.
-- 
-- \<note>Note: You must set the face size on /@ftFace@/ before calling
-- 'GI.HarfBuzz.Functions.ftFontCreate' on it. HarfBuzz assumes size is always set and will
-- access @size@ member of FT_Face unconditionally.\<\/note>
-- 
-- This variant of the function does not provide any life-cycle management.
-- 
-- Most client programs should use 'GI.HarfBuzz.Functions.ftFontCreateReferenced'
-- instead.
-- 
-- If you know you have valid reasons not to use 'GI.HarfBuzz.Functions.ftFontCreateReferenced',
-- then it is the client program\'s responsibility to destroy /@ftFace@/
-- only after the t'GI.HarfBuzz.Structs.FontT.FontT' font object has been destroyed.
-- 
-- HarfBuzz will use the /@destroy@/ callback on the t'GI.HarfBuzz.Structs.FontT.FontT' font object
-- if it is supplied when you use this function. However, even if /@destroy@/
-- is provided, it is the client program\'s responsibility to destroy /@ftFace@/,
-- and it is the client program\'s responsibility to ensure that /@ftFace@/ is
-- destroyed only after the t'GI.HarfBuzz.Structs.FontT.FontT' font object has been destroyed.
-- 
-- /Since: 0.9.2/
ftFontCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Freetype2.Face.Face
    -- ^ /@ftFace@/: FT_Face to work upon
    -> Maybe (HarfBuzz.Callbacks.DestroyFuncT)
    -- ^ /@destroy@/: A callback to call when the font object is not needed anymore
    -> m HarfBuzz.FontT.FontT
    -- ^ __Returns:__ the new t'GI.HarfBuzz.Structs.FontT.FontT' font object
ftFontCreate ftFace destroy = liftIO $ do
    ftFace' <- unsafeManagedPtrGetPtr ftFace
    maybeDestroy <- case destroy of
        Nothing -> return FP.nullFunPtr
        Just jDestroy -> do
            ptrdestroy <- callocMem :: IO (Ptr (FunPtr HarfBuzz.Callbacks.C_DestroyFuncT))
            jDestroy' <- HarfBuzz.Callbacks.mk_DestroyFuncT (HarfBuzz.Callbacks.wrap_DestroyFuncT (Just ptrdestroy) (HarfBuzz.Callbacks.drop_closures_DestroyFuncT jDestroy))
            poke ptrdestroy jDestroy'
            return jDestroy'
    result <- hb_ft_font_create ftFace' maybeDestroy
    checkUnexpectedReturnNULL "ftFontCreate" result
    result' <- (wrapBoxed HarfBuzz.FontT.FontT) result
    touchManagedPtr ftFace
    return result'


-- function ft_font_changed
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_ft_font_changed" hb_ft_font_changed :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO ()

-- | Refreshes the state of /@font@/ when the underlying FT_Face has changed.
-- This function should be called after changing the size or
-- variation-axis settings on the FT_Face.
-- 
-- /Since: 1.0.5/
ftFontChanged ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m ()
ftFontChanged font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    hb_ft_font_changed font'
    touchManagedPtr font
    return ()


-- function ft_face_create_referenced
-- Args: [ Arg
--           { argCName = "ft_face"
--           , argType =
--               TInterface Name { namespace = "freetype2" , name = "Face" }
--           , argCType = Just "FT_Face"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "FT_Face to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "face_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ft_face_create_referenced" hb_ft_face_create_referenced :: 
    Ptr Freetype2.Face.Face ->              -- ft_face : TInterface (Name {namespace = "freetype2", name = "Face"})
    IO (Ptr HarfBuzz.FaceT.FaceT)

-- | Creates an t'GI.HarfBuzz.Structs.FaceT.FaceT' face object from the specified FT_Face.
-- 
-- Note that this is using the FT_Face object just to get at the underlying
-- font data, and fonts created from the returned t'GI.HarfBuzz.Structs.FaceT.FaceT' will use the native
-- HarfBuzz font implementation, unless you call 'GI.HarfBuzz.Functions.ftFontSetFuncs' on them.
-- 
-- This is the preferred variant of the hb_ft_face_create*
-- function family, because it calls @/FT_Reference_Face()/@ on /@ftFace@/,
-- ensuring that /@ftFace@/ remains alive as long as the resulting
-- t'GI.HarfBuzz.Structs.FaceT.FaceT' face object remains alive. Also calls @/FT_Done_Face()/@
-- when the t'GI.HarfBuzz.Structs.FaceT.FaceT' face object is destroyed.
-- 
-- Use this version unless you know you have good reasons not to.
-- 
-- /Since: 0.9.38/
ftFaceCreateReferenced ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Freetype2.Face.Face
    -- ^ /@ftFace@/: FT_Face to work upon
    -> m HarfBuzz.FaceT.FaceT
    -- ^ __Returns:__ the new t'GI.HarfBuzz.Structs.FaceT.FaceT' face object
ftFaceCreateReferenced ftFace = liftIO $ do
    ftFace' <- unsafeManagedPtrGetPtr ftFace
    result <- hb_ft_face_create_referenced ftFace'
    checkUnexpectedReturnNULL "ftFaceCreateReferenced" result
    result' <- (wrapBoxed HarfBuzz.FaceT.FaceT) result
    touchManagedPtr ftFace
    return result'


-- function ft_face_create_from_file_or_fail
-- Args: [ Arg
--           { argCName = "file_name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A font filename" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the face within the file"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "face_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ft_face_create_from_file_or_fail" hb_ft_face_create_from_file_or_fail :: 
    CString ->                              -- file_name : TBasicType TUTF8
    Word32 ->                               -- index : TBasicType TUInt
    IO (Ptr HarfBuzz.FaceT.FaceT)

-- | Creates an t'GI.HarfBuzz.Structs.FaceT.FaceT' face object from the specified
-- font file and face index.
-- 
-- This is similar in functionality to 'GI.HarfBuzz.Functions.faceCreateFromFileOrFail',
-- but uses the FreeType library for loading the font file. This can
-- be useful, for example, to load WOFF and WOFF2 font data.
-- 
-- /Since: 10.1.0/
ftFaceCreateFromFileOrFail ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@fileName@/: A font filename
    -> Word32
    -- ^ /@index@/: The index of the face within the file
    -> m HarfBuzz.FaceT.FaceT
    -- ^ __Returns:__ The new face object, or @NULL@ if
    -- no face is found at the specified index or the file cannot be read.
ftFaceCreateFromFileOrFail fileName index = liftIO $ do
    fileName' <- textToCString fileName
    result <- hb_ft_face_create_from_file_or_fail fileName' index
    checkUnexpectedReturnNULL "ftFaceCreateFromFileOrFail" result
    result' <- (wrapBoxed HarfBuzz.FaceT.FaceT) result
    freeMem fileName'
    return result'


-- function ft_face_create_from_blob_or_fail
-- Args: [ Arg
--           { argCName = "blob"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A blob" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the face within the blob"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "face_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ft_face_create_from_blob_or_fail" hb_ft_face_create_from_blob_or_fail :: 
    Ptr HarfBuzz.BlobT.BlobT ->             -- blob : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    Word32 ->                               -- index : TBasicType TUInt
    IO (Ptr HarfBuzz.FaceT.FaceT)

-- | Creates an t'GI.HarfBuzz.Structs.FaceT.FaceT' face object from the specified
-- font blob and face index.
-- 
-- This is similar in functionality to 'GI.HarfBuzz.Functions.faceCreateOrFail',
-- but uses the FreeType library for loading the font blob. This can
-- be useful, for example, to load WOFF and WOFF2 font data.
-- 
-- /Since: 11.0.0/
ftFaceCreateFromBlobOrFail ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BlobT.BlobT
    -- ^ /@blob@/: A blob
    -> Word32
    -- ^ /@index@/: The index of the face within the blob
    -> m HarfBuzz.FaceT.FaceT
    -- ^ __Returns:__ The new face object, or @NULL@ if
    -- loading fails (eg. blob does not contain valid font data).
ftFaceCreateFromBlobOrFail blob index = liftIO $ do
    blob' <- unsafeManagedPtrGetPtr blob
    result <- hb_ft_face_create_from_blob_or_fail blob' index
    checkUnexpectedReturnNULL "ftFaceCreateFromBlobOrFail" result
    result' <- (wrapBoxed HarfBuzz.FaceT.FaceT) result
    touchManagedPtr blob
    return result'


-- function ft_face_create_cached
-- Args: [ Arg
--           { argCName = "ft_face"
--           , argType =
--               TInterface Name { namespace = "freetype2" , name = "Face" }
--           , argCType = Just "FT_Face"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "FT_Face to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "face_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ft_face_create_cached" hb_ft_face_create_cached :: 
    Ptr Freetype2.Face.Face ->              -- ft_face : TInterface (Name {namespace = "freetype2", name = "Face"})
    IO (Ptr HarfBuzz.FaceT.FaceT)

-- | Creates an t'GI.HarfBuzz.Structs.FaceT.FaceT' face object from the specified FT_Face.
-- 
-- Note that this is using the FT_Face object just to get at the underlying
-- font data, and fonts created from the returned t'GI.HarfBuzz.Structs.FaceT.FaceT' will use the native
-- HarfBuzz font implementation, unless you call 'GI.HarfBuzz.Functions.ftFontSetFuncs' on them.
-- 
-- This variant of the function caches the newly created t'GI.HarfBuzz.Structs.FaceT.FaceT'
-- face object, using the /@generic@/ pointer of /@ftFace@/. Subsequent function
-- calls that are passed the same /@ftFace@/ parameter will have the same
-- t'GI.HarfBuzz.Structs.FaceT.FaceT' returned to them, and that t'GI.HarfBuzz.Structs.FaceT.FaceT' will be correctly
-- reference counted.
-- 
-- However, client programs are still responsible for destroying
-- /@ftFace@/ after the last t'GI.HarfBuzz.Structs.FaceT.FaceT' face object has been destroyed.
-- 
-- /Since: 0.9.2/
ftFaceCreateCached ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Freetype2.Face.Face
    -- ^ /@ftFace@/: FT_Face to work upon
    -> m HarfBuzz.FaceT.FaceT
    -- ^ __Returns:__ the new t'GI.HarfBuzz.Structs.FaceT.FaceT' face object
ftFaceCreateCached ftFace = liftIO $ do
    ftFace' <- unsafeManagedPtrGetPtr ftFace
    result <- hb_ft_face_create_cached ftFace'
    checkUnexpectedReturnNULL "ftFaceCreateCached" result
    result' <- (wrapBoxed HarfBuzz.FaceT.FaceT) result
    touchManagedPtr ftFace
    return result'


-- function ft_face_create
-- Args: [ Arg
--           { argCName = "ft_face"
--           , argType =
--               TInterface Name { namespace = "freetype2" , name = "Face" }
--           , argCType = Just "FT_Face"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "FT_Face to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "destroy"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "destroy_func_t" }
--           , argCType = Just "hb_destroy_func_t"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "A callback to call when the face object is not needed anymore"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "face_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_ft_face_create" hb_ft_face_create :: 
    Ptr Freetype2.Face.Face ->              -- ft_face : TInterface (Name {namespace = "freetype2", name = "Face"})
    FunPtr HarfBuzz.Callbacks.C_DestroyFuncT -> -- destroy : TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})
    IO (Ptr HarfBuzz.FaceT.FaceT)

-- | Creates an t'GI.HarfBuzz.Structs.FaceT.FaceT' face object from the specified FT_Face.
-- 
-- Note that this is using the FT_Face object just to get at the underlying
-- font data, and fonts created from the returned t'GI.HarfBuzz.Structs.FaceT.FaceT' will use the native
-- HarfBuzz font implementation, unless you call 'GI.HarfBuzz.Functions.ftFontSetFuncs' on them.
-- 
-- This variant of the function does not provide any life-cycle management.
-- 
-- Most client programs should use 'GI.HarfBuzz.Functions.ftFaceCreateReferenced'
-- (or, perhaps, 'GI.HarfBuzz.Functions.ftFaceCreateCached') instead.
-- 
-- If you know you have valid reasons not to use 'GI.HarfBuzz.Functions.ftFaceCreateReferenced',
-- then it is the client program\'s responsibility to destroy /@ftFace@/
-- after the t'GI.HarfBuzz.Structs.FaceT.FaceT' face object has been destroyed.
-- 
-- /Since: 0.9.2/
ftFaceCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Freetype2.Face.Face
    -- ^ /@ftFace@/: FT_Face to work upon
    -> Maybe (HarfBuzz.Callbacks.DestroyFuncT)
    -- ^ /@destroy@/: A callback to call when the face object is not needed anymore
    -> m HarfBuzz.FaceT.FaceT
    -- ^ __Returns:__ the new t'GI.HarfBuzz.Structs.FaceT.FaceT' face object
ftFaceCreate ftFace destroy = liftIO $ do
    ftFace' <- unsafeManagedPtrGetPtr ftFace
    maybeDestroy <- case destroy of
        Nothing -> return FP.nullFunPtr
        Just jDestroy -> do
            ptrdestroy <- callocMem :: IO (Ptr (FunPtr HarfBuzz.Callbacks.C_DestroyFuncT))
            jDestroy' <- HarfBuzz.Callbacks.mk_DestroyFuncT (HarfBuzz.Callbacks.wrap_DestroyFuncT (Just ptrdestroy) (HarfBuzz.Callbacks.drop_closures_DestroyFuncT jDestroy))
            poke ptrdestroy jDestroy'
            return jDestroy'
    result <- hb_ft_face_create ftFace' maybeDestroy
    checkUnexpectedReturnNULL "ftFaceCreate" result
    result' <- (wrapBoxed HarfBuzz.FaceT.FaceT) result
    touchManagedPtr ftFace
    return result'


-- function free
-- Args: [ Arg
--           { argCName = "ptr"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The pointer to the memory to free."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_free" hb_free :: 
    Ptr () ->                               -- ptr : TBasicType TPtr
    IO ()

-- | Frees the memory pointed to by /@ptr@/, using the allocator set at
-- compile-time. Typically just @/free()/@.
-- 
-- /Since: 11.0.0/
free ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    -- ^ /@ptr@/: The pointer to the memory to free.
    -> m ()
free ptr = liftIO $ do
    hb_free ptr
    return ()


-- function font_subtract_glyph_origin_for_direction
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The direction of the text segment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = The original X coordinate\n    Output = The X coordinate minus the X-coordinate of the origin"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = The original Y coordinate\n    Output = The Y coordinate minus the Y-coordinate of the origin"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_subtract_glyph_origin_for_direction" hb_font_subtract_glyph_origin_for_direction :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Ptr Int32 ->                            -- x : TBasicType TInt32
    Ptr Int32 ->                            -- y : TBasicType TInt32
    IO ()

-- | Subtracts the origin coordinates from an (X,Y) point coordinate,
-- in the specified glyph ID in the specified font.
-- 
-- Calls the appropriate direction-specific variant (horizontal
-- or vertical) depending on the value of /@direction@/.
-- 
-- /Since: 0.9.2/
fontSubtractGlyphOriginForDirection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: The direction of the text segment
    -> Int32
    -- ^ /@x@/: Input = The original X coordinate
    --     Output = The X coordinate minus the X-coordinate of the origin
    -> Int32
    -- ^ /@y@/: Input = The original Y coordinate
    --     Output = The Y coordinate minus the Y-coordinate of the origin
    -> m ((Int32, Int32))
fontSubtractGlyphOriginForDirection font glyph direction x y = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    x' <- allocMem :: IO (Ptr Int32)
    poke x' x
    y' <- allocMem :: IO (Ptr Int32)
    poke y' y
    hb_font_subtract_glyph_origin_for_direction font' glyph direction' x' y'
    x'' <- peek x'
    y'' <- peek y'
    touchManagedPtr font
    freeMem x'
    freeMem y'
    return (x'', y'')


-- function font_set_variations
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "variations"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 2
--                 (TInterface Name { namespace = "HarfBuzz" , name = "variation_t" })
--           , argCType = Just "const hb_variation_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Array of variation settings to apply"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "variations_length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Number of variations to apply"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "variations_length"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Number of variations to apply"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_variations" hb_font_set_variations :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr HarfBuzz.VariationT.VariationT ->   -- variations : TCArray False (-1) 2 (TInterface (Name {namespace = "HarfBuzz", name = "variation_t"}))
    Word32 ->                               -- variations_length : TBasicType TUInt
    IO ()

-- | Applies a list of font-variation settings to a font.
-- 
-- Note that this overrides all existing variations set on /@font@/.
-- Axes not included in /@variations@/ will be effectively set to their
-- default values.
-- 
-- /Since: 1.4.2/
fontSetVariations ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> [HarfBuzz.VariationT.VariationT]
    -- ^ /@variations@/: Array of variation settings to apply
    -> m ()
fontSetVariations font variations = liftIO $ do
    let variationsLength = fromIntegral $ P.length variations
    font' <- unsafeManagedPtrGetPtr font
    variations' <- mapM unsafeManagedPtrGetPtr variations
    variations'' <- packBlockArray 8 variations'
    hb_font_set_variations font' variations'' variationsLength
    touchManagedPtr font
    mapM_ touchManagedPtr variations
    freeMem variations''
    return ()


-- function font_set_variation
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_tag_t tag of the variation-axis name"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The value of the variation axis"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_variation" hb_font_set_variation :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- tag : TBasicType TUInt32
    CFloat ->                               -- value : TBasicType TFloat
    IO ()

-- | Change the value of one variation axis on the font.
-- 
-- Note: This function is expensive to be called repeatedly.
--   If you want to set multiple variation axes at the same time,
--   use 'GI.HarfBuzz.Functions.fontSetVariations' instead.
-- 
-- /Since: 7.1.0/
fontSetVariation ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@tag@/: The @/hb_tag_t/@ tag of the variation-axis name
    -> Float
    -- ^ /@value@/: The value of the variation axis
    -> m ()
fontSetVariation font tag value = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let value' = realToFrac value
    hb_font_set_variation font' tag value'
    touchManagedPtr font
    return ()


-- function font_set_var_named_instance
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a font." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "instance_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "named instance index."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_var_named_instance" hb_font_set_var_named_instance :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- instance_index : TBasicType TUInt
    IO ()

-- | Sets design coords of a font from a named-instance index.
-- 
-- /Since: 2.6.0/
fontSetVarNamedInstance ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: a font.
    -> Word32
    -- ^ /@instanceIndex@/: named instance index.
    -> m ()
fontSetVarNamedInstance font instanceIndex = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    hb_font_set_var_named_instance font' instanceIndex
    touchManagedPtr font
    return ()


-- function font_set_var_coords_normalized
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coords"
--           , argType = TCArray False (-1) 2 (TBasicType TInt)
--           , argCType = Just "const int*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Array of variation coordinates to apply"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coords_length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Number of coordinates to apply"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "coords_length"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Number of coordinates to apply"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_var_coords_normalized" hb_font_set_var_coords_normalized :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr Int32 ->                            -- coords : TCArray False (-1) 2 (TBasicType TInt)
    Word32 ->                               -- coords_length : TBasicType TUInt
    IO ()

-- | Applies a list of variation coordinates (in normalized units)
-- to a font.
-- 
-- Note that this overrides all existing variations set on /@font@/.
-- Axes not included in /@coords@/ will be effectively set to their
-- default values.
-- 
-- \<note>Note: Coordinates should be normalized to 2.14.\<\/note>
-- 
-- /Since: 1.4.2/
fontSetVarCoordsNormalized ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> [Int32]
    -- ^ /@coords@/: Array of variation coordinates to apply
    -> m ()
fontSetVarCoordsNormalized font coords = liftIO $ do
    let coordsLength = fromIntegral $ P.length coords
    font' <- unsafeManagedPtrGetPtr font
    coords' <- packStorableArray coords
    hb_font_set_var_coords_normalized font' coords' coordsLength
    touchManagedPtr font
    freeMem coords'
    return ()


-- function font_set_var_coords_design
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coords"
--           , argType = TCArray False (-1) 2 (TBasicType TFloat)
--           , argCType = Just "const float*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Array of variation coordinates to apply"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coords_length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Number of coordinates to apply"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "coords_length"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Number of coordinates to apply"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_var_coords_design" hb_font_set_var_coords_design :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr CFloat ->                           -- coords : TCArray False (-1) 2 (TBasicType TFloat)
    Word32 ->                               -- coords_length : TBasicType TUInt
    IO ()

-- | Applies a list of variation coordinates (in design-space units)
-- to a font.
-- 
-- Note that this overrides all existing variations set on /@font@/.
-- Axes not included in /@coords@/ will be effectively set to their
-- default values.
-- 
-- /Since: 1.4.2/
fontSetVarCoordsDesign ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> [Float]
    -- ^ /@coords@/: Array of variation coordinates to apply
    -> m ()
fontSetVarCoordsDesign font coords = liftIO $ do
    let coordsLength = fromIntegral $ P.length coords
    font' <- unsafeManagedPtrGetPtr font
    coords' <- (packMapStorableArray realToFrac) coords
    hb_font_set_var_coords_design font' coords' coordsLength
    touchManagedPtr font
    freeMem coords'
    return ()


-- function font_set_synthetic_slant
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "slant"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "synthetic slant value."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_synthetic_slant" hb_font_set_synthetic_slant :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CFloat ->                               -- slant : TBasicType TFloat
    IO ()

-- | Sets the \"synthetic slant\" of a font.  By default is zero.
-- Synthetic slant is the graphical skew applied to the font
-- at rendering time.
-- 
-- HarfBuzz needs to know this value to adjust shaping results,
-- metrics, and style values to match the slanted rendering.
-- 
-- \<note>Note: The glyph shape fetched via the 'GI.HarfBuzz.Functions.fontDrawGlyphOrFail'
-- function is slanted to reflect this value as well.\<\/note>
-- 
-- \<note>Note: The slant value is a ratio.  For example, a
-- 20% slant would be represented as a 0.2 value.\<\/note>
-- 
-- /Since: 3.3.0/
fontSetSyntheticSlant ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Float
    -- ^ /@slant@/: synthetic slant value.
    -> m ()
fontSetSyntheticSlant font slant = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let slant' = realToFrac slant
    hb_font_set_synthetic_slant font' slant'
    touchManagedPtr font
    return ()


-- function font_set_synthetic_bold
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x_embolden"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the amount to embolden horizontally"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y_embolden"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the amount to embolden vertically"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "in_place"
--           , argType = TBasicType TInt
--           , argCType = Just "hb_bool_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "whether to embolden glyphs in-place"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_synthetic_bold" hb_font_set_synthetic_bold :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CFloat ->                               -- x_embolden : TBasicType TFloat
    CFloat ->                               -- y_embolden : TBasicType TFloat
    Int32 ->                                -- in_place : TBasicType TInt
    IO ()

-- | Sets the \"synthetic boldness\" of a font.
-- 
-- Positive values for /@xEmbolden@/ \/ /@yEmbolden@/ make a font
-- bolder, negative values thinner. Typical values are in the
-- 0.01 to 0.05 range. The default value is zero.
-- 
-- Synthetic boldness is applied by offsetting the contour
-- points of the glyph shape.
-- 
-- Synthetic boldness is applied when rendering a glyph via
-- 'GI.HarfBuzz.Functions.fontDrawGlyphOrFail'.
-- 
-- If /@inPlace@/ is @false@, then glyph advance-widths are also
-- adjusted, otherwise they are not.  The in-place mode is
-- useful for simulating <https://fonts.google.com/knowledge/glossary/grade font grading>.
-- 
-- /Since: 7.0.0/
fontSetSyntheticBold ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Float
    -- ^ /@xEmbolden@/: the amount to embolden horizontally
    -> Float
    -- ^ /@yEmbolden@/: the amount to embolden vertically
    -> Int32
    -- ^ /@inPlace@/: whether to embolden glyphs in-place
    -> m ()
fontSetSyntheticBold font xEmbolden yEmbolden inPlace = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let xEmbolden' = realToFrac xEmbolden
    let yEmbolden' = realToFrac yEmbolden
    hb_font_set_synthetic_bold font' xEmbolden' yEmbolden' inPlace
    touchManagedPtr font
    return ()


-- function font_set_scale
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x_scale"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Horizontal scale value to assign"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y_scale"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Vertical scale value to assign"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_scale" hb_font_set_scale :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Int32 ->                                -- x_scale : TBasicType TInt
    Int32 ->                                -- y_scale : TBasicType TInt
    IO ()

-- | Sets the horizontal and vertical scale of a font.
-- 
-- The font scale is a number related to, but not the same as,
-- font size. Typically the client establishes a scale factor
-- to be used between the two. For example, 64, or 256, which
-- would be the fractional-precision part of the font scale.
-- This is necessary because @/hb_position_t/@ values are integer
-- types and you need to leave room for fractional values
-- in there.
-- 
-- For example, to set the font size to 20, with 64
-- levels of fractional precision you would call
-- @hb_font_set_scale(font, 20 * 64, 20 * 64)@.
-- 
-- In the example above, even what font size 20 means is up to
-- you. It might be 20 pixels, or 20 points, or 20 millimeters.
-- HarfBuzz does not care about that.  You can set the point
-- size of the font using 'GI.HarfBuzz.Functions.fontSetPtem', and the pixel
-- size using 'GI.HarfBuzz.Functions.fontSetPpem'.
-- 
-- The choice of scale is yours but needs to be consistent between
-- what you set here, and what you expect out of @/hb_position_t/@
-- as well has draw \/ paint API output values.
-- 
-- Fonts default to a scale equal to the UPEM value of their face.
-- A font with this setting is sometimes called an \"unscaled\" font.
-- 
-- /Since: 0.9.2/
fontSetScale ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Int32
    -- ^ /@xScale@/: Horizontal scale value to assign
    -> Int32
    -- ^ /@yScale@/: Vertical scale value to assign
    -> m ()
fontSetScale font xScale yScale = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    hb_font_set_scale font' xScale yScale
    touchManagedPtr font
    return ()


-- function font_set_ptem
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "ptem"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "font size in points."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_ptem" hb_font_set_ptem :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CFloat ->                               -- ptem : TBasicType TFloat
    IO ()

-- | Sets the \"point size\" of a font. Set to zero to unset.
-- Used in CoreText to implement optical sizing.
-- 
-- \<note>Note: There are 72 points in an inch.\<\/note>
-- 
-- /Since: 1.6.0/
fontSetPtem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Float
    -- ^ /@ptem@/: font size in points.
    -> m ()
fontSetPtem font ptem = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let ptem' = realToFrac ptem
    hb_font_set_ptem font' ptem'
    touchManagedPtr font
    return ()


-- function font_set_ppem
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x_ppem"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Horizontal ppem value to assign"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y_ppem"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Vertical ppem value to assign"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_ppem" hb_font_set_ppem :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- x_ppem : TBasicType TUInt
    Word32 ->                               -- y_ppem : TBasicType TUInt
    IO ()

-- | Sets the horizontal and vertical pixels-per-em (PPEM) of a font.
-- 
-- These values are used for pixel-size-specific adjustment to
-- shaping and draw results, though for the most part they are
-- unused and can be left unset.
-- 
-- /Since: 0.9.2/
fontSetPpem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@xPpem@/: Horizontal ppem value to assign
    -> Word32
    -- ^ /@yPpem@/: Vertical ppem value to assign
    -> m ()
fontSetPpem font xPpem yPpem = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    hb_font_set_ppem font' xPpem yPpem
    touchManagedPtr font
    return ()


-- function font_set_parent
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "parent"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The parent font object to assign"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_parent" hb_font_set_parent :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr HarfBuzz.FontT.FontT ->             -- parent : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO ()

-- | Sets the parent font of /@font@/.
-- 
-- /Since: 1.0.5/
fontSetParent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> HarfBuzz.FontT.FontT
    -- ^ /@parent@/: The parent font object to assign
    -> m ()
fontSetParent font parent = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    parent' <- unsafeManagedPtrGetPtr parent
    hb_font_set_parent font' parent'
    touchManagedPtr font
    touchManagedPtr parent
    return ()


-- function font_set_funcs_using
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The name of the font-functions structure to use, or `NULL`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_funcs_using" hb_font_set_funcs_using :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CString ->                              -- name : TBasicType TUTF8
    IO Int32

-- | Sets the font-functions structure to use for a font, based on the
-- specified name.
-- 
-- If /@name@/ is @NULL@ or the empty string, the default (first) functioning font-functions
-- are used.  This default can be changed by setting the @HB_FONT_FUNCS@ environment
-- variable to the name of the desired font-functions.
-- 
-- /Since: 11.0.0/
fontSetFuncsUsing ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> T.Text
    -- ^ /@name@/: The name of the font-functions structure to use, or @NULL@
    -> m Int32
    -- ^ __Returns:__ @true@ if the font-functions was found and set, @false@ otherwise
fontSetFuncsUsing font name = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    name' <- textToCString name
    result <- hb_font_set_funcs_using font' name'
    touchManagedPtr font
    freeMem name'
    return result


-- function font_set_funcs_data
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "font_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Data to attach to @font"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "destroy"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "destroy_func_t" }
--           , argCType = Just "hb_destroy_func_t"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The function to call when @font_data is not needed anymore"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_funcs_data" hb_font_set_funcs_data :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr () ->                               -- font_data : TBasicType TPtr
    FunPtr HarfBuzz.Callbacks.C_DestroyFuncT -> -- destroy : TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})
    IO ()

-- | Replaces the user data attached to a font, updating the font\'s
-- /@destroy@/ callback.
-- 
-- /Since: 0.9.2/
fontSetFuncsData ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Maybe (HarfBuzz.Callbacks.DestroyFuncT)
    -- ^ /@destroy@/: The function to call when /@fontData@/ is not needed anymore
    -> m ()
fontSetFuncsData font destroy = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    maybeDestroy <- case destroy of
        Nothing -> return FP.nullFunPtr
        Just jDestroy -> do
            ptrdestroy <- callocMem :: IO (Ptr (FunPtr HarfBuzz.Callbacks.C_DestroyFuncT))
            jDestroy' <- HarfBuzz.Callbacks.mk_DestroyFuncT (HarfBuzz.Callbacks.wrap_DestroyFuncT (Just ptrdestroy) (HarfBuzz.Callbacks.drop_closures_DestroyFuncT jDestroy))
            poke ptrdestroy jDestroy'
            return jDestroy'
    let fontData = nullPtr
    hb_font_set_funcs_data font' fontData maybeDestroy
    touchManagedPtr font
    return ()


-- function font_set_funcs
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "klass"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_funcs_t" }
--           , argCType = Just "hb_font_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The font-functions structure."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "font_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Data to attach to @font"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "destroy"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "destroy_func_t" }
--           , argCType = Just "hb_destroy_func_t"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The function to call when @font_data is not needed anymore"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_funcs" hb_font_set_funcs :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr HarfBuzz.FontFuncsT.FontFuncsT ->   -- klass : TInterface (Name {namespace = "HarfBuzz", name = "font_funcs_t"})
    Ptr () ->                               -- font_data : TBasicType TPtr
    FunPtr HarfBuzz.Callbacks.C_DestroyFuncT -> -- destroy : TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})
    IO ()

-- | Replaces the font-functions structure attached to a font, updating
-- the font\'s user-data with /@font@/-data and the /@destroy@/ callback.
-- 
-- /Since: 0.9.2/
fontSetFuncs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> HarfBuzz.FontFuncsT.FontFuncsT
    -- ^ /@klass@/: The font-functions structure.
    -> Maybe (HarfBuzz.Callbacks.DestroyFuncT)
    -- ^ /@destroy@/: The function to call when /@fontData@/ is not needed anymore
    -> m ()
fontSetFuncs font klass destroy = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    klass' <- unsafeManagedPtrGetPtr klass
    maybeDestroy <- case destroy of
        Nothing -> return FP.nullFunPtr
        Just jDestroy -> do
            ptrdestroy <- callocMem :: IO (Ptr (FunPtr HarfBuzz.Callbacks.C_DestroyFuncT))
            jDestroy' <- HarfBuzz.Callbacks.mk_DestroyFuncT (HarfBuzz.Callbacks.wrap_DestroyFuncT (Just ptrdestroy) (HarfBuzz.Callbacks.drop_closures_DestroyFuncT jDestroy))
            poke ptrdestroy jDestroy'
            return jDestroy'
    let fontData = nullPtr
    hb_font_set_funcs font' klass' fontData maybeDestroy
    touchManagedPtr font
    touchManagedPtr klass
    return ()


-- function font_set_face
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_face_t to assign"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_set_face" hb_font_set_face :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO ()

-- | Sets /@face@/ as the font-face value of /@font@/.
-- 
-- /Since: 1.4.3/
fontSetFace ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: The t'GI.HarfBuzz.Structs.FaceT.FaceT' to assign
    -> m ()
fontSetFace font face = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    face' <- unsafeManagedPtrGetPtr face
    hb_font_set_face font' face'
    touchManagedPtr font
    touchManagedPtr face
    return ()


-- function font_paint_glyph_or_fail
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_paint_funcs_t to paint with"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "User data to pass to paint callbacks"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "palette_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the font's color palette to use"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "foreground"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_color_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The foreground color, unpremultipled"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_paint_glyph_or_fail" hb_font_paint_glyph_or_fail :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- pfuncs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Word32 ->                               -- palette_index : TBasicType TUInt
    Word32 ->                               -- foreground : TBasicType TUInt32
    IO Int32

-- | Paints a color glyph.
-- 
-- Succeeds if /@glyph@/ has color paint layers (COLRv0),
-- a color paint graph (COLRv1), or a bitmap image that the
-- font\'s callbacks render successfully.  Returns @false@ if
-- the font has no color data for /@glyph@/; the client can then
-- fall back to 'GI.HarfBuzz.Functions.fontDrawGlyphOrFail' for the monochrome
-- outline.
-- 
-- The painting instructions are returned by way of calls to
-- the callbacks of the /@funcs@/ object, with /@paintData@/ passed
-- to them.
-- 
-- If the font has color palettes (see 'GI.HarfBuzz.Functions.otColorHasPalettes'),
-- then /@paletteIndex@/ selects the palette to use. If the font only
-- has one palette, this will be 0.
-- 
-- /Since: 11.2.0/
fontPaintGlyphOrFail ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID
    -> HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@pfuncs@/: t'GI.HarfBuzz.Structs.PaintFuncsT.PaintFuncsT' to paint with
    -> Ptr ()
    -- ^ /@paintData@/: User data to pass to paint callbacks
    -> Word32
    -- ^ /@paletteIndex@/: The index of the font\'s color palette to use
    -> Word32
    -- ^ /@foreground@/: The foreground color, unpremultipled
    -> m Int32
    -- ^ __Returns:__ @true@ if glyph was painted, @false@ otherwise
fontPaintGlyphOrFail font glyph pfuncs paintData paletteIndex foreground = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    pfuncs' <- unsafeManagedPtrGetPtr pfuncs
    result <- hb_font_paint_glyph_or_fail font' glyph pfuncs' paintData paletteIndex foreground
    touchManagedPtr font
    touchManagedPtr pfuncs
    return result


-- function font_paint_glyph
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "paint_funcs_t" }
--           , argCType = Just "hb_paint_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_paint_funcs_t to paint with"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paint_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "User data to pass to paint callbacks"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "palette_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the font's color palette to use"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "foreground"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_color_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The foreground color, unpremultipled"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_paint_glyph" hb_font_paint_glyph :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr HarfBuzz.PaintFuncsT.PaintFuncsT -> -- pfuncs : TInterface (Name {namespace = "HarfBuzz", name = "paint_funcs_t"})
    Ptr () ->                               -- paint_data : TBasicType TPtr
    Word32 ->                               -- palette_index : TBasicType TUInt
    Word32 ->                               -- foreground : TBasicType TUInt32
    IO ()

-- | Paints the glyph. This function is similar to
-- 'GI.HarfBuzz.Functions.fontPaintGlyphOrFail', but if painting a color glyph
-- failed, it will fall back to painting an outline monochrome
-- glyph.
-- 
-- The painting instructions are returned by way of calls to
-- the callbacks of the /@funcs@/ object, with /@paintData@/ passed
-- to them.
-- 
-- If the font has color palettes (see 'GI.HarfBuzz.Functions.otColorHasPalettes'),
-- then /@paletteIndex@/ selects the palette to use. If the font only
-- has one palette, this will be 0.
-- 
-- /Since: 7.0.0/
fontPaintGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID
    -> HarfBuzz.PaintFuncsT.PaintFuncsT
    -- ^ /@pfuncs@/: t'GI.HarfBuzz.Structs.PaintFuncsT.PaintFuncsT' to paint with
    -> Ptr ()
    -- ^ /@paintData@/: User data to pass to paint callbacks
    -> Word32
    -- ^ /@paletteIndex@/: The index of the font\'s color palette to use
    -> Word32
    -- ^ /@foreground@/: The foreground color, unpremultipled
    -> m ()
fontPaintGlyph font glyph pfuncs paintData paletteIndex foreground = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    pfuncs' <- unsafeManagedPtrGetPtr pfuncs
    hb_font_paint_glyph font' glyph pfuncs' paintData paletteIndex foreground
    touchManagedPtr font
    touchManagedPtr pfuncs
    return ()


-- function font_make_immutable
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_make_immutable" hb_font_make_immutable :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO ()

-- | Makes /@font@/ immutable.
-- 
-- /Since: 0.9.2/
fontMakeImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m ()
fontMakeImmutable font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    hb_font_make_immutable font'
    touchManagedPtr font
    return ()


-- function font_list_funcs
-- Args: []
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_list_funcs" hb_font_list_funcs :: 
    IO (Ptr CString)

-- | Retrieves the list of font functions supported by HarfBuzz.
-- 
-- /Since: 11.0.0/
fontListFuncs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [T.Text]
    -- ^ __Returns:__ a
    --    @NULL@-terminated array of supported font functions
    --    constant strings. The returned array is owned by HarfBuzz
    --    and should not be modified or freed.
fontListFuncs  = liftIO $ do
    result <- hb_font_list_funcs
    checkUnexpectedReturnNULL "fontListFuncs" result
    result' <- unpackZeroTerminatedUTF8CArray result
    return result'


-- function font_is_synthetic
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_is_synthetic" hb_font_is_synthetic :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO Int32

-- | Tests whether a font is synthetic. A synthetic font is one
-- that has either synthetic slant or synthetic bold set on it.
-- 
-- /Since: 11.2.0/
fontIsSynthetic ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m Int32
    -- ^ __Returns:__ @true@ if the font is synthetic, @false@ otherwise.
fontIsSynthetic font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_font_is_synthetic font'
    touchManagedPtr font
    return result


-- function font_is_immutable
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_is_immutable" hb_font_is_immutable :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO Int32

-- | Tests whether a font object is immutable.
-- 
-- /Since: 0.9.2/
fontIsImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m Int32
    -- ^ __Returns:__ @true@ if /@font@/ is immutable, @false@ otherwise
fontIsImmutable font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_font_is_immutable font'
    touchManagedPtr font
    return result


-- function font_glyph_to_string
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "s"
--           , argType = TCArray False (-1) 3 (TBasicType TUTF8)
--           , argCType = Just "char*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The string containing the glyph name"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of string @s"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "size"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of string @s"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_glyph_to_string" hb_font_glyph_to_string :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr (Ptr CString) ->                    -- s : TCArray False (-1) 3 (TBasicType TUTF8)
    Ptr Word32 ->                           -- size : TBasicType TUInt
    IO ()

-- | Fetches the name of the specified glyph ID in /@font@/ and returns
-- it in string /@s@/.
-- 
-- If the glyph ID has no name in /@font@/, a string of the form @gidDDD@ is
-- generated, with @DDD@ being the glyph ID.
-- 
-- According to the OpenType specification, glyph names are limited to 63
-- characters and can only contain (a subset of) ASCII.
-- 
-- /Since: 0.9.2/
fontGlyphToString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> m ([T.Text])
fontGlyphToString font glyph = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    s <- callocMem :: IO (Ptr (Ptr CString))
    size <- allocMem :: IO (Ptr Word32)
    hb_font_glyph_to_string font' glyph s size
    size' <- peek size
    s' <- peek s
    s'' <- (unpackUTF8CArrayWithLength size') s'
    (mapCArrayWithLength size') freeMem s'
    freeMem s'
    touchManagedPtr font
    freeMem s
    freeMem size
    return s''


-- function font_glyph_from_string
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "s"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "string to query" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The length of the string @s"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The glyph ID corresponding to the string requested"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The length of the string @s"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_glyph_from_string" hb_font_glyph_from_string :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr Word8 ->                            -- s : TCArray False (-1) 2 (TBasicType TUInt8)
    Int32 ->                                -- len : TBasicType TInt
    Ptr Word32 ->                           -- glyph : TBasicType TUInt32
    IO Int32

-- | Fetches the glyph ID from /@font@/ that matches the specified string.
-- Strings of the format @gidDDD@ or @uniUUUU@ are parsed automatically.
-- 
-- \<note>Note: /@len@/ == -1 means the string is null-terminated.\<\/note>
-- 
-- /Since: 0.9.2/
fontGlyphFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> ByteString
    -- ^ /@s@/: string to query
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGlyphFromString font s = liftIO $ do
    let len = fromIntegral $ B.length s
    font' <- unsafeManagedPtrGetPtr font
    s' <- packByteString s
    glyph <- allocMem :: IO (Ptr Word32)
    result <- hb_font_glyph_from_string font' s' len glyph
    glyph' <- peek glyph
    touchManagedPtr font
    freeMem s'
    freeMem glyph
    return (result, glyph')


-- function font_get_variation_glyph
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "unicode"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode code point to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "variation_selector"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The  variation-selector code point to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_variation_glyph" hb_font_get_variation_glyph :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- unicode : TBasicType TUInt32
    Word32 ->                               -- variation_selector : TBasicType TUInt32
    Ptr Word32 ->                           -- glyph : TBasicType TUInt32
    IO Int32

-- | Fetches the glyph ID for a Unicode code point when followed by
-- by the specified variation-selector code point, in the specified
-- font.
-- 
-- /Since: 1.2.3/
fontGetVariationGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@unicode@/: The Unicode code point to query
    -> Word32
    -- ^ /@variationSelector@/: The  variation-selector code point to query
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetVariationGlyph font unicode variationSelector = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    glyph <- allocMem :: IO (Ptr Word32)
    result <- hb_font_get_variation_glyph font' unicode variationSelector glyph
    glyph' <- peek glyph
    touchManagedPtr font
    freeMem glyph
    return (result, glyph')


-- function font_get_var_named_instance
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a font." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_var_named_instance" hb_font_get_var_named_instance :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO Word32

-- | Returns the currently-set named-instance index of the font.
-- 
-- /Since: 7.0.0/
fontGetVarNamedInstance ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: a font.
    -> m Word32
    -- ^ __Returns:__ Named-instance index or 'GI.HarfBuzz.Constants.FONT_NO_VAR_NAMED_INSTANCE'.
fontGetVarNamedInstance font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_font_get_var_named_instance font'
    touchManagedPtr font
    return result


-- function font_get_var_coords_normalized
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Number of coordinates retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_var_coords_normalized" hb_font_get_var_coords_normalized :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr Word32 ->                           -- length : TBasicType TUInt
    IO Int32

-- | Fetches the list of normalized variation coordinates currently
-- set on a font.
-- 
-- \<note>Note that if no variation coordinates are set, this function may
-- return 'P.Nothing'.\<\/note>
-- 
-- Return value is valid as long as variation coordinates of the font
-- are not modified.
-- 
-- /Since: 1.4.2/
fontGetVarCoordsNormalized ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m ((Int32, Word32))
    -- ^ __Returns:__ coordinates array
fontGetVarCoordsNormalized font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    length_ <- allocMem :: IO (Ptr Word32)
    result <- hb_font_get_var_coords_normalized font' length_
    length_' <- peek length_
    touchManagedPtr font
    freeMem length_
    return (result, length_')


-- function font_get_var_coords_design
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Number of coordinates retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_var_coords_design" hb_font_get_var_coords_design :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr Word32 ->                           -- length : TBasicType TUInt
    IO CFloat

-- | Fetches the list of variation coordinates (in design-space units) currently
-- set on a font.
-- 
-- \<note>Note that if no variation coordinates are set, this function may
-- return 'P.Nothing'.\<\/note>
-- 
-- \<note>If variations have been set on the font using normalized coordinates
-- (i.e. via 'GI.HarfBuzz.Functions.fontSetVarCoordsNormalized'), the design coordinates will
-- have NaN (Not a Number) values.\<\/note>
-- 
-- Return value is valid as long as variation coordinates of the font
-- are not modified.
-- 
-- /Since: 3.3.0/
fontGetVarCoordsDesign ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m ((Float, Word32))
    -- ^ __Returns:__ coordinates array
fontGetVarCoordsDesign font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    length_ <- allocMem :: IO (Ptr Word32)
    result <- hb_font_get_var_coords_design font' length_
    let result' = realToFrac result
    length_' <- peek length_
    touchManagedPtr font
    freeMem length_
    return (result', length_')


-- function font_get_v_extents
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "extents"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "font_extents_t" }
--           , argCType = Just "hb_font_extents_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The font extents retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_v_extents" hb_font_get_v_extents :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr HarfBuzz.FontExtentsT.FontExtentsT -> -- extents : TInterface (Name {namespace = "HarfBuzz", name = "font_extents_t"})
    IO Int32

-- | Fetches the extents for a specified font, for vertical
-- text segments.
-- 
-- /Since: 1.1.3/
fontGetVExtents ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m ((Int32, HarfBuzz.FontExtentsT.FontExtentsT))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetVExtents font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    extents <- SP.callocBytes 48 :: IO (Ptr HarfBuzz.FontExtentsT.FontExtentsT)
    result <- hb_font_get_v_extents font' extents
    extents' <- (wrapPtr HarfBuzz.FontExtentsT.FontExtentsT) extents
    touchManagedPtr font
    return (result, extents')


-- function font_get_synthetic_slant
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_synthetic_slant" hb_font_get_synthetic_slant :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO CFloat

-- | Fetches the \"synthetic slant\" of a font.
-- 
-- /Since: 3.3.0/
fontGetSyntheticSlant ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m Float
    -- ^ __Returns:__ Synthetic slant.  By default is zero.
fontGetSyntheticSlant font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_font_get_synthetic_slant font'
    let result' = realToFrac result
    touchManagedPtr font
    return result'


-- function font_get_synthetic_bold
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x_embolden"
--           , argType = TBasicType TFloat
--           , argCType = Just "float*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for horizontal value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y_embolden"
--           , argType = TBasicType TFloat
--           , argCType = Just "float*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for vertical value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "in_place"
--           , argType = TBasicType TInt
--           , argCType = Just "hb_bool_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for in-place value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_synthetic_bold" hb_font_get_synthetic_bold :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr CFloat ->                           -- x_embolden : TBasicType TFloat
    Ptr CFloat ->                           -- y_embolden : TBasicType TFloat
    Ptr Int32 ->                            -- in_place : TBasicType TInt
    IO ()

-- | Fetches the \"synthetic boldness\" parameters of a font.
-- 
-- /Since: 7.0.0/
fontGetSyntheticBold ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m ((Float, Float, Int32))
fontGetSyntheticBold font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    xEmbolden <- allocMem :: IO (Ptr CFloat)
    yEmbolden <- allocMem :: IO (Ptr CFloat)
    inPlace <- allocMem :: IO (Ptr Int32)
    hb_font_get_synthetic_bold font' xEmbolden yEmbolden inPlace
    xEmbolden' <- peek xEmbolden
    let xEmbolden'' = realToFrac xEmbolden'
    yEmbolden' <- peek yEmbolden
    let yEmbolden'' = realToFrac yEmbolden'
    inPlace' <- peek inPlace
    touchManagedPtr font
    freeMem xEmbolden
    freeMem yEmbolden
    freeMem inPlace
    return (xEmbolden'', yEmbolden'', inPlace')


-- function font_get_serial
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_serial" hb_font_get_serial :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO Word32

-- | Returns the internal serial number of the font. The serial
-- number is increased every time a setting on the font is
-- changed, using a setter function.
-- 
-- /Since: 4.4.0/
fontGetSerial ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m Word32
    -- ^ __Returns:__ serial number
fontGetSerial font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_font_get_serial font'
    touchManagedPtr font
    return result


-- function font_get_scale
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x_scale"
--           , argType = TBasicType TInt
--           , argCType = Just "int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Horizontal scale value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y_scale"
--           , argType = TBasicType TInt
--           , argCType = Just "int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Vertical scale value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_scale" hb_font_get_scale :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr Int32 ->                            -- x_scale : TBasicType TInt
    Ptr Int32 ->                            -- y_scale : TBasicType TInt
    IO ()

-- | Fetches the horizontal and vertical scale of a font.
-- 
-- /Since: 0.9.2/
fontGetScale ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m ((Int32, Int32))
fontGetScale font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    xScale <- allocMem :: IO (Ptr Int32)
    yScale <- allocMem :: IO (Ptr Int32)
    hb_font_get_scale font' xScale yScale
    xScale' <- peek xScale
    yScale' <- peek yScale
    touchManagedPtr font
    freeMem xScale
    freeMem yScale
    return (xScale', yScale')


-- function font_get_ptem
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_ptem" hb_font_get_ptem :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO CFloat

-- | Fetches the \"point size\" of a font. Used in CoreText to
-- implement optical sizing.
-- 
-- /Since: 1.6.0/
fontGetPtem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m Float
    -- ^ __Returns:__ Point size.  A value of zero means \"not set.\"
fontGetPtem font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_font_get_ptem font'
    let result' = realToFrac result
    touchManagedPtr font
    return result'


-- function font_get_ppem
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x_ppem"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Horizontal ppem value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y_ppem"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Vertical ppem value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_ppem" hb_font_get_ppem :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr Word32 ->                           -- x_ppem : TBasicType TUInt
    Ptr Word32 ->                           -- y_ppem : TBasicType TUInt
    IO ()

-- | Fetches the horizontal and vertical points-per-em (ppem) of a font.
-- 
-- /Since: 0.9.2/
fontGetPpem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m ((Word32, Word32))
fontGetPpem font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    xPpem <- allocMem :: IO (Ptr Word32)
    yPpem <- allocMem :: IO (Ptr Word32)
    hb_font_get_ppem font' xPpem yPpem
    xPpem' <- peek xPpem
    yPpem' <- peek yPpem
    touchManagedPtr font
    freeMem xPpem
    freeMem yPpem
    return (xPpem', yPpem')


-- function font_get_parent
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "font_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_parent" hb_font_get_parent :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO (Ptr HarfBuzz.FontT.FontT)

-- | Fetches the parent font of /@font@/.
-- 
-- /Since: 0.9.2/
fontGetParent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m HarfBuzz.FontT.FontT
    -- ^ __Returns:__ The parent font object
fontGetParent font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_font_get_parent font'
    checkUnexpectedReturnNULL "fontGetParent" result
    result' <- (newBoxed HarfBuzz.FontT.FontT) result
    touchManagedPtr font
    return result'


-- function font_get_nominal_glyphs
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of code points to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_unicode"
--           , argType = TBasicType TUInt32
--           , argCType = Just "const hb_codepoint_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first Unicode code point to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "unicode_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive code points"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first glyph ID retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "glyph_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive glyph IDs"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_nominal_glyphs" hb_font_get_nominal_glyphs :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- count : TBasicType TUInt
    Word32 ->                               -- first_unicode : TBasicType TUInt32
    Word32 ->                               -- unicode_stride : TBasicType TUInt
    Ptr Word32 ->                           -- first_glyph : TBasicType TUInt32
    Word32 ->                               -- glyph_stride : TBasicType TUInt
    IO Word32

-- | Fetches the nominal glyph IDs for a sequence of Unicode code points. Glyph
-- IDs must be returned in a @/hb_codepoint_t/@ output parameter. Stops at the
-- first unsupported glyph ID.
-- 
-- /Since: 2.6.3/
fontGetNominalGlyphs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@count@/: number of code points to query
    -> Word32
    -- ^ /@firstUnicode@/: The first Unicode code point to query
    -> Word32
    -- ^ /@unicodeStride@/: The stride between successive code points
    -> Word32
    -- ^ /@glyphStride@/: The stride between successive glyph IDs
    -> m ((Word32, Word32))
    -- ^ __Returns:__ the number of code points processed
fontGetNominalGlyphs font count firstUnicode unicodeStride glyphStride = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    firstGlyph <- allocMem :: IO (Ptr Word32)
    result <- hb_font_get_nominal_glyphs font' count firstUnicode unicodeStride firstGlyph glyphStride
    firstGlyph' <- peek firstGlyph
    touchManagedPtr font
    freeMem firstGlyph
    return (result, firstGlyph')


-- function font_get_nominal_glyph
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "unicode"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode code point to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_nominal_glyph" hb_font_get_nominal_glyph :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- unicode : TBasicType TUInt32
    Ptr Word32 ->                           -- glyph : TBasicType TUInt32
    IO Int32

-- | Fetches the nominal glyph ID for a Unicode code point in the
-- specified font.
-- 
-- This version of the function should not be used to fetch glyph IDs
-- for code points modified by variation selectors. For variation-selector
-- support, user 'GI.HarfBuzz.Functions.fontGetVariationGlyph' or use 'GI.HarfBuzz.Functions.fontGetGlyph'.
-- 
-- /Since: 1.2.3/
fontGetNominalGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@unicode@/: The Unicode code point to query
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetNominalGlyph font unicode = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    glyph <- allocMem :: IO (Ptr Word32)
    result <- hb_font_get_nominal_glyph font' unicode glyph
    glyph' <- peek glyph
    touchManagedPtr font
    freeMem glyph
    return (result, glyph')


-- function font_get_h_extents
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "extents"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "font_extents_t" }
--           , argCType = Just "hb_font_extents_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The font extents retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_h_extents" hb_font_get_h_extents :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr HarfBuzz.FontExtentsT.FontExtentsT -> -- extents : TInterface (Name {namespace = "HarfBuzz", name = "font_extents_t"})
    IO Int32

-- | Fetches the extents for a specified font, for horizontal
-- text segments.
-- 
-- /Since: 1.1.3/
fontGetHExtents ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m ((Int32, HarfBuzz.FontExtentsT.FontExtentsT))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetHExtents font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    extents <- SP.callocBytes 48 :: IO (Ptr HarfBuzz.FontExtentsT.FontExtentsT)
    result <- hb_font_get_h_extents font' extents
    extents' <- (wrapPtr HarfBuzz.FontExtentsT.FontExtentsT) extents
    touchManagedPtr font
    return (result, extents')


-- function font_get_glyph_v_origins
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The number of glyph IDs in the sequence queried"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "const hb_codepoint_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive glyph IDs"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_x"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The first X coordinate of the origin retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "x_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive X coordinates"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_y"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The first Y coordinate of the origin retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive Y coordinates"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_v_origins" hb_font_get_glyph_v_origins :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- count : TBasicType TUInt
    Word32 ->                               -- first_glyph : TBasicType TUInt32
    Word32 ->                               -- glyph_stride : TBasicType TUInt
    Ptr Int32 ->                            -- first_x : TBasicType TInt32
    Word32 ->                               -- x_stride : TBasicType TUInt
    Ptr Int32 ->                            -- first_y : TBasicType TInt32
    Word32 ->                               -- y_stride : TBasicType TUInt
    IO Int32

-- | Fetches the (X,Y) coordinates of the origin for requested glyph IDs
-- in the specified font, for vertical text segments.
-- 
-- /Since: 11.3.0/
fontGetGlyphVOrigins ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@count@/: The number of glyph IDs in the sequence queried
    -> Word32
    -- ^ /@firstGlyph@/: The first glyph ID to query
    -> Word32
    -- ^ /@glyphStride@/: The stride between successive glyph IDs
    -> Word32
    -- ^ /@xStride@/: The stride between successive X coordinates
    -> Word32
    -- ^ /@yStride@/: The stride between successive Y coordinates
    -> m ((Int32, Int32, Int32))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetGlyphVOrigins font count firstGlyph glyphStride xStride yStride = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    firstX <- allocMem :: IO (Ptr Int32)
    firstY <- allocMem :: IO (Ptr Int32)
    result <- hb_font_get_glyph_v_origins font' count firstGlyph glyphStride firstX xStride firstY yStride
    firstX' <- peek firstX
    firstY' <- peek firstY
    touchManagedPtr font
    freeMem firstX
    freeMem firstY
    return (result, firstX', firstY')


-- function font_get_glyph_v_origin
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The X coordinate of the origin"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Y coordinate of the origin"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_v_origin" hb_font_get_glyph_v_origin :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr Int32 ->                            -- x : TBasicType TInt32
    Ptr Int32 ->                            -- y : TBasicType TInt32
    IO Int32

-- | Fetches the (X,Y) coordinates of the origin for a glyph ID
-- in the specified font, for vertical text segments.
-- 
-- /Since: 0.9.2/
fontGetGlyphVOrigin ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> m ((Int32, Int32, Int32))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetGlyphVOrigin font glyph = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    x <- allocMem :: IO (Ptr Int32)
    y <- allocMem :: IO (Ptr Int32)
    result <- hb_font_get_glyph_v_origin font' glyph x y
    x' <- peek x
    y' <- peek y
    touchManagedPtr font
    freeMem x
    freeMem y
    return (result, x', y')


-- function font_get_glyph_v_kerning
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "top_glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The glyph ID of the top glyph in the glyph pair"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "bottom_glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The glyph ID of the bottom glyph in the glyph pair"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_v_kerning" hb_font_get_glyph_v_kerning :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- top_glyph : TBasicType TUInt32
    Word32 ->                               -- bottom_glyph : TBasicType TUInt32
    IO Int32

{-# DEPRECATED fontGetGlyphVKerning ["(Since version 2.0.0)"] #-}
-- | Fetches the kerning-adjustment value for a glyph-pair in
-- the specified font, for vertical text segments.
-- 
-- \<note>It handles legacy kerning only (as returned by the corresponding
-- t'GI.HarfBuzz.Structs.FontFuncsT.FontFuncsT' function).\<\/note>
-- 
-- /Since: 0.9.2/
fontGetGlyphVKerning ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@topGlyph@/: The glyph ID of the top glyph in the glyph pair
    -> Word32
    -- ^ /@bottomGlyph@/: The glyph ID of the bottom glyph in the glyph pair
    -> m Int32
    -- ^ __Returns:__ The kerning adjustment value
fontGetGlyphVKerning font topGlyph bottomGlyph = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_font_get_glyph_v_kerning font' topGlyph bottomGlyph
    touchManagedPtr font
    return result


-- function font_get_glyph_v_advances
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The number of glyph IDs in the sequence queried"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "const hb_codepoint_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive glyph IDs"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_advance"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first advance retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "advance_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive advances"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_v_advances" hb_font_get_glyph_v_advances :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- count : TBasicType TUInt
    Word32 ->                               -- first_glyph : TBasicType TUInt32
    Word32 ->                               -- glyph_stride : TBasicType TUInt
    Ptr Int32 ->                            -- first_advance : TBasicType TInt32
    Ptr Word32 ->                           -- advance_stride : TBasicType TUInt
    IO ()

-- | Fetches the advances for a sequence of glyph IDs in the specified
-- font, for vertical text segments.
-- 
-- /Since: 1.8.6/
fontGetGlyphVAdvances ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@count@/: The number of glyph IDs in the sequence queried
    -> Word32
    -- ^ /@firstGlyph@/: The first glyph ID to query
    -> Word32
    -- ^ /@glyphStride@/: The stride between successive glyph IDs
    -> m ((Int32, Word32))
fontGetGlyphVAdvances font count firstGlyph glyphStride = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    firstAdvance <- allocMem :: IO (Ptr Int32)
    advanceStride <- allocMem :: IO (Ptr Word32)
    hb_font_get_glyph_v_advances font' count firstGlyph glyphStride firstAdvance advanceStride
    firstAdvance' <- peek firstAdvance
    advanceStride' <- peek advanceStride
    touchManagedPtr font
    freeMem firstAdvance
    freeMem advanceStride
    return (firstAdvance', advanceStride')


-- function font_get_glyph_v_advance
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_v_advance" hb_font_get_glyph_v_advance :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    IO Int32

-- | Fetches the advance for a glyph ID in the specified font,
-- for vertical text segments.
-- 
-- /Since: 0.9.2/
fontGetGlyphVAdvance ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> m Int32
    -- ^ __Returns:__ The advance of /@glyph@/ within /@font@/
fontGetGlyphVAdvance font glyph = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_font_get_glyph_v_advance font' glyph
    touchManagedPtr font
    return result


-- function font_get_glyph_shape
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "dfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_funcs_t" }
--           , argCType = Just "hb_draw_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_draw_funcs_t to draw to"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "draw_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "User data to pass to draw callbacks"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_shape" hb_font_get_glyph_shape :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr HarfBuzz.DrawFuncsT.DrawFuncsT ->   -- dfuncs : TInterface (Name {namespace = "HarfBuzz", name = "draw_funcs_t"})
    Ptr () ->                               -- draw_data : TBasicType TPtr
    IO ()

{-# DEPRECATED fontGetGlyphShape ["(Since version 7.0.0)","Use 'GI.HarfBuzz.Functions.fontDrawGlyph' instead"] #-}
-- | Fetches the glyph shape that corresponds to a glyph in the specified /@font@/.
-- The shape is returned by way of calls to the callbacks of the /@dfuncs@/
-- objects, with /@drawData@/ passed to them.
-- 
-- /Since: 4.0.0/
fontGetGlyphShape ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID
    -> HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ /@dfuncs@/: t'GI.HarfBuzz.Structs.DrawFuncsT.DrawFuncsT' to draw to
    -> Ptr ()
    -- ^ /@drawData@/: User data to pass to draw callbacks
    -> m ()
fontGetGlyphShape font glyph dfuncs drawData = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    dfuncs' <- unsafeManagedPtrGetPtr dfuncs
    hb_font_get_glyph_shape font' glyph dfuncs' drawData
    touchManagedPtr font
    touchManagedPtr dfuncs
    return ()


-- function font_get_glyph_origin_for_direction
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The direction of the text segment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The X coordinate retrieved for the origin"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Y coordinate retrieved for the origin"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_origin_for_direction" hb_font_get_glyph_origin_for_direction :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Ptr Int32 ->                            -- x : TBasicType TInt32
    Ptr Int32 ->                            -- y : TBasicType TInt32
    IO ()

-- | Fetches the (X,Y) coordinates of the origin for a glyph in
-- the specified font.
-- 
-- Calls the appropriate direction-specific variant (horizontal
-- or vertical) depending on the value of /@direction@/.
-- 
-- /Since: 0.9.2/
fontGetGlyphOriginForDirection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: The direction of the text segment
    -> m ((Int32, Int32))
fontGetGlyphOriginForDirection font glyph direction = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    x <- allocMem :: IO (Ptr Int32)
    y <- allocMem :: IO (Ptr Int32)
    hb_font_get_glyph_origin_for_direction font' glyph direction' x y
    x' <- peek x
    y' <- peek y
    touchManagedPtr font
    freeMem x
    freeMem y
    return (x', y')


-- function font_get_glyph_name
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TCArray False (-1) 3 (TBasicType TUTF8)
--           , argCType = Just "char*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Name string retrieved for the glyph ID"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of the glyph-name string retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "size"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of the glyph-name string retrieved"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_name" hb_font_get_glyph_name :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr (Ptr CString) ->                    -- name : TCArray False (-1) 3 (TBasicType TUTF8)
    Ptr Word32 ->                           -- size : TBasicType TUInt
    IO Int32

-- | Fetches the glyph-name string for a glyph ID in the specified /@font@/.
-- 
-- According to the OpenType specification, glyph names are limited to 63
-- characters and can only contain (a subset of) ASCII.
-- 
-- /Since: 0.9.2/
fontGetGlyphName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> m ((Int32, [T.Text]))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetGlyphName font glyph = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    name <- callocMem :: IO (Ptr (Ptr CString))
    size <- allocMem :: IO (Ptr Word32)
    result <- hb_font_get_glyph_name font' glyph name size
    size' <- peek size
    name' <- peek name
    name'' <- (unpackUTF8CArrayWithLength size') name'
    (mapCArrayWithLength size') freeMem name'
    freeMem name'
    touchManagedPtr font
    freeMem name
    freeMem size
    return (result, name'')


-- function font_get_glyph_kerning_for_direction
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The glyph ID of the first glyph in the glyph pair to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "second_glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The glyph ID of the second glyph in the glyph pair to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The direction of the text segment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The horizontal kerning-adjustment value retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The vertical kerning-adjustment value retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_kerning_for_direction" hb_font_get_glyph_kerning_for_direction :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- first_glyph : TBasicType TUInt32
    Word32 ->                               -- second_glyph : TBasicType TUInt32
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Ptr Int32 ->                            -- x : TBasicType TInt32
    Ptr Int32 ->                            -- y : TBasicType TInt32
    IO ()

-- | Fetches the kerning-adjustment value for a glyph-pair in the specified font.
-- 
-- Calls the appropriate direction-specific variant (horizontal
-- or vertical) depending on the value of /@direction@/.
-- 
-- /Since: 0.9.2/
fontGetGlyphKerningForDirection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@firstGlyph@/: The glyph ID of the first glyph in the glyph pair to query
    -> Word32
    -- ^ /@secondGlyph@/: The glyph ID of the second glyph in the glyph pair to query
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: The direction of the text segment
    -> m ((Int32, Int32))
fontGetGlyphKerningForDirection font firstGlyph secondGlyph direction = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    x <- allocMem :: IO (Ptr Int32)
    y <- allocMem :: IO (Ptr Int32)
    hb_font_get_glyph_kerning_for_direction font' firstGlyph secondGlyph direction' x y
    x' <- peek x
    y' <- peek y
    touchManagedPtr font
    freeMem x
    freeMem y
    return (x', y')


-- function font_get_glyph_h_origins
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The number of glyph IDs in the sequence queried"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "const hb_codepoint_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive glyph IDs"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_x"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The first X coordinate of the origin retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "x_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive X coordinates"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_y"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The first Y coordinate of the origin retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive Y coordinates"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_h_origins" hb_font_get_glyph_h_origins :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- count : TBasicType TUInt
    Word32 ->                               -- first_glyph : TBasicType TUInt32
    Word32 ->                               -- glyph_stride : TBasicType TUInt
    Ptr Int32 ->                            -- first_x : TBasicType TInt32
    Word32 ->                               -- x_stride : TBasicType TUInt
    Ptr Int32 ->                            -- first_y : TBasicType TInt32
    Word32 ->                               -- y_stride : TBasicType TUInt
    IO Int32

-- | Fetches the (X,Y) coordinates of the origin for requested glyph IDs
-- in the specified font, for horizontal text segments.
-- 
-- /Since: 11.3.0/
fontGetGlyphHOrigins ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@count@/: The number of glyph IDs in the sequence queried
    -> Word32
    -- ^ /@firstGlyph@/: The first glyph ID to query
    -> Word32
    -- ^ /@glyphStride@/: The stride between successive glyph IDs
    -> Word32
    -- ^ /@xStride@/: The stride between successive X coordinates
    -> Word32
    -- ^ /@yStride@/: The stride between successive Y coordinates
    -> m ((Int32, Int32, Int32))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetGlyphHOrigins font count firstGlyph glyphStride xStride yStride = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    firstX <- allocMem :: IO (Ptr Int32)
    firstY <- allocMem :: IO (Ptr Int32)
    result <- hb_font_get_glyph_h_origins font' count firstGlyph glyphStride firstX xStride firstY yStride
    firstX' <- peek firstX
    firstY' <- peek firstY
    touchManagedPtr font
    freeMem firstX
    freeMem firstY
    return (result, firstX', firstY')


-- function font_get_glyph_h_origin
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The X coordinate of the origin"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Y coordinate of the origin"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_h_origin" hb_font_get_glyph_h_origin :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr Int32 ->                            -- x : TBasicType TInt32
    Ptr Int32 ->                            -- y : TBasicType TInt32
    IO Int32

-- | Fetches the (X,Y) coordinates of the origin for a glyph ID
-- in the specified font, for horizontal text segments.
-- 
-- /Since: 0.9.2/
fontGetGlyphHOrigin ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> m ((Int32, Int32, Int32))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetGlyphHOrigin font glyph = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    x <- allocMem :: IO (Ptr Int32)
    y <- allocMem :: IO (Ptr Int32)
    result <- hb_font_get_glyph_h_origin font' glyph x y
    x' <- peek x
    y' <- peek y
    touchManagedPtr font
    freeMem x
    freeMem y
    return (result, x', y')


-- function font_get_glyph_h_kerning
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "left_glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The glyph ID of the left glyph in the glyph pair"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "right_glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The glyph ID of the right glyph in the glyph pair"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_h_kerning" hb_font_get_glyph_h_kerning :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- left_glyph : TBasicType TUInt32
    Word32 ->                               -- right_glyph : TBasicType TUInt32
    IO Int32

-- | Fetches the kerning-adjustment value for a glyph-pair in
-- the specified font, for horizontal text segments.
-- 
-- \<note>It handles legacy kerning only (as returned by the corresponding
-- t'GI.HarfBuzz.Structs.FontFuncsT.FontFuncsT' function).\<\/note>
-- 
-- /Since: 0.9.2/
fontGetGlyphHKerning ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@leftGlyph@/: The glyph ID of the left glyph in the glyph pair
    -> Word32
    -- ^ /@rightGlyph@/: The glyph ID of the right glyph in the glyph pair
    -> m Int32
    -- ^ __Returns:__ The kerning adjustment value
fontGetGlyphHKerning font leftGlyph rightGlyph = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_font_get_glyph_h_kerning font' leftGlyph rightGlyph
    touchManagedPtr font
    return result


-- function font_get_glyph_h_advances
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The number of glyph IDs in the sequence queried"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "const hb_codepoint_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive glyph IDs"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_advance"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first advance retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "advance_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive advances"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_h_advances" hb_font_get_glyph_h_advances :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- count : TBasicType TUInt
    Word32 ->                               -- first_glyph : TBasicType TUInt32
    Word32 ->                               -- glyph_stride : TBasicType TUInt
    Ptr Int32 ->                            -- first_advance : TBasicType TInt32
    Word32 ->                               -- advance_stride : TBasicType TUInt
    IO ()

-- | Fetches the advances for a sequence of glyph IDs in the specified
-- font, for horizontal text segments.
-- 
-- /Since: 1.8.6/
fontGetGlyphHAdvances ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@count@/: The number of glyph IDs in the sequence queried
    -> Word32
    -- ^ /@firstGlyph@/: The first glyph ID to query
    -> Word32
    -- ^ /@glyphStride@/: The stride between successive glyph IDs
    -> Word32
    -- ^ /@advanceStride@/: The stride between successive advances
    -> m (Int32)
fontGetGlyphHAdvances font count firstGlyph glyphStride advanceStride = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    firstAdvance <- allocMem :: IO (Ptr Int32)
    hb_font_get_glyph_h_advances font' count firstGlyph glyphStride firstAdvance advanceStride
    firstAdvance' <- peek firstAdvance
    touchManagedPtr font
    freeMem firstAdvance
    return firstAdvance'


-- function font_get_glyph_h_advance
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_h_advance" hb_font_get_glyph_h_advance :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    IO Int32

-- | Fetches the advance for a glyph ID in the specified font,
-- for horizontal text segments.
-- 
-- /Since: 0.9.2/
fontGetGlyphHAdvance ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> m Int32
    -- ^ __Returns:__ The advance of /@glyph@/ within /@font@/
fontGetGlyphHAdvance font glyph = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_font_get_glyph_h_advance font' glyph
    touchManagedPtr font
    return result


-- function font_get_glyph_from_name
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TCArray False (-1) 2 (TBasicType TUTF8)
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name string to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The length of the name queried"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The length of the name queried"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_from_name" hb_font_get_glyph_from_name :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Ptr CString ->                          -- name : TCArray False (-1) 2 (TBasicType TUTF8)
    Int32 ->                                -- len : TBasicType TInt
    Ptr Word32 ->                           -- glyph : TBasicType TUInt32
    IO Int32

-- | Fetches the glyph ID that corresponds to a name string in the specified /@font@/.
-- 
-- \<note>Note: /@len@/ == -1 means the name string is null-terminated.\<\/note>
-- 
-- /Since: 0.9.2/
fontGetGlyphFromName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> [T.Text]
    -- ^ /@name@/: The name string to query
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetGlyphFromName font name = liftIO $ do
    let len = fromIntegral $ P.length name
    font' <- unsafeManagedPtrGetPtr font
    name' <- packUTF8CArray name
    glyph <- allocMem :: IO (Ptr Word32)
    result <- hb_font_get_glyph_from_name font' name' len glyph
    glyph' <- peek glyph
    touchManagedPtr font
    (mapCArrayWithLength len) freeMem name'
    freeMem name'
    freeMem glyph
    return (result, glyph')


-- function font_get_glyph_extents_for_origin
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The direction of the text segment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "extents"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "glyph_extents_t" }
--           , argCType = Just "hb_glyph_extents_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_glyph_extents_t retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_extents_for_origin" hb_font_get_glyph_extents_for_origin :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Ptr HarfBuzz.GlyphExtentsT.GlyphExtentsT -> -- extents : TInterface (Name {namespace = "HarfBuzz", name = "glyph_extents_t"})
    IO Int32

-- | Fetches the t'GI.HarfBuzz.Structs.GlyphExtentsT.GlyphExtentsT' data for a glyph ID
-- in the specified font, with respect to the origin in
-- a text segment in the specified direction.
-- 
-- Calls the appropriate direction-specific variant (horizontal
-- or vertical) depending on the value of /@direction@/.
-- 
-- /Since: 0.9.2/
fontGetGlyphExtentsForOrigin ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: The direction of the text segment
    -> m ((Int32, HarfBuzz.GlyphExtentsT.GlyphExtentsT))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetGlyphExtentsForOrigin font glyph direction = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    extents <- SP.callocBytes 16 :: IO (Ptr HarfBuzz.GlyphExtentsT.GlyphExtentsT)
    result <- hb_font_get_glyph_extents_for_origin font' glyph direction' extents
    extents' <- (wrapPtr HarfBuzz.GlyphExtentsT.GlyphExtentsT) extents
    touchManagedPtr font
    return (result, extents')


-- function font_get_glyph_extents
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "extents"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "glyph_extents_t" }
--           , argCType = Just "hb_glyph_extents_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_glyph_extents_t retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_extents" hb_font_get_glyph_extents :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr HarfBuzz.GlyphExtentsT.GlyphExtentsT -> -- extents : TInterface (Name {namespace = "HarfBuzz", name = "glyph_extents_t"})
    IO Int32

-- | Fetches the t'GI.HarfBuzz.Structs.GlyphExtentsT.GlyphExtentsT' data for a glyph ID
-- in the specified font.
-- 
-- /Since: 0.9.2/
fontGetGlyphExtents ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> m ((Int32, HarfBuzz.GlyphExtentsT.GlyphExtentsT))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetGlyphExtents font glyph = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    extents <- SP.callocBytes 16 :: IO (Ptr HarfBuzz.GlyphExtentsT.GlyphExtentsT)
    result <- hb_font_get_glyph_extents font' glyph extents
    extents' <- (wrapPtr HarfBuzz.GlyphExtentsT.GlyphExtentsT) extents
    touchManagedPtr font
    return (result, extents')


-- function font_get_glyph_contour_point_for_origin
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "point_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The contour-point index to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The direction of the text segment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The X value retrieved for the contour point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Y value retrieved for the contour point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_contour_point_for_origin" hb_font_get_glyph_contour_point_for_origin :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Word32 ->                               -- point_index : TBasicType TUInt
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Ptr Int32 ->                            -- x : TBasicType TInt32
    Ptr Int32 ->                            -- y : TBasicType TInt32
    IO Int32

-- | Fetches the (X,Y) coordinates of a specified contour-point index
-- in the specified glyph ID in the specified font, with respect
-- to the origin in a text segment in the specified direction.
-- 
-- Calls the appropriate direction-specific variant (horizontal
-- or vertical) depending on the value of /@direction@/.
-- 
-- /Since: 0.9.2/
fontGetGlyphContourPointForOrigin ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> Word32
    -- ^ /@pointIndex@/: The contour-point index to query
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: The direction of the text segment
    -> m ((Int32, Int32, Int32))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetGlyphContourPointForOrigin font glyph pointIndex direction = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    x <- allocMem :: IO (Ptr Int32)
    y <- allocMem :: IO (Ptr Int32)
    result <- hb_font_get_glyph_contour_point_for_origin font' glyph pointIndex direction' x y
    x' <- peek x
    y' <- peek y
    touchManagedPtr font
    freeMem x
    freeMem y
    return (result, x', y')


-- function font_get_glyph_contour_point
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "point_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The contour-point index to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The X value retrieved for the contour point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Y value retrieved for the contour point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_contour_point" hb_font_get_glyph_contour_point :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Word32 ->                               -- point_index : TBasicType TUInt
    Ptr Int32 ->                            -- x : TBasicType TInt32
    Ptr Int32 ->                            -- y : TBasicType TInt32
    IO Int32

-- | Fetches the (x,y) coordinates of a specified contour-point index
-- in the specified glyph, within the specified font.
-- 
-- /Since: 0.9.2/
fontGetGlyphContourPoint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> Word32
    -- ^ /@pointIndex@/: The contour-point index to query
    -> m ((Int32, Int32, Int32))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetGlyphContourPoint font glyph pointIndex = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    x <- allocMem :: IO (Ptr Int32)
    y <- allocMem :: IO (Ptr Int32)
    result <- hb_font_get_glyph_contour_point font' glyph pointIndex x y
    x' <- peek x
    y' <- peek y
    touchManagedPtr font
    freeMem x
    freeMem y
    return (result, x', y')


-- function font_get_glyph_advances_for_direction
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The direction of the text segment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The number of glyph IDs in the sequence queried"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "const hb_codepoint_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive glyph IDs"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "first_advance"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The first advance retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "advance_stride"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The stride between successive advances"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_advances_for_direction" hb_font_get_glyph_advances_for_direction :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Word32 ->                               -- count : TBasicType TUInt
    Word32 ->                               -- first_glyph : TBasicType TUInt32
    Word32 ->                               -- glyph_stride : TBasicType TUInt
    Ptr Int32 ->                            -- first_advance : TBasicType TInt32
    Ptr Word32 ->                           -- advance_stride : TBasicType TUInt
    IO ()

-- | Fetches the advances for a sequence of glyph IDs in the specified
-- font, in a text segment of the specified direction.
-- 
-- Calls the appropriate direction-specific variant (horizontal
-- or vertical) depending on the value of /@direction@/.
-- 
-- /Since: 1.8.6/
fontGetGlyphAdvancesForDirection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: The direction of the text segment
    -> Word32
    -- ^ /@count@/: The number of glyph IDs in the sequence queried
    -> Word32
    -- ^ /@firstGlyph@/: The first glyph ID to query
    -> Word32
    -- ^ /@glyphStride@/: The stride between successive glyph IDs
    -> m ((Int32, Word32))
fontGetGlyphAdvancesForDirection font direction count firstGlyph glyphStride = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    firstAdvance <- allocMem :: IO (Ptr Int32)
    advanceStride <- allocMem :: IO (Ptr Word32)
    hb_font_get_glyph_advances_for_direction font' direction' count firstGlyph glyphStride firstAdvance advanceStride
    firstAdvance' <- peek firstAdvance
    advanceStride' <- peek advanceStride
    touchManagedPtr font
    freeMem firstAdvance
    freeMem advanceStride
    return (firstAdvance', advanceStride')


-- function font_get_glyph_advance_for_direction
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The direction of the text segment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The horizontal advance retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The vertical advance retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph_advance_for_direction" hb_font_get_glyph_advance_for_direction :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Ptr Int32 ->                            -- x : TBasicType TInt32
    Ptr Int32 ->                            -- y : TBasicType TInt32
    IO ()

-- | Fetches the advance for a glyph ID from the specified font,
-- in a text segment of the specified direction.
-- 
-- Calls the appropriate direction-specific variant (horizontal
-- or vertical) depending on the value of /@direction@/.
-- 
-- /Since: 0.9.2/
fontGetGlyphAdvanceForDirection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: The direction of the text segment
    -> m ((Int32, Int32))
fontGetGlyphAdvanceForDirection font glyph direction = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    x <- allocMem :: IO (Ptr Int32)
    y <- allocMem :: IO (Ptr Int32)
    hb_font_get_glyph_advance_for_direction font' glyph direction' x y
    x' <- peek x
    y' <- peek y
    touchManagedPtr font
    freeMem x
    freeMem y
    return (x', y')


-- function font_get_glyph
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "unicode"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode code point to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "variation_selector"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A variation-selector code point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_glyph" hb_font_get_glyph :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- unicode : TBasicType TUInt32
    Word32 ->                               -- variation_selector : TBasicType TUInt32
    Ptr Word32 ->                           -- glyph : TBasicType TUInt32
    IO Int32

-- | Fetches the glyph ID for a Unicode code point in the specified
-- font, with an optional variation selector.
-- 
-- If /@variationSelector@/ is 0, calls 'GI.HarfBuzz.Functions.fontGetNominalGlyph';
-- otherwise calls 'GI.HarfBuzz.Functions.fontGetVariationGlyph'.
-- 
-- /Since: 0.9.2/
fontGetGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@unicode@/: The Unicode code point to query
    -> Word32
    -- ^ /@variationSelector@/: A variation-selector code point
    -> m ((Int32, Word32))
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
fontGetGlyph font unicode variationSelector = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    glyph <- allocMem :: IO (Ptr Word32)
    result <- hb_font_get_glyph font' unicode variationSelector glyph
    glyph' <- peek glyph
    touchManagedPtr font
    freeMem glyph
    return (result, glyph')


-- function font_get_face
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "face_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_face" hb_font_get_face :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO (Ptr HarfBuzz.FaceT.FaceT)

-- | Fetches the face associated with the specified font object.
-- 
-- /Since: 0.9.2/
fontGetFace ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m HarfBuzz.FaceT.FaceT
    -- ^ __Returns:__ The t'GI.HarfBuzz.Structs.FaceT.FaceT' value
fontGetFace font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    result <- hb_font_get_face font'
    checkUnexpectedReturnNULL "fontGetFace" result
    result' <- (newBoxed HarfBuzz.FaceT.FaceT) result
    touchManagedPtr font
    return result'


-- function font_get_extents_for_direction
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The direction of the text segment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "extents"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "font_extents_t" }
--           , argCType = Just "hb_font_extents_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_font_extents_t retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_extents_for_direction" hb_font_get_extents_for_direction :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Ptr HarfBuzz.FontExtentsT.FontExtentsT -> -- extents : TInterface (Name {namespace = "HarfBuzz", name = "font_extents_t"})
    IO ()

-- | Fetches the extents for a font in a text segment of the
-- specified direction.
-- 
-- Calls the appropriate direction-specific variant (horizontal
-- or vertical) depending on the value of /@direction@/.
-- 
-- /Since: 1.1.3/
fontGetExtentsForDirection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: The direction of the text segment
    -> m (HarfBuzz.FontExtentsT.FontExtentsT)
fontGetExtentsForDirection font direction = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    extents <- SP.callocBytes 48 :: IO (Ptr HarfBuzz.FontExtentsT.FontExtentsT)
    hb_font_get_extents_for_direction font' direction' extents
    extents' <- (wrapPtr HarfBuzz.FontExtentsT.FontExtentsT) extents
    touchManagedPtr font
    return extents'


-- function font_get_empty
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "font_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_get_empty" hb_font_get_empty :: 
    IO (Ptr HarfBuzz.FontT.FontT)

-- | Fetches the empty font object.
-- 
-- /Since: 0.9.2/
fontGetEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.FontT.FontT
    -- ^ __Returns:__ The empty font object
fontGetEmpty  = liftIO $ do
    result <- hb_font_get_empty
    checkUnexpectedReturnNULL "fontGetEmpty" result
    result' <- (wrapBoxed HarfBuzz.FontT.FontT) result
    return result'


-- function font_funcs_set_variation_glyph_func
-- XXX Could not generate function font_funcs_set_variation_glyph_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_paint_glyph_or_fail_func
-- XXX Could not generate function font_funcs_set_paint_glyph_or_fail_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_paint_glyph_func
-- XXX Could not generate function font_funcs_set_paint_glyph_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_nominal_glyphs_func
-- XXX Could not generate function font_funcs_set_nominal_glyphs_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_nominal_glyph_func
-- XXX Could not generate function font_funcs_set_nominal_glyph_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_v_origins_func
-- XXX Could not generate function font_funcs_set_glyph_v_origins_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_v_origin_func
-- XXX Could not generate function font_funcs_set_glyph_v_origin_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_v_kerning_func
-- XXX Could not generate function font_funcs_set_glyph_v_kerning_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_v_advances_func
-- XXX Could not generate function font_funcs_set_glyph_v_advances_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_v_advance_func
-- XXX Could not generate function font_funcs_set_glyph_v_advance_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_shape_func
-- XXX Could not generate function font_funcs_set_glyph_shape_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_name_func
-- XXX Could not generate function font_funcs_set_glyph_name_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_h_origins_func
-- XXX Could not generate function font_funcs_set_glyph_h_origins_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_h_origin_func
-- XXX Could not generate function font_funcs_set_glyph_h_origin_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_h_kerning_func
-- XXX Could not generate function font_funcs_set_glyph_h_kerning_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_h_advances_func
-- XXX Could not generate function font_funcs_set_glyph_h_advances_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_h_advance_func
-- XXX Could not generate function font_funcs_set_glyph_h_advance_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_func
-- XXX Could not generate function font_funcs_set_glyph_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_from_name_func
-- XXX Could not generate function font_funcs_set_glyph_from_name_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_extents_func
-- XXX Could not generate function font_funcs_set_glyph_extents_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_glyph_contour_point_func
-- XXX Could not generate function font_funcs_set_glyph_contour_point_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_font_v_extents_func
-- XXX Could not generate function font_funcs_set_font_v_extents_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_font_h_extents_func
-- XXX Could not generate function font_funcs_set_font_h_extents_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_draw_glyph_or_fail_func
-- XXX Could not generate function font_funcs_set_draw_glyph_or_fail_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_set_draw_glyph_func
-- XXX Could not generate function font_funcs_set_draw_glyph_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function font_funcs_make_immutable
-- Args: [ Arg
--           { argCName = "ffuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_funcs_t" }
--           , argCType = Just "hb_font_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The font-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_funcs_make_immutable" hb_font_funcs_make_immutable :: 
    Ptr HarfBuzz.FontFuncsT.FontFuncsT ->   -- ffuncs : TInterface (Name {namespace = "HarfBuzz", name = "font_funcs_t"})
    IO ()

-- | Makes a font-functions structure immutable.
-- 
-- /Since: 0.9.2/
fontFuncsMakeImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontFuncsT.FontFuncsT
    -- ^ /@ffuncs@/: The font-functions structure
    -> m ()
fontFuncsMakeImmutable ffuncs = liftIO $ do
    ffuncs' <- unsafeManagedPtrGetPtr ffuncs
    hb_font_funcs_make_immutable ffuncs'
    touchManagedPtr ffuncs
    return ()


-- function font_funcs_is_immutable
-- Args: [ Arg
--           { argCName = "ffuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_funcs_t" }
--           , argCType = Just "hb_font_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The font-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_funcs_is_immutable" hb_font_funcs_is_immutable :: 
    Ptr HarfBuzz.FontFuncsT.FontFuncsT ->   -- ffuncs : TInterface (Name {namespace = "HarfBuzz", name = "font_funcs_t"})
    IO Int32

-- | Tests whether a font-functions structure is immutable.
-- 
-- /Since: 0.9.2/
fontFuncsIsImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontFuncsT.FontFuncsT
    -- ^ /@ffuncs@/: The font-functions structure
    -> m Int32
    -- ^ __Returns:__ @true@ if /@ffuncs@/ is immutable, @false@ otherwise
fontFuncsIsImmutable ffuncs = liftIO $ do
    ffuncs' <- unsafeManagedPtrGetPtr ffuncs
    result <- hb_font_funcs_is_immutable ffuncs'
    touchManagedPtr ffuncs
    return result


-- function font_funcs_get_empty
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "font_funcs_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_funcs_get_empty" hb_font_funcs_get_empty :: 
    IO (Ptr HarfBuzz.FontFuncsT.FontFuncsT)

-- | Fetches an empty font-functions structure.
-- 
-- /Since: 0.9.2/
fontFuncsGetEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.FontFuncsT.FontFuncsT
    -- ^ __Returns:__ The font-functions structure
fontFuncsGetEmpty  = liftIO $ do
    result <- hb_font_funcs_get_empty
    checkUnexpectedReturnNULL "fontFuncsGetEmpty" result
    result' <- (wrapBoxed HarfBuzz.FontFuncsT.FontFuncsT) result
    return result'


-- function font_funcs_create
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "font_funcs_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_funcs_create" hb_font_funcs_create :: 
    IO (Ptr HarfBuzz.FontFuncsT.FontFuncsT)

-- | Creates a new t'GI.HarfBuzz.Structs.FontFuncsT.FontFuncsT' structure of font functions.
-- 
-- /Since: 0.9.2/
fontFuncsCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.FontFuncsT.FontFuncsT
    -- ^ __Returns:__ The font-functions structure
fontFuncsCreate  = liftIO $ do
    result <- hb_font_funcs_create
    checkUnexpectedReturnNULL "fontFuncsCreate" result
    result' <- (wrapBoxed HarfBuzz.FontFuncsT.FontFuncsT) result
    return result'


-- function font_draw_glyph_or_fail
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "dfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_funcs_t" }
--           , argCType = Just "hb_draw_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_draw_funcs_t to draw to"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "draw_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "User data to pass to draw callbacks"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_draw_glyph_or_fail" hb_font_draw_glyph_or_fail :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr HarfBuzz.DrawFuncsT.DrawFuncsT ->   -- dfuncs : TInterface (Name {namespace = "HarfBuzz", name = "draw_funcs_t"})
    Ptr () ->                               -- draw_data : TBasicType TPtr
    IO Int32

-- | Draws the outline that corresponds to a glyph in the specified /@font@/.
-- 
-- This is a newer name for 'GI.HarfBuzz.Functions.fontDrawGlyph', that returns @false@
-- if the font has no outlines for the glyph.
-- 
-- The outline is returned by way of calls to the callbacks of the /@dfuncs@/
-- objects, with /@drawData@/ passed to them.
-- 
-- /Since: 11.2.0/
fontDrawGlyphOrFail ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID
    -> HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ /@dfuncs@/: t'GI.HarfBuzz.Structs.DrawFuncsT.DrawFuncsT' to draw to
    -> Ptr ()
    -- ^ /@drawData@/: User data to pass to draw callbacks
    -> m Int32
    -- ^ __Returns:__ @true@ if glyph was drawn, @false@ otherwise
fontDrawGlyphOrFail font glyph dfuncs drawData = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    dfuncs' <- unsafeManagedPtrGetPtr dfuncs
    result <- hb_font_draw_glyph_or_fail font' glyph dfuncs' drawData
    touchManagedPtr font
    touchManagedPtr dfuncs
    return result


-- function font_draw_glyph
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "dfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_funcs_t" }
--           , argCType = Just "hb_draw_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_draw_funcs_t to draw to"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "draw_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "User data to pass to draw callbacks"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_draw_glyph" hb_font_draw_glyph :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    Ptr HarfBuzz.DrawFuncsT.DrawFuncsT ->   -- dfuncs : TInterface (Name {namespace = "HarfBuzz", name = "draw_funcs_t"})
    Ptr () ->                               -- draw_data : TBasicType TPtr
    IO ()

-- | Draws the outline that corresponds to a glyph in the specified /@font@/.
-- 
-- This is an older name for 'GI.HarfBuzz.Functions.fontDrawGlyphOrFail', with no
-- return value.
-- 
-- The outline is returned by way of calls to the callbacks of the /@dfuncs@/
-- objects, with /@drawData@/ passed to them.
-- 
-- /Since: 7.0.0/
fontDrawGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID
    -> HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ /@dfuncs@/: t'GI.HarfBuzz.Structs.DrawFuncsT.DrawFuncsT' to draw to
    -> Ptr ()
    -- ^ /@drawData@/: User data to pass to draw callbacks
    -> m ()
fontDrawGlyph font glyph dfuncs drawData = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    dfuncs' <- unsafeManagedPtrGetPtr dfuncs
    hb_font_draw_glyph font' glyph dfuncs' drawData
    touchManagedPtr font
    touchManagedPtr dfuncs
    return ()


-- function font_create_sub_font
-- Args: [ Arg
--           { argCName = "parent"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The parent font object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "font_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_create_sub_font" hb_font_create_sub_font :: 
    Ptr HarfBuzz.FontT.FontT ->             -- parent : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO (Ptr HarfBuzz.FontT.FontT)

-- | Constructs a sub-font font object from the specified /@parent@/ font,
-- replicating the parent\'s properties.
-- 
-- /Since: 0.9.2/
fontCreateSubFont ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@parent@/: The parent font object
    -> m HarfBuzz.FontT.FontT
    -- ^ __Returns:__ The new sub-font font object
fontCreateSubFont parent = liftIO $ do
    parent' <- unsafeManagedPtrGetPtr parent
    result <- hb_font_create_sub_font parent'
    checkUnexpectedReturnNULL "fontCreateSubFont" result
    result' <- (wrapBoxed HarfBuzz.FontT.FontT) result
    touchManagedPtr parent
    return result'


-- function font_create
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a face." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "font_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_create" hb_font_create :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO (Ptr HarfBuzz.FontT.FontT)

-- | Constructs a new font object from the specified face.
-- 
-- \<note>Note: If /@face@/\'s index value (as passed to 'GI.HarfBuzz.Functions.faceCreate'
-- has non-zero top 16-bits, those bits minus one are passed to
-- 'GI.HarfBuzz.Functions.fontSetVarNamedInstance', effectively loading a named-instance
-- of a variable font, instead of the default-instance.  This allows
-- specifying which named-instance to load by default when creating the
-- face.\<\/note>
-- 
-- /Since: 0.9.2/
fontCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: a face.
    -> m HarfBuzz.FontT.FontT
    -- ^ __Returns:__ The new font object
fontCreate face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_font_create face'
    checkUnexpectedReturnNULL "fontCreate" result
    result' <- (wrapBoxed HarfBuzz.FontT.FontT) result
    touchManagedPtr face
    return result'


-- function font_changed
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_changed" hb_font_changed :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    IO ()

-- | Notifies the /@font@/ that underlying font data has changed.
-- This has the effect of increasing the serial as returned
-- by 'GI.HarfBuzz.Functions.fontGetSerial', which invalidates internal caches.
-- 
-- /Since: 4.4.0/
fontChanged ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> m ()
fontChanged font = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    hb_font_changed font'
    touchManagedPtr font
    return ()


-- function font_add_glyph_origin_for_direction
-- Args: [ Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_font_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph ID to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The direction of the text segment"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = The original X coordinate\n    Output = The X coordinate plus the X-coordinate of the origin"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "y"
--           , argType = TBasicType TInt32
--           , argCType = Just "hb_position_t*"
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = The original Y coordinate\n    Output = The Y coordinate plus the Y-coordinate of the origin"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_font_add_glyph_origin_for_direction" hb_font_add_glyph_origin_for_direction :: 
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    Word32 ->                               -- glyph : TBasicType TUInt32
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    Ptr Int32 ->                            -- x : TBasicType TInt32
    Ptr Int32 ->                            -- y : TBasicType TInt32
    IO ()

-- | Adds the origin coordinates to an (X,Y) point coordinate, in
-- the specified glyph ID in the specified font.
-- 
-- Calls the appropriate direction-specific variant (horizontal
-- or vertical) depending on the value of /@direction@/.
-- 
-- /Since: 0.9.2/
fontAddGlyphOriginForDirection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FontT.FontT
    -- ^ /@font@/: t'GI.HarfBuzz.Structs.FontT.FontT' to work upon
    -> Word32
    -- ^ /@glyph@/: The glyph ID to query
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: The direction of the text segment
    -> Int32
    -- ^ /@x@/: Input = The original X coordinate
    --     Output = The X coordinate plus the X-coordinate of the origin
    -> Int32
    -- ^ /@y@/: Input = The original Y coordinate
    --     Output = The Y coordinate plus the Y-coordinate of the origin
    -> m ((Int32, Int32))
fontAddGlyphOriginForDirection font glyph direction x y = liftIO $ do
    font' <- unsafeManagedPtrGetPtr font
    let direction' = (fromIntegral . fromEnum) direction
    x' <- allocMem :: IO (Ptr Int32)
    poke x' x
    y' <- allocMem :: IO (Ptr Int32)
    poke y' y
    hb_font_add_glyph_origin_for_direction font' glyph direction' x' y'
    x'' <- peek x'
    y'' <- peek y'
    touchManagedPtr font
    freeMem x'
    freeMem y'
    return (x'', y'')


-- function feature_to_string
-- Args: [ Arg
--           { argCName = "feature"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "feature_t" }
--           , argCType = Just "hb_feature_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_feature_t to convert"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buf"
--           , argType = TCArray False (-1) 2 (TBasicType TUTF8)
--           , argCType = Just "char*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "output string" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the allocated size of @buf"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "size"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the allocated size of @buf"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_feature_to_string" hb_feature_to_string :: 
    Ptr HarfBuzz.FeatureT.FeatureT ->       -- feature : TInterface (Name {namespace = "HarfBuzz", name = "feature_t"})
    Ptr (Ptr CString) ->                    -- buf : TCArray False (-1) 2 (TBasicType TUTF8)
    Ptr Word32 ->                           -- size : TBasicType TUInt
    IO ()

-- | Converts a t'GI.HarfBuzz.Structs.FeatureT.FeatureT' into a @NULL@-terminated string in the format
-- understood by 'GI.HarfBuzz.Functions.featureFromString'. The client in responsible for
-- allocating big enough size for /@buf@/, 128 bytes is more than enough.
-- 
-- Note that the feature value will be omitted if it is \'1\', but the
-- string won\'t include any whitespace.
-- 
-- /Since: 0.9.5/
featureToString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FeatureT.FeatureT
    -- ^ /@feature@/: an t'GI.HarfBuzz.Structs.FeatureT.FeatureT' to convert
    -> m ([T.Text])
featureToString feature = liftIO $ do
    feature' <- unsafeManagedPtrGetPtr feature
    buf <- callocMem :: IO (Ptr (Ptr CString))
    size <- allocMem :: IO (Ptr Word32)
    hb_feature_to_string feature' buf size
    size' <- peek size
    buf' <- peek buf
    buf'' <- (unpackUTF8CArrayWithLength size') buf'
    (mapCArrayWithLength size') freeMem buf'
    freeMem buf'
    touchManagedPtr feature
    freeMem buf
    freeMem size
    return buf''


-- function feature_from_string
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a string to parse" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "length of @str, or -1 if string is `NULL` terminated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "feature_t" }
--           , argCType = Just "hb_feature_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the #hb_feature_t to initialize with the parsed values"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "length of @str, or -1 if string is `NULL` terminated"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_feature_from_string" hb_feature_from_string :: 
    Ptr Word8 ->                            -- str : TCArray False (-1) 1 (TBasicType TUInt8)
    Int32 ->                                -- len : TBasicType TInt
    Ptr HarfBuzz.FeatureT.FeatureT ->       -- feature : TInterface (Name {namespace = "HarfBuzz", name = "feature_t"})
    IO Int32

-- | Parses a string into a t'GI.HarfBuzz.Structs.FeatureT.FeatureT'.
-- 
-- The format for specifying feature strings follows. All valid CSS
-- font-feature-settings values other than \'normal\' and the global values are
-- also accepted, though not documented below. CSS string escapes are not
-- supported.
-- 
-- The range indices refer to the positions between Unicode characters. The
-- position before the first character is always 0.
-- 
-- The format is Python-esque.  Here is how it all works:
-- 
-- \<informaltable pgwide=\'1\' align=\'left\' frame=\'none\'>
-- \<tgroup cols=\'5\'>
-- \<thead>
-- \<row>\<entry>Syntax\<\/entry>    \<entry>Value\<\/entry> \<entry>Start\<\/entry> \<entry>End\<\/entry>\<\/row>
-- \<\/thead>
-- \<tbody>
-- \<row>\<entry>Setting value:\<\/entry>\<\/row>
-- \<row>\<entry>kern\<\/entry>      \<entry>1\<\/entry>     \<entry>0\<\/entry>      \<entry>∞\<\/entry>   \<entry>Turn feature on\<\/entry>\<\/row>
-- \<row>\<entry>+kern\<\/entry>     \<entry>1\<\/entry>     \<entry>0\<\/entry>      \<entry>∞\<\/entry>   \<entry>Turn feature on\<\/entry>\<\/row>
-- \<row>\<entry>-kern\<\/entry>     \<entry>0\<\/entry>     \<entry>0\<\/entry>      \<entry>∞\<\/entry>   \<entry>Turn feature off\<\/entry>\<\/row>
-- \<row>\<entry>kern=0\<\/entry>    \<entry>0\<\/entry>     \<entry>0\<\/entry>      \<entry>∞\<\/entry>   \<entry>Turn feature off\<\/entry>\<\/row>
-- \<row>\<entry>kern=1\<\/entry>    \<entry>1\<\/entry>     \<entry>0\<\/entry>      \<entry>∞\<\/entry>   \<entry>Turn feature on\<\/entry>\<\/row>
-- \<row>\<entry>aalt=2\<\/entry>    \<entry>2\<\/entry>     \<entry>0\<\/entry>      \<entry>∞\<\/entry>   \<entry>Choose 2nd alternate\<\/entry>\<\/row>
-- \<row>\<entry>Setting index:\<\/entry>\<\/row>
-- \<row>\<entry>kern[]\<\/entry>    \<entry>1\<\/entry>     \<entry>0\<\/entry>      \<entry>∞\<\/entry>   \<entry>Turn feature on\<\/entry>\<\/row>
-- \<row>\<entry>kern[:]\<\/entry>   \<entry>1\<\/entry>     \<entry>0\<\/entry>      \<entry>∞\<\/entry>   \<entry>Turn feature on\<\/entry>\<\/row>
-- \<row>\<entry>kern[5:]\<\/entry>  \<entry>1\<\/entry>     \<entry>5\<\/entry>      \<entry>∞\<\/entry>   \<entry>Turn feature on, partial\<\/entry>\<\/row>
-- \<row>\<entry>kern[:5]\<\/entry>  \<entry>1\<\/entry>     \<entry>0\<\/entry>      \<entry>5\<\/entry>   \<entry>Turn feature on, partial\<\/entry>\<\/row>
-- \<row>\<entry>kern[3:5]\<\/entry> \<entry>1\<\/entry>     \<entry>3\<\/entry>      \<entry>5\<\/entry>   \<entry>Turn feature on, range\<\/entry>\<\/row>
-- \<row>\<entry>kern[3]\<\/entry>   \<entry>1\<\/entry>     \<entry>3\<\/entry>      \<entry>3+1\<\/entry> \<entry>Turn feature on, single char\<\/entry>\<\/row>
-- \<row>\<entry>Mixing it all:\<\/entry>\<\/row>
-- \<row>\<entry>aalt[3:5]=2\<\/entry> \<entry>2\<\/entry>   \<entry>3\<\/entry>      \<entry>5\<\/entry>   \<entry>Turn 2nd alternate on for range\<\/entry>\<\/row>
-- \<\/tbody>
-- \<\/tgroup>
-- \<\/informaltable>
-- 
-- /Since: 0.9.5/
featureFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@str@/: a string to parse
    -> m ((Int32, HarfBuzz.FeatureT.FeatureT))
    -- ^ __Returns:__ @true@ if /@str@/ is successfully parsed, @false@ otherwise
featureFromString str = liftIO $ do
    let len = fromIntegral $ B.length str
    str' <- packByteString str
    feature <- SP.callocBoxedBytes 16 :: IO (Ptr HarfBuzz.FeatureT.FeatureT)
    result <- hb_feature_from_string str' len feature
    feature' <- (wrapBoxed HarfBuzz.FeatureT.FeatureT) feature
    freeMem str'
    return (result, feature')


-- function face_set_upem
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A face object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "upem"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The units-per-em value to assign"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_set_upem" hb_face_set_upem :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- upem : TBasicType TUInt
    IO ()

-- | Sets the units-per-em (upem) for a face object to the specified value.
-- 
-- This API is used in rare circumstances.
-- 
-- /Since: 0.9.2/
faceSetUpem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: A face object
    -> Word32
    -- ^ /@upem@/: The units-per-em value to assign
    -> m ()
faceSetUpem face upem = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    hb_face_set_upem face' upem
    touchManagedPtr face
    return ()


-- function face_set_index
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A face object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index to assign"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_set_index" hb_face_set_index :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- index : TBasicType TUInt
    IO ()

-- | Assigns the specified face-index to /@face@/. Fails if the
-- face is immutable.
-- 
-- \<note>Note: changing the index has no effect on the face itself
-- This only changes the value returned by 'GI.HarfBuzz.Functions.faceGetIndex'.\<\/note>
-- 
-- /Since: 0.9.2/
faceSetIndex ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: A face object
    -> Word32
    -- ^ /@index@/: The index to assign
    -> m ()
faceSetIndex face index = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    hb_face_set_index face' index
    touchManagedPtr face
    return ()


-- function face_set_glyph_count
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A face object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyph_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The glyph-count value to assign"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_set_glyph_count" hb_face_set_glyph_count :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- glyph_count : TBasicType TUInt
    IO ()

-- | Sets the glyph count for a face object to the specified value.
-- 
-- This API is used in rare circumstances.
-- 
-- /Since: 0.9.7/
faceSetGlyphCount ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: A face object
    -> Word32
    -- ^ /@glyphCount@/: The glyph-count value to assign
    -> m ()
faceSetGlyphCount face glyphCount = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    hb_face_set_glyph_count face' glyphCount
    touchManagedPtr face
    return ()


-- function face_set_get_table_tags_func
-- XXX Could not generate function face_set_get_table_tags_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function face_reference_table
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "const hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A face object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_tag_t of the table to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "blob_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_reference_table" hb_face_reference_table :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- tag : TBasicType TUInt32
    IO (Ptr HarfBuzz.BlobT.BlobT)

-- | Fetches a reference to the specified table within
-- the specified face. Returns an empty blob if referencing table data is not
-- possible.
-- 
-- /Since: 0.9.2/
faceReferenceTable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: A face object
    -> Word32
    -- ^ /@tag@/: The @/hb_tag_t/@ of the table to query
    -> m HarfBuzz.BlobT.BlobT
    -- ^ __Returns:__ A pointer to the /@tag@/ table within /@face@/
faceReferenceTable face tag = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_face_reference_table face' tag
    checkUnexpectedReturnNULL "faceReferenceTable" result
    result' <- (wrapBoxed HarfBuzz.BlobT.BlobT) result
    touchManagedPtr face
    return result'


-- function face_reference_blob
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A face object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "blob_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_reference_blob" hb_face_reference_blob :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO (Ptr HarfBuzz.BlobT.BlobT)

-- | Fetches a pointer to the binary blob that contains the specified face.
-- If referencing the face data is not possible, this function creates a blob
-- out of individual table blobs if 'GI.HarfBuzz.Functions.faceGetTableTags' works with this
-- face, otherwise it returns an empty blob.
-- 
-- /Since: 0.9.2/
faceReferenceBlob ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: A face object
    -> m HarfBuzz.BlobT.BlobT
    -- ^ __Returns:__ A pointer to the blob for /@face@/
faceReferenceBlob face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_face_reference_blob face'
    checkUnexpectedReturnNULL "faceReferenceBlob" result
    result' <- (wrapBoxed HarfBuzz.BlobT.BlobT) result
    touchManagedPtr face
    return result'


-- function face_make_immutable
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A face object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_make_immutable" hb_face_make_immutable :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO ()

-- | Makes the given face object immutable.
-- 
-- /Since: 0.9.2/
faceMakeImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: A face object
    -> m ()
faceMakeImmutable face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    hb_face_make_immutable face'
    touchManagedPtr face
    return ()


-- function face_list_loaders
-- Args: []
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_list_loaders" hb_face_list_loaders :: 
    IO (Ptr CString)

-- | Retrieves the list of face loaders supported by HarfBuzz.
-- 
-- /Since: 11.0.0/
faceListLoaders ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [T.Text]
    -- ^ __Returns:__ a
    --    @NULL@-terminated array of supported face loaders
    --    constant strings. The returned array is owned by HarfBuzz
    --    and should not be modified or freed.
faceListLoaders  = liftIO $ do
    result <- hb_face_list_loaders
    checkUnexpectedReturnNULL "faceListLoaders" result
    result' <- unpackZeroTerminatedUTF8CArray result
    return result'


-- function face_is_immutable
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A face object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_is_immutable" hb_face_is_immutable :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests whether the given face object is immutable.
-- 
-- /Since: 0.9.2/
faceIsImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: A face object
    -> m Int32
    -- ^ __Returns:__ @true@ is /@face@/ is immutable, @false@ otherwise
faceIsImmutable face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_face_is_immutable face'
    touchManagedPtr face
    return result


-- function face_get_upem
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "const hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A face object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_get_upem" hb_face_get_upem :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Word32

-- | Fetches the units-per-em (UPEM) value of the specified face object.
-- 
-- Typical UPEM values for fonts are 1000, or 2048, but any value
-- in between 16 and 16,384 is allowed for OpenType fonts.
-- 
-- /Since: 0.9.2/
faceGetUpem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: A face object
    -> m Word32
    -- ^ __Returns:__ The upem value of /@face@/
faceGetUpem face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_face_get_upem face'
    touchManagedPtr face
    return result


-- function face_get_table_tags
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "const hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A face object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of first table tag to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "table_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of table tags to return;\n               Output = the actual number of table tags returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "table_tags"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt32)
--           , argCType = Just "hb_tag_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The array of table tags found"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "table_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of table tags to return;\n               Output = the actual number of table tags returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_get_table_tags" hb_face_get_table_tags :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- start_offset : TBasicType TUInt
    Ptr Word32 ->                           -- table_count : TBasicType TUInt
    Ptr (Ptr Word32) ->                     -- table_tags : TCArray False (-1) 2 (TBasicType TUInt32)
    IO Word32

-- | Fetches a list of all table tags for a face, if possible. The list returned will
-- begin at the offset provided
-- 
-- /Since: 1.6.0/
faceGetTableTags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: A face object
    -> Word32
    -- ^ /@startOffset@/: The index of first table tag to retrieve
    -> m ((Word32, Maybe [Word32]))
    -- ^ __Returns:__ Total number of tables, or zero if it is not possible to list
faceGetTableTags face startOffset = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    tableCount <- allocMem :: IO (Ptr Word32)
    tableTags <- callocMem :: IO (Ptr (Ptr Word32))
    result <- hb_face_get_table_tags face' startOffset tableCount tableTags
    tableCount' <- peek tableCount
    tableTags' <- peek tableTags
    maybeTableTags' <- convertIfNonNull tableTags' $ \tableTags'' -> do
        tableTags''' <- (unpackStorableArrayWithLength tableCount') tableTags''
        freeMem tableTags''
        return tableTags'''
    touchManagedPtr face
    freeMem tableCount
    freeMem tableTags
    return (result, maybeTableTags')


-- function face_get_index
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "const hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A face object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_get_index" hb_face_get_index :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Word32

-- | Fetches the face-index corresponding to the given face.
-- 
-- \<note>Note: face indices within a collection are zero-based.\<\/note>
-- 
-- /Since: 0.9.2/
faceGetIndex ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: A face object
    -> m Word32
    -- ^ __Returns:__ The index of /@face@/.
faceGetIndex face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_face_get_index face'
    touchManagedPtr face
    return result


-- function face_get_glyph_count
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "const hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A face object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_get_glyph_count" hb_face_get_glyph_count :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Word32

-- | Fetches the glyph-count value of the specified face object.
-- 
-- /Since: 0.9.7/
faceGetGlyphCount ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: A face object
    -> m Word32
    -- ^ __Returns:__ The glyph-count value of /@face@/
faceGetGlyphCount face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_face_get_glyph_count face'
    touchManagedPtr face
    return result


-- function face_get_empty
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "face_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_get_empty" hb_face_get_empty :: 
    IO (Ptr HarfBuzz.FaceT.FaceT)

-- | Fetches the singleton empty face object.
-- 
-- /Since: 0.9.2/
faceGetEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.FaceT.FaceT
    -- ^ __Returns:__ The empty face object
faceGetEmpty  = liftIO $ do
    result <- hb_face_get_empty
    checkUnexpectedReturnNULL "faceGetEmpty" result
    result' <- (wrapBoxed HarfBuzz.FaceT.FaceT) result
    return result'


-- function face_create_or_fail_using
-- Args: [ Arg
--           { argCName = "blob"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_blob_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the face within @blob"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "loader_name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name of the loader to use, or `NULL`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "face_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_create_or_fail_using" hb_face_create_or_fail_using :: 
    Ptr HarfBuzz.BlobT.BlobT ->             -- blob : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    Word32 ->                               -- index : TBasicType TUInt
    CString ->                              -- loader_name : TBasicType TUTF8
    IO (Ptr HarfBuzz.FaceT.FaceT)

-- | A thin wrapper around the face loader functions registered with HarfBuzz.
-- If /@loaderName@/ is @NULL@ or the empty string, the first available loader
-- is used.
-- 
-- For example, the FreeType (\"ft\") loader might be able to load
-- WOFF and WOFF2 files if FreeType is built with those features,
-- whereas the OpenType (\"ot\") loader will not.
-- 
-- /Since: 11.0.0/
faceCreateOrFailUsing ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BlobT.BlobT
    -- ^ /@blob@/: t'GI.HarfBuzz.Structs.BlobT.BlobT' to work upon
    -> Word32
    -- ^ /@index@/: The index of the face within /@blob@/
    -> Maybe (T.Text)
    -- ^ /@loaderName@/: The name of the loader to use, or @NULL@
    -> m HarfBuzz.FaceT.FaceT
    -- ^ __Returns:__ The new face object, or @NULL@ if
    -- the loader fails to load the face.
faceCreateOrFailUsing blob index loaderName = liftIO $ do
    blob' <- unsafeManagedPtrGetPtr blob
    maybeLoaderName <- case loaderName of
        Nothing -> return FP.nullPtr
        Just jLoaderName -> do
            jLoaderName' <- textToCString jLoaderName
            return jLoaderName'
    result <- hb_face_create_or_fail_using blob' index maybeLoaderName
    checkUnexpectedReturnNULL "faceCreateOrFailUsing" result
    result' <- (wrapBoxed HarfBuzz.FaceT.FaceT) result
    touchManagedPtr blob
    freeMem maybeLoaderName
    return result'


-- function face_create_or_fail
-- Args: [ Arg
--           { argCName = "blob"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_blob_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the face within @blob"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "face_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_create_or_fail" hb_face_create_or_fail :: 
    Ptr HarfBuzz.BlobT.BlobT ->             -- blob : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    Word32 ->                               -- index : TBasicType TUInt
    IO (Ptr HarfBuzz.FaceT.FaceT)

-- | Like 'GI.HarfBuzz.Functions.faceCreate', but returns @NULL@ if the blob data
-- contains no usable font face at the specified index.
-- 
-- /Since: 10.1.0/
faceCreateOrFail ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BlobT.BlobT
    -- ^ /@blob@/: t'GI.HarfBuzz.Structs.BlobT.BlobT' to work upon
    -> Word32
    -- ^ /@index@/: The index of the face within /@blob@/
    -> m HarfBuzz.FaceT.FaceT
    -- ^ __Returns:__ The new face object, or @NULL@ if
    -- no face is found at the specified index.
faceCreateOrFail blob index = liftIO $ do
    blob' <- unsafeManagedPtrGetPtr blob
    result <- hb_face_create_or_fail blob' index
    checkUnexpectedReturnNULL "faceCreateOrFail" result
    result' <- (wrapBoxed HarfBuzz.FaceT.FaceT) result
    touchManagedPtr blob
    return result'


-- function face_create_from_file_or_fail_using
-- Args: [ Arg
--           { argCName = "file_name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A font filename" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the face within the file"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "loader_name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name of the loader to use, or `NULL`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "face_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_create_from_file_or_fail_using" hb_face_create_from_file_or_fail_using :: 
    CString ->                              -- file_name : TBasicType TUTF8
    Word32 ->                               -- index : TBasicType TUInt
    CString ->                              -- loader_name : TBasicType TUTF8
    IO (Ptr HarfBuzz.FaceT.FaceT)

-- | A thin wrapper around the face loader functions registered with HarfBuzz.
-- If /@loaderName@/ is @NULL@ or the empty string, the first available loader
-- is used.
-- 
-- For example, the FreeType (\"ft\") loader might be able to load
-- WOFF and WOFF2 files if FreeType is built with those features,
-- whereas the OpenType (\"ot\") loader will not.
-- 
-- /Since: 11.0.0/
faceCreateFromFileOrFailUsing ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@fileName@/: A font filename
    -> Word32
    -- ^ /@index@/: The index of the face within the file
    -> Maybe (T.Text)
    -- ^ /@loaderName@/: The name of the loader to use, or @NULL@
    -> m HarfBuzz.FaceT.FaceT
    -- ^ __Returns:__ The new face object, or @NULL@ if
    -- the file cannot be read or the loader fails to load the face.
faceCreateFromFileOrFailUsing fileName index loaderName = liftIO $ do
    fileName' <- textToCString fileName
    maybeLoaderName <- case loaderName of
        Nothing -> return FP.nullPtr
        Just jLoaderName -> do
            jLoaderName' <- textToCString jLoaderName
            return jLoaderName'
    result <- hb_face_create_from_file_or_fail_using fileName' index maybeLoaderName
    checkUnexpectedReturnNULL "faceCreateFromFileOrFailUsing" result
    result' <- (wrapBoxed HarfBuzz.FaceT.FaceT) result
    freeMem fileName'
    freeMem maybeLoaderName
    return result'


-- function face_create_from_file_or_fail
-- Args: [ Arg
--           { argCName = "file_name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A font filename" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the face within the file"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "face_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_create_from_file_or_fail" hb_face_create_from_file_or_fail :: 
    CString ->                              -- file_name : TBasicType TUTF8
    Word32 ->                               -- index : TBasicType TUInt
    IO (Ptr HarfBuzz.FaceT.FaceT)

-- | A thin wrapper around 'GI.HarfBuzz.Functions.blobCreateFromFileOrFail'
-- followed by 'GI.HarfBuzz.Functions.faceCreateOrFail'.
-- 
-- /Since: 10.1.0/
faceCreateFromFileOrFail ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@fileName@/: A font filename
    -> Word32
    -- ^ /@index@/: The index of the face within the file
    -> m HarfBuzz.FaceT.FaceT
    -- ^ __Returns:__ The new face object, or @NULL@ if
    -- no face is found at the specified index or the file cannot be read.
faceCreateFromFileOrFail fileName index = liftIO $ do
    fileName' <- textToCString fileName
    result <- hb_face_create_from_file_or_fail fileName' index
    checkUnexpectedReturnNULL "faceCreateFromFileOrFail" result
    result' <- (wrapBoxed HarfBuzz.FaceT.FaceT) result
    freeMem fileName'
    return result'


-- function face_create_for_tables
-- XXX Could not generate function face_create_for_tables

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function face_create
-- Args: [ Arg
--           { argCName = "blob"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_blob_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The index of the face within @blob"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "face_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_create" hb_face_create :: 
    Ptr HarfBuzz.BlobT.BlobT ->             -- blob : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    Word32 ->                               -- index : TBasicType TUInt
    IO (Ptr HarfBuzz.FaceT.FaceT)

-- | Constructs a new face object from the specified blob and
-- a face index into that blob.
-- 
-- The face index is used for blobs of file formats such as TTC and
-- DFont that can contain more than one face.  Face indices within
-- such collections are zero-based.
-- 
-- \<note>Note: If the blob font format is not a collection, /@index@/
-- is ignored.  Otherwise, only the lower 16-bits of /@index@/ are used.
-- The unmodified /@index@/ can be accessed via 'GI.HarfBuzz.Functions.faceGetIndex'.\<\/note>
-- 
-- \<note>Note: The high 16-bits of /@index@/, if non-zero, are used by
-- 'GI.HarfBuzz.Functions.fontCreate' to load named-instances in variable fonts.  See
-- 'GI.HarfBuzz.Functions.fontCreate' for details.\<\/note>
-- 
-- /Since: 0.9.2/
faceCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BlobT.BlobT
    -- ^ /@blob@/: t'GI.HarfBuzz.Structs.BlobT.BlobT' to work upon
    -> Word32
    -- ^ /@index@/: The index of the face within /@blob@/
    -> m HarfBuzz.FaceT.FaceT
    -- ^ __Returns:__ The new face object
faceCreate blob index = liftIO $ do
    blob' <- unsafeManagedPtrGetPtr blob
    result <- hb_face_create blob' index
    checkUnexpectedReturnNULL "faceCreate" result
    result' <- (wrapBoxed HarfBuzz.FaceT.FaceT) result
    touchManagedPtr blob
    return result'


-- function face_count
-- Args: [ Arg
--           { argCName = "blob"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a blob." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_count" hb_face_count :: 
    Ptr HarfBuzz.BlobT.BlobT ->             -- blob : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    IO Word32

-- | Fetches the number of faces in a blob.
-- 
-- /Since: 1.7.7/
faceCount ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BlobT.BlobT
    -- ^ /@blob@/: a blob.
    -> m Word32
    -- ^ __Returns:__ Number of faces in /@blob@/
faceCount blob = liftIO $ do
    blob' <- unsafeManagedPtrGetPtr blob
    result <- hb_face_count blob'
    touchManagedPtr blob
    return result


-- function face_collect_variation_unicodes
-- XXX Could not generate function face_collect_variation_unicodes

-- Not implemented: Don't know how to allocate "out" of type TInterface (Name {namespace = "HarfBuzz", name = "set_t"})

-- function face_collect_variation_selectors
-- XXX Could not generate function face_collect_variation_selectors

-- Not implemented: Don't know how to allocate "out" of type TInterface (Name {namespace = "HarfBuzz", name = "set_t"})

-- function face_collect_unicodes
-- XXX Could not generate function face_collect_unicodes

-- Not implemented: Don't know how to allocate "out" of type TInterface (Name {namespace = "HarfBuzz", name = "set_t"})

-- function face_collect_nominal_glyph_mapping
-- XXX Could not generate function face_collect_nominal_glyph_mapping

-- Not implemented: Don't know how to allocate "mapping" of type TInterface (Name {namespace = "HarfBuzz", name = "map_t"})

-- function face_builder_sort_tables
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "A face object created with hb_face_builder_create()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "tags"
--           , argType = TCArray True (-1) (-1) (TBasicType TUInt32)
--           , argCType = Just "const hb_tag_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "ordered list of table tags terminated by\n  %HB_TAG_NONE"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_builder_sort_tables" hb_face_builder_sort_tables :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Ptr Word32 ->                           -- tags : TCArray True (-1) (-1) (TBasicType TUInt32)
    IO ()

-- | Set the ordering of tables for serialization. Any tables not
-- specified in the tags list will be ordered after the tables in
-- tags, ordered by the default sort ordering.
-- 
-- /Since: 5.3.0/
faceBuilderSortTables ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: A face object created with 'GI.HarfBuzz.Functions.faceBuilderCreate'
    -> [Word32]
    -- ^ /@tags@/: ordered list of table tags terminated by
    --   @/HB_TAG_NONE/@
    -> m ()
faceBuilderSortTables face tags = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    tags' <- packZeroTerminatedStorableArray tags
    hb_face_builder_sort_tables face' tags'
    touchManagedPtr face
    freeMem tags'
    return ()


-- function face_builder_create
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "face_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_builder_create" hb_face_builder_create :: 
    IO (Ptr HarfBuzz.FaceT.FaceT)

-- | Creates a t'GI.HarfBuzz.Structs.FaceT.FaceT' that can be used with 'GI.HarfBuzz.Functions.faceBuilderAddTable'.
-- After tables are added to the face, it can be compiled to a binary
-- font file by calling 'GI.HarfBuzz.Functions.faceReferenceBlob'.
-- 
-- /Since: 1.9.0/
faceBuilderCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.FaceT.FaceT
    -- ^ __Returns:__ New face.
faceBuilderCreate  = liftIO $ do
    result <- hb_face_builder_create
    checkUnexpectedReturnNULL "faceBuilderCreate" result
    result' <- (wrapBoxed HarfBuzz.FaceT.FaceT) result
    return result'


-- function face_builder_add_table
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "A face object created with hb_face_builder_create()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "tag"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_tag_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_tag_t of the table to add"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "blob"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The blob containing the table data to add"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_face_builder_add_table" hb_face_builder_add_table :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- tag : TBasicType TUInt32
    Ptr HarfBuzz.BlobT.BlobT ->             -- blob : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    IO Int32

-- | Add table for /@tag@/ with data provided by /@blob@/ to the face.  /@face@/ must
-- be created using 'GI.HarfBuzz.Functions.faceBuilderCreate'.
-- 
-- /Since: 1.9.0/
faceBuilderAddTable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: A face object created with 'GI.HarfBuzz.Functions.faceBuilderCreate'
    -> Word32
    -- ^ /@tag@/: The @/hb_tag_t/@ of the table to add
    -> HarfBuzz.BlobT.BlobT
    -- ^ /@blob@/: The blob containing the table data to add
    -> m Int32
faceBuilderAddTable face tag blob = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    blob' <- unsafeManagedPtrGetPtr blob
    result <- hb_face_builder_add_table face' tag blob'
    touchManagedPtr face
    touchManagedPtr blob
    return result


-- function draw_rectangle
-- Args: [ Arg
--           { argCName = "dfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_funcs_t" }
--           , argCType = Just "hb_draw_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "draw functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "draw_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated draw data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "st"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_state_t" }
--           , argCType = Just "hb_draw_state_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "current draw state" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "top-left X coordinate"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "top-left Y coordinate"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "w"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "width (may be negative)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "h"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "height (may be negative)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stroke_width"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "stroke width, or `NaN` for a filled rectangle"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_draw_rectangle" hb_draw_rectangle :: 
    Ptr HarfBuzz.DrawFuncsT.DrawFuncsT ->   -- dfuncs : TInterface (Name {namespace = "HarfBuzz", name = "draw_funcs_t"})
    Ptr () ->                               -- draw_data : TBasicType TPtr
    Ptr HarfBuzz.DrawStateT.DrawStateT ->   -- st : TInterface (Name {namespace = "HarfBuzz", name = "draw_state_t"})
    CFloat ->                               -- x : TBasicType TFloat
    CFloat ->                               -- y : TBasicType TFloat
    CFloat ->                               -- w : TBasicType TFloat
    CFloat ->                               -- h : TBasicType TFloat
    CFloat ->                               -- stroke_width : TBasicType TFloat
    IO ()

-- | Emits an axis-aligned rectangle.  If /@strokeWidth@/ is a finite
-- positive value, the rectangle is rendered as an outlined ring
-- of that thickness centered on the edges; if /@strokeWidth@/ is
-- @NaN@, the rectangle is rendered filled.
-- 
-- Note: stroked rectangles produce a bounding box covering the
-- full outer rectangle, so if the pen is a GPU fragment-shader
-- backend, the shader runs for every interior pixel even though
-- only the outline contributes coverage.  For very thin
-- outlines where the interior is much larger than the stroke,
-- emitting four 'GI.HarfBuzz.Functions.drawLine' segments (one per edge) is
-- considerably cheaper per frame.
-- 
-- /Since: 14.2.0/
drawRectangle ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ /@dfuncs@/: draw functions
    -> Ptr ()
    -- ^ /@drawData@/: associated draw data passed by the caller
    -> HarfBuzz.DrawStateT.DrawStateT
    -- ^ /@st@/: current draw state
    -> Float
    -- ^ /@x@/: top-left X coordinate
    -> Float
    -- ^ /@y@/: top-left Y coordinate
    -> Float
    -- ^ /@w@/: width (may be negative)
    -> Float
    -- ^ /@h@/: height (may be negative)
    -> Float
    -- ^ /@strokeWidth@/: stroke width, or @NaN@ for a filled rectangle
    -> m ()
drawRectangle dfuncs drawData st x y w h strokeWidth = liftIO $ do
    dfuncs' <- unsafeManagedPtrGetPtr dfuncs
    st' <- unsafeManagedPtrGetPtr st
    let x' = realToFrac x
    let y' = realToFrac y
    let w' = realToFrac w
    let h' = realToFrac h
    let strokeWidth' = realToFrac strokeWidth
    hb_draw_rectangle dfuncs' drawData st' x' y' w' h' strokeWidth'
    touchManagedPtr dfuncs
    touchManagedPtr st
    return ()


-- function draw_quadratic_to
-- Args: [ Arg
--           { argCName = "dfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_funcs_t" }
--           , argCType = Just "hb_draw_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "draw functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "draw_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated draw data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "st"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_state_t" }
--           , argCType = Just "hb_draw_state_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "current draw state" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "control_x"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "X component of control point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "control_y"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Y component of control point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "to_x"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "X component of target point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "to_y"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Y component of target point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_draw_quadratic_to" hb_draw_quadratic_to :: 
    Ptr HarfBuzz.DrawFuncsT.DrawFuncsT ->   -- dfuncs : TInterface (Name {namespace = "HarfBuzz", name = "draw_funcs_t"})
    Ptr () ->                               -- draw_data : TBasicType TPtr
    Ptr HarfBuzz.DrawStateT.DrawStateT ->   -- st : TInterface (Name {namespace = "HarfBuzz", name = "draw_state_t"})
    CFloat ->                               -- control_x : TBasicType TFloat
    CFloat ->                               -- control_y : TBasicType TFloat
    CFloat ->                               -- to_x : TBasicType TFloat
    CFloat ->                               -- to_y : TBasicType TFloat
    IO ()

-- | Perform a \"quadratic-to\" draw operation.
-- 
-- /Since: 4.0.0/
drawQuadraticTo ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ /@dfuncs@/: draw functions
    -> Ptr ()
    -- ^ /@drawData@/: associated draw data passed by the caller
    -> HarfBuzz.DrawStateT.DrawStateT
    -- ^ /@st@/: current draw state
    -> Float
    -- ^ /@controlX@/: X component of control point
    -> Float
    -- ^ /@controlY@/: Y component of control point
    -> Float
    -- ^ /@toX@/: X component of target point
    -> Float
    -- ^ /@toY@/: Y component of target point
    -> m ()
drawQuadraticTo dfuncs drawData st controlX controlY toX toY = liftIO $ do
    dfuncs' <- unsafeManagedPtrGetPtr dfuncs
    st' <- unsafeManagedPtrGetPtr st
    let controlX' = realToFrac controlX
    let controlY' = realToFrac controlY
    let toX' = realToFrac toX
    let toY' = realToFrac toY
    hb_draw_quadratic_to dfuncs' drawData st' controlX' controlY' toX' toY'
    touchManagedPtr dfuncs
    touchManagedPtr st
    return ()


-- function draw_move_to
-- Args: [ Arg
--           { argCName = "dfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_funcs_t" }
--           , argCType = Just "hb_draw_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "draw functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "draw_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated draw data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "st"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_state_t" }
--           , argCType = Just "hb_draw_state_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "current draw state" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "to_x"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "X component of target point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "to_y"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Y component of target point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_draw_move_to" hb_draw_move_to :: 
    Ptr HarfBuzz.DrawFuncsT.DrawFuncsT ->   -- dfuncs : TInterface (Name {namespace = "HarfBuzz", name = "draw_funcs_t"})
    Ptr () ->                               -- draw_data : TBasicType TPtr
    Ptr HarfBuzz.DrawStateT.DrawStateT ->   -- st : TInterface (Name {namespace = "HarfBuzz", name = "draw_state_t"})
    CFloat ->                               -- to_x : TBasicType TFloat
    CFloat ->                               -- to_y : TBasicType TFloat
    IO ()

-- | Perform a \"move-to\" draw operation.
-- 
-- /Since: 4.0.0/
drawMoveTo ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ /@dfuncs@/: draw functions
    -> Ptr ()
    -- ^ /@drawData@/: associated draw data passed by the caller
    -> HarfBuzz.DrawStateT.DrawStateT
    -- ^ /@st@/: current draw state
    -> Float
    -- ^ /@toX@/: X component of target point
    -> Float
    -- ^ /@toY@/: Y component of target point
    -> m ()
drawMoveTo dfuncs drawData st toX toY = liftIO $ do
    dfuncs' <- unsafeManagedPtrGetPtr dfuncs
    st' <- unsafeManagedPtrGetPtr st
    let toX' = realToFrac toX
    let toY' = realToFrac toY
    hb_draw_move_to dfuncs' drawData st' toX' toY'
    touchManagedPtr dfuncs
    touchManagedPtr st
    return ()


-- function draw_line_to
-- Args: [ Arg
--           { argCName = "dfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_funcs_t" }
--           , argCType = Just "hb_draw_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "draw functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "draw_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated draw data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "st"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_state_t" }
--           , argCType = Just "hb_draw_state_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "current draw state" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "to_x"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "X component of target point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "to_y"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Y component of target point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_draw_line_to" hb_draw_line_to :: 
    Ptr HarfBuzz.DrawFuncsT.DrawFuncsT ->   -- dfuncs : TInterface (Name {namespace = "HarfBuzz", name = "draw_funcs_t"})
    Ptr () ->                               -- draw_data : TBasicType TPtr
    Ptr HarfBuzz.DrawStateT.DrawStateT ->   -- st : TInterface (Name {namespace = "HarfBuzz", name = "draw_state_t"})
    CFloat ->                               -- to_x : TBasicType TFloat
    CFloat ->                               -- to_y : TBasicType TFloat
    IO ()

-- | Perform a \"line-to\" draw operation.
-- 
-- /Since: 4.0.0/
drawLineTo ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ /@dfuncs@/: draw functions
    -> Ptr ()
    -- ^ /@drawData@/: associated draw data passed by the caller
    -> HarfBuzz.DrawStateT.DrawStateT
    -- ^ /@st@/: current draw state
    -> Float
    -- ^ /@toX@/: X component of target point
    -> Float
    -- ^ /@toY@/: Y component of target point
    -> m ()
drawLineTo dfuncs drawData st toX toY = liftIO $ do
    dfuncs' <- unsafeManagedPtrGetPtr dfuncs
    st' <- unsafeManagedPtrGetPtr st
    let toX' = realToFrac toX
    let toY' = realToFrac toY
    hb_draw_line_to dfuncs' drawData st' toX' toY'
    touchManagedPtr dfuncs
    touchManagedPtr st
    return ()


-- function draw_line
-- Args: [ Arg
--           { argCName = "dfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_funcs_t" }
--           , argCType = Just "hb_draw_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "draw functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "draw_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated draw data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "st"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_state_t" }
--           , argCType = Just "hb_draw_state_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "current draw state" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "start X coordinate" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "start Y coordinate" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "w0"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "stroke width at the start"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "x1"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "end X coordinate" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "y1"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "end Y coordinate" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "w1"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "stroke width at the end"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cap"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "draw_line_cap_t" }
--           , argCType = Just "hb_draw_line_cap_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "end-cap shape (butt or square)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_draw_line" hb_draw_line :: 
    Ptr HarfBuzz.DrawFuncsT.DrawFuncsT ->   -- dfuncs : TInterface (Name {namespace = "HarfBuzz", name = "draw_funcs_t"})
    Ptr () ->                               -- draw_data : TBasicType TPtr
    Ptr HarfBuzz.DrawStateT.DrawStateT ->   -- st : TInterface (Name {namespace = "HarfBuzz", name = "draw_state_t"})
    CFloat ->                               -- x0 : TBasicType TFloat
    CFloat ->                               -- y0 : TBasicType TFloat
    CFloat ->                               -- w0 : TBasicType TFloat
    CFloat ->                               -- x1 : TBasicType TFloat
    CFloat ->                               -- y1 : TBasicType TFloat
    CFloat ->                               -- w1 : TBasicType TFloat
    CUInt ->                                -- cap : TInterface (Name {namespace = "HarfBuzz", name = "draw_line_cap_t"})
    IO ()

-- | Emits a tapered line segment as a filled trapezoid.  /@w0@/ and
-- /@w1@/ are the full stroke widths at the start and end points
-- respectively; they may differ for a tapered stroke or match
-- for a uniform one.  Pass @NaN@ for /@w1@/ to use /@w0@/ (uniform
-- stroke) without repeating the value.
-- 
-- With @/HB_DRAW_LINE_CAP_SQUARE/@ each endpoint is extended along
-- the line direction by half its local stroke width, so four
-- @hb_draw_line()@ calls form a closed rectangle without gaps
-- at the corners.
-- 
-- /Since: 14.2.0/
drawLine ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ /@dfuncs@/: draw functions
    -> Ptr ()
    -- ^ /@drawData@/: associated draw data passed by the caller
    -> HarfBuzz.DrawStateT.DrawStateT
    -- ^ /@st@/: current draw state
    -> Float
    -- ^ /@x0@/: start X coordinate
    -> Float
    -- ^ /@y0@/: start Y coordinate
    -> Float
    -- ^ /@w0@/: stroke width at the start
    -> Float
    -- ^ /@x1@/: end X coordinate
    -> Float
    -- ^ /@y1@/: end Y coordinate
    -> Float
    -- ^ /@w1@/: stroke width at the end
    -> HarfBuzz.Enums.DrawLineCapT
    -- ^ /@cap@/: end-cap shape (butt or square)
    -> m ()
drawLine dfuncs drawData st x0 y0 w0 x1 y1 w1 cap = liftIO $ do
    dfuncs' <- unsafeManagedPtrGetPtr dfuncs
    st' <- unsafeManagedPtrGetPtr st
    let x0' = realToFrac x0
    let y0' = realToFrac y0
    let w0' = realToFrac w0
    let x1' = realToFrac x1
    let y1' = realToFrac y1
    let w1' = realToFrac w1
    let cap' = (fromIntegral . fromEnum) cap
    hb_draw_line dfuncs' drawData st' x0' y0' w0' x1' y1' w1' cap'
    touchManagedPtr dfuncs
    touchManagedPtr st
    return ()


-- function draw_funcs_set_quadratic_to_func
-- XXX Could not generate function draw_funcs_set_quadratic_to_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function draw_funcs_set_move_to_func
-- XXX Could not generate function draw_funcs_set_move_to_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function draw_funcs_set_line_to_func
-- XXX Could not generate function draw_funcs_set_line_to_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function draw_funcs_set_cubic_to_func
-- XXX Could not generate function draw_funcs_set_cubic_to_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function draw_funcs_set_close_path_func
-- XXX Could not generate function draw_funcs_set_close_path_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function draw_funcs_make_immutable
-- Args: [ Arg
--           { argCName = "dfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_funcs_t" }
--           , argCType = Just "hb_draw_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "draw functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_draw_funcs_make_immutable" hb_draw_funcs_make_immutable :: 
    Ptr HarfBuzz.DrawFuncsT.DrawFuncsT ->   -- dfuncs : TInterface (Name {namespace = "HarfBuzz", name = "draw_funcs_t"})
    IO ()

-- | Makes /@dfuncs@/ object immutable.
-- 
-- /Since: 4.0.0/
drawFuncsMakeImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ /@dfuncs@/: draw functions
    -> m ()
drawFuncsMakeImmutable dfuncs = liftIO $ do
    dfuncs' <- unsafeManagedPtrGetPtr dfuncs
    hb_draw_funcs_make_immutable dfuncs'
    touchManagedPtr dfuncs
    return ()


-- function draw_funcs_is_immutable
-- Args: [ Arg
--           { argCName = "dfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_funcs_t" }
--           , argCType = Just "hb_draw_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "draw functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_draw_funcs_is_immutable" hb_draw_funcs_is_immutable :: 
    Ptr HarfBuzz.DrawFuncsT.DrawFuncsT ->   -- dfuncs : TInterface (Name {namespace = "HarfBuzz", name = "draw_funcs_t"})
    IO Int32

-- | Checks whether /@dfuncs@/ is immutable.
-- 
-- /Since: 4.0.0/
drawFuncsIsImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ /@dfuncs@/: draw functions
    -> m Int32
    -- ^ __Returns:__ @true@ if /@dfuncs@/ is immutable, @false@ otherwise
drawFuncsIsImmutable dfuncs = liftIO $ do
    dfuncs' <- unsafeManagedPtrGetPtr dfuncs
    result <- hb_draw_funcs_is_immutable dfuncs'
    touchManagedPtr dfuncs
    return result


-- function draw_funcs_get_empty
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "draw_funcs_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_draw_funcs_get_empty" hb_draw_funcs_get_empty :: 
    IO (Ptr HarfBuzz.DrawFuncsT.DrawFuncsT)

-- | Fetches the singleton empty draw-functions structure.
-- 
-- /Since: 7.0.0/
drawFuncsGetEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ __Returns:__ The empty draw-functions structure
drawFuncsGetEmpty  = liftIO $ do
    result <- hb_draw_funcs_get_empty
    checkUnexpectedReturnNULL "drawFuncsGetEmpty" result
    result' <- (wrapBoxed HarfBuzz.DrawFuncsT.DrawFuncsT) result
    return result'


-- function draw_funcs_create
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "draw_funcs_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_draw_funcs_create" hb_draw_funcs_create :: 
    IO (Ptr HarfBuzz.DrawFuncsT.DrawFuncsT)

-- | Creates a new draw callbacks object.
-- 
-- /Since: 4.0.0/
drawFuncsCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ __Returns:__ 
    -- A newly allocated t'GI.HarfBuzz.Structs.DrawFuncsT.DrawFuncsT' with a reference count of 1. The initial
    -- reference count should be released with hb_draw_funcs_destroy when you are
    -- done using the t'GI.HarfBuzz.Structs.DrawFuncsT.DrawFuncsT'. This function never returns @NULL@. If
    -- memory cannot be allocated, a special singleton t'GI.HarfBuzz.Structs.DrawFuncsT.DrawFuncsT' object will
    -- be returned.
drawFuncsCreate  = liftIO $ do
    result <- hb_draw_funcs_create
    checkUnexpectedReturnNULL "drawFuncsCreate" result
    result' <- (wrapBoxed HarfBuzz.DrawFuncsT.DrawFuncsT) result
    return result'


-- function draw_cubic_to
-- Args: [ Arg
--           { argCName = "dfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_funcs_t" }
--           , argCType = Just "hb_draw_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "draw functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "draw_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated draw data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "st"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_state_t" }
--           , argCType = Just "hb_draw_state_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "current draw state" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "control1_x"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "X component of first control point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "control1_y"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Y component of first control point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "control2_x"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "X component of second control point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "control2_y"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Y component of second control point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "to_x"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "X component of target point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "to_y"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Y component of target point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_draw_cubic_to" hb_draw_cubic_to :: 
    Ptr HarfBuzz.DrawFuncsT.DrawFuncsT ->   -- dfuncs : TInterface (Name {namespace = "HarfBuzz", name = "draw_funcs_t"})
    Ptr () ->                               -- draw_data : TBasicType TPtr
    Ptr HarfBuzz.DrawStateT.DrawStateT ->   -- st : TInterface (Name {namespace = "HarfBuzz", name = "draw_state_t"})
    CFloat ->                               -- control1_x : TBasicType TFloat
    CFloat ->                               -- control1_y : TBasicType TFloat
    CFloat ->                               -- control2_x : TBasicType TFloat
    CFloat ->                               -- control2_y : TBasicType TFloat
    CFloat ->                               -- to_x : TBasicType TFloat
    CFloat ->                               -- to_y : TBasicType TFloat
    IO ()

-- | Perform a \"cubic-to\" draw operation.
-- 
-- /Since: 4.0.0/
drawCubicTo ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ /@dfuncs@/: draw functions
    -> Ptr ()
    -- ^ /@drawData@/: associated draw data passed by the caller
    -> HarfBuzz.DrawStateT.DrawStateT
    -- ^ /@st@/: current draw state
    -> Float
    -- ^ /@control1X@/: X component of first control point
    -> Float
    -- ^ /@control1Y@/: Y component of first control point
    -> Float
    -- ^ /@control2X@/: X component of second control point
    -> Float
    -- ^ /@control2Y@/: Y component of second control point
    -> Float
    -- ^ /@toX@/: X component of target point
    -> Float
    -- ^ /@toY@/: Y component of target point
    -> m ()
drawCubicTo dfuncs drawData st control1X control1Y control2X control2Y toX toY = liftIO $ do
    dfuncs' <- unsafeManagedPtrGetPtr dfuncs
    st' <- unsafeManagedPtrGetPtr st
    let control1X' = realToFrac control1X
    let control1Y' = realToFrac control1Y
    let control2X' = realToFrac control2X
    let control2Y' = realToFrac control2Y
    let toX' = realToFrac toX
    let toY' = realToFrac toY
    hb_draw_cubic_to dfuncs' drawData st' control1X' control1Y' control2X' control2Y' toX' toY'
    touchManagedPtr dfuncs
    touchManagedPtr st
    return ()


-- function draw_close_path
-- Args: [ Arg
--           { argCName = "dfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_funcs_t" }
--           , argCType = Just "hb_draw_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "draw functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "draw_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated draw data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "st"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_state_t" }
--           , argCType = Just "hb_draw_state_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "current draw state" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_draw_close_path" hb_draw_close_path :: 
    Ptr HarfBuzz.DrawFuncsT.DrawFuncsT ->   -- dfuncs : TInterface (Name {namespace = "HarfBuzz", name = "draw_funcs_t"})
    Ptr () ->                               -- draw_data : TBasicType TPtr
    Ptr HarfBuzz.DrawStateT.DrawStateT ->   -- st : TInterface (Name {namespace = "HarfBuzz", name = "draw_state_t"})
    IO ()

-- | Perform a \"close-path\" draw operation.
-- 
-- /Since: 4.0.0/
drawClosePath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ /@dfuncs@/: draw functions
    -> Ptr ()
    -- ^ /@drawData@/: associated draw data passed by the caller
    -> HarfBuzz.DrawStateT.DrawStateT
    -- ^ /@st@/: current draw state
    -> m ()
drawClosePath dfuncs drawData st = liftIO $ do
    dfuncs' <- unsafeManagedPtrGetPtr dfuncs
    st' <- unsafeManagedPtrGetPtr st
    hb_draw_close_path dfuncs' drawData st'
    touchManagedPtr dfuncs
    touchManagedPtr st
    return ()


-- function draw_circle
-- Args: [ Arg
--           { argCName = "dfuncs"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_funcs_t" }
--           , argCType = Just "hb_draw_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "draw functions" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "draw_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "void*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "associated draw data passed by the caller"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "st"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "draw_state_t" }
--           , argCType = Just "hb_draw_state_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "current draw state" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cx"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "center X coordinate"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cy"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "center Y coordinate"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "r"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "radius" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stroke_width"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "stroke width, or `NaN` for a filled disc"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_draw_circle" hb_draw_circle :: 
    Ptr HarfBuzz.DrawFuncsT.DrawFuncsT ->   -- dfuncs : TInterface (Name {namespace = "HarfBuzz", name = "draw_funcs_t"})
    Ptr () ->                               -- draw_data : TBasicType TPtr
    Ptr HarfBuzz.DrawStateT.DrawStateT ->   -- st : TInterface (Name {namespace = "HarfBuzz", name = "draw_state_t"})
    CFloat ->                               -- cx : TBasicType TFloat
    CFloat ->                               -- cy : TBasicType TFloat
    CFloat ->                               -- r : TBasicType TFloat
    CFloat ->                               -- stroke_width : TBasicType TFloat
    IO ()

-- | Emits a circle approximated by four cubic Bezier curves.  If
-- /@strokeWidth@/ is a finite positive value, the circle is
-- rendered as an outlined ring of that thickness centered on
-- the nominal radius; if /@strokeWidth@/ is @NaN@, the circle is
-- rendered as a filled disc.
-- 
-- /Since: 14.2.0/
drawCircle ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.DrawFuncsT.DrawFuncsT
    -- ^ /@dfuncs@/: draw functions
    -> Ptr ()
    -- ^ /@drawData@/: associated draw data passed by the caller
    -> HarfBuzz.DrawStateT.DrawStateT
    -- ^ /@st@/: current draw state
    -> Float
    -- ^ /@cx@/: center X coordinate
    -> Float
    -- ^ /@cy@/: center Y coordinate
    -> Float
    -- ^ /@r@/: radius
    -> Float
    -- ^ /@strokeWidth@/: stroke width, or @NaN@ for a filled disc
    -> m ()
drawCircle dfuncs drawData st cx cy r strokeWidth = liftIO $ do
    dfuncs' <- unsafeManagedPtrGetPtr dfuncs
    st' <- unsafeManagedPtrGetPtr st
    let cx' = realToFrac cx
    let cy' = realToFrac cy
    let r' = realToFrac r
    let strokeWidth' = realToFrac strokeWidth
    hb_draw_circle dfuncs' drawData st' cx' cy' r' strokeWidth'
    touchManagedPtr dfuncs
    touchManagedPtr st
    return ()


-- function direction_to_string
-- Args: [ Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The #hb_direction_t to convert"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "hb_direction_to_string" hb_direction_to_string :: 
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    IO CString

-- | Converts an t'GI.HarfBuzz.Enums.DirectionT' to a string.
-- 
-- /Since: 0.9.2/
directionToString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: The t'GI.HarfBuzz.Enums.DirectionT' to convert
    -> m T.Text
    -- ^ __Returns:__ The string corresponding to /@direction@/
directionToString direction = liftIO $ do
    let direction' = (fromIntegral . fromEnum) direction
    result <- hb_direction_to_string direction'
    checkUnexpectedReturnNULL "directionToString" result
    result' <- cstringToText result
    return result'


-- function direction_from_string
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "String to convert" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Length of @str, or -1 if it is `NULL`-terminated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "Length of @str, or -1 if it is `NULL`-terminated"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "direction_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_direction_from_string" hb_direction_from_string :: 
    Ptr Word8 ->                            -- str : TCArray False (-1) 1 (TBasicType TUInt8)
    Int32 ->                                -- len : TBasicType TInt
    IO CUInt

-- | Converts a string to an t'GI.HarfBuzz.Enums.DirectionT'.
-- 
-- Matching is loose and applies only to the first letter. For
-- examples, \"LTR\" and \"left-to-right\" will both return @/HB_DIRECTION_LTR/@.
-- 
-- Unmatched strings will return @/HB_DIRECTION_INVALID/@.
-- 
-- /Since: 0.9.2/
directionFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@str@/: String to convert
    -> m HarfBuzz.Enums.DirectionT
    -- ^ __Returns:__ The t'GI.HarfBuzz.Enums.DirectionT' matching /@str@/
directionFromString str = liftIO $ do
    let len = fromIntegral $ B.length str
    str' <- packByteString str
    result <- hb_direction_from_string str' len
    let result' = (toEnum . fromIntegral) result
    freeMem str'
    return result'


-- function color_line_get_extend
-- Args: [ Arg
--           { argCName = "color_line"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "color_line_t" }
--           , argCType = Just "hb_color_line_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #hb_color_line_t object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "paint_extend_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_color_line_get_extend" hb_color_line_get_extend :: 
    Ptr HarfBuzz.ColorLineT.ColorLineT ->   -- color_line : TInterface (Name {namespace = "HarfBuzz", name = "color_line_t"})
    IO CUInt

-- | Fetches the extend mode of the color line object.
-- 
-- /Since: 7.0.0/
colorLineGetExtend ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.ColorLineT.ColorLineT
    -- ^ /@colorLine@/: a t'GI.HarfBuzz.Structs.ColorLineT.ColorLineT' object
    -> m HarfBuzz.Enums.PaintExtendT
    -- ^ __Returns:__ the extend mode of /@colorLine@/
colorLineGetExtend colorLine = liftIO $ do
    colorLine' <- unsafeManagedPtrGetPtr colorLine
    result <- hb_color_line_get_extend colorLine'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr colorLine
    return result'


-- function color_line_get_color_stops
-- Args: [ Arg
--           { argCName = "color_line"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "color_line_t" }
--           , argCType = Just "hb_color_line_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #hb_color_line_t object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the index of the first color stop to return"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of feature tags to return;\n    Output = the actual number of feature tags returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "color_stops"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 2
--                 (TInterface
--                    Name { namespace = "HarfBuzz" , name = "color_stop_t" })
--           , argCType = Just "hb_color_stop_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Array of #hb_color_stop_t to populate"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of feature tags to return;\n    Output = the actual number of feature tags returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_color_line_get_color_stops" hb_color_line_get_color_stops :: 
    Ptr HarfBuzz.ColorLineT.ColorLineT ->   -- color_line : TInterface (Name {namespace = "HarfBuzz", name = "color_line_t"})
    Word32 ->                               -- start : TBasicType TUInt
    Word32 ->                               -- count : TBasicType TUInt
    Ptr HarfBuzz.ColorStopT.ColorStopT ->   -- color_stops : TCArray False (-1) 2 (TInterface (Name {namespace = "HarfBuzz", name = "color_stop_t"}))
    IO Word32

-- | Fetches a list of color stops from the given color line object.
-- 
-- Note that due to variations being applied, the returned color stops
-- may be out of order. It is the callers responsibility to ensure that
-- color stops are sorted by their offset before they are used.
-- 
-- /Since: 7.0.0/
colorLineGetColorStops ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.ColorLineT.ColorLineT
    -- ^ /@colorLine@/: a t'GI.HarfBuzz.Structs.ColorLineT.ColorLineT' object
    -> Word32
    -- ^ /@start@/: the index of the first color stop to return
    -> [HarfBuzz.ColorStopT.ColorStopT]
    -- ^ /@colorStops@/: Array of t'GI.HarfBuzz.Structs.ColorStopT.ColorStopT' to populate
    -> m ((Word32, [HarfBuzz.ColorStopT.ColorStopT]))
    -- ^ __Returns:__ the total number of color stops in /@colorLine@/
colorLineGetColorStops colorLine start colorStops = liftIO $ do
    let count = fromIntegral $ P.length colorStops
    colorLine' <- unsafeManagedPtrGetPtr colorLine
    colorStops' <- mapM B.ManagedPtr.disownBoxed colorStops
    colorStops'' <- packBlockArray 12 colorStops'
    result <- hb_color_line_get_color_stops colorLine' start count colorStops''
    colorStops''' <- (unpackBoxedArrayWithLength 12 count) colorStops''
    colorStops'''' <- mapM (wrapBoxed HarfBuzz.ColorStopT.ColorStopT) colorStops'''
    freeMem colorStops''
    touchManagedPtr colorLine
    mapM_ touchManagedPtr colorStops
    return (result, colorStops'''')


-- function color_get_red
-- Args: [ Arg
--           { argCName = "color"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_color_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "an #hb_color_t we are interested in its channels."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "hb_color_get_red" hb_color_get_red :: 
    Word32 ->                               -- color : TBasicType TUInt32
    IO Word8

-- | Fetches the red channel of the given /@color@/.
-- 
-- /Since: 2.1.0/
colorGetRed ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@color@/: an @/hb_color_t/@ we are interested in its channels.
    -> m Word8
    -- ^ __Returns:__ Red channel value
colorGetRed color = liftIO $ do
    result <- hb_color_get_red color
    return result


-- function color_get_green
-- Args: [ Arg
--           { argCName = "color"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_color_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "an #hb_color_t we are interested in its channels."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "hb_color_get_green" hb_color_get_green :: 
    Word32 ->                               -- color : TBasicType TUInt32
    IO Word8

-- | Fetches the green channel of the given /@color@/.
-- 
-- /Since: 2.1.0/
colorGetGreen ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@color@/: an @/hb_color_t/@ we are interested in its channels.
    -> m Word8
    -- ^ __Returns:__ Green channel value
colorGetGreen color = liftIO $ do
    result <- hb_color_get_green color
    return result


-- function color_get_blue
-- Args: [ Arg
--           { argCName = "color"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_color_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "an #hb_color_t we are interested in its channels."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "hb_color_get_blue" hb_color_get_blue :: 
    Word32 ->                               -- color : TBasicType TUInt32
    IO Word8

-- | Fetches the blue channel of the given /@color@/.
-- 
-- /Since: 2.1.0/
colorGetBlue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@color@/: an @/hb_color_t/@ we are interested in its channels.
    -> m Word8
    -- ^ __Returns:__ Blue channel value
colorGetBlue color = liftIO $ do
    result <- hb_color_get_blue color
    return result


-- function color_get_alpha
-- Args: [ Arg
--           { argCName = "color"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_color_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "an #hb_color_t we are interested in its channels."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "hb_color_get_alpha" hb_color_get_alpha :: 
    Word32 ->                               -- color : TBasicType TUInt32
    IO Word8

-- | Fetches the alpha channel of the given /@color@/.
-- 
-- /Since: 2.1.0/
colorGetAlpha ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@color@/: an @/hb_color_t/@ we are interested in its channels.
    -> m Word8
    -- ^ __Returns:__ Alpha channel value
colorGetAlpha color = liftIO $ do
    result <- hb_color_get_alpha color
    return result


-- function calloc
-- Args: [ Arg
--           { argCName = "nmemb"
--           , argType = TBasicType TSize
--           , argCType = Just "size_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The number of elements to allocate."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TSize
--           , argCType = Just "size_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The size of each element."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "hb_calloc" hb_calloc :: 
    FCT.CSize ->                            -- nmemb : TBasicType TSize
    FCT.CSize ->                            -- size : TBasicType TSize
    IO (Ptr ())

-- | Allocates /@nmemb@/ elements of /@size@/ bytes each, initialized to zero,
-- using the allocator set at compile-time. Typically just @/calloc()/@.
-- 
-- /Since: 11.0.0/
calloc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FCT.CSize
    -- ^ /@nmemb@/: The number of elements to allocate.
    -> FCT.CSize
    -- ^ /@size@/: The size of each element.
    -> m (Ptr ())
    -- ^ __Returns:__ A pointer to the allocated memory.
calloc nmemb size = liftIO $ do
    result <- hb_calloc nmemb size
    return result


-- function buffer_set_unicode_funcs
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "unicode_funcs"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" }
--           , argCType = Just "hb_unicode_funcs_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The Unicode-functions structure"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_unicode_funcs" hb_buffer_set_unicode_funcs :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT -> -- unicode_funcs : TInterface (Name {namespace = "HarfBuzz", name = "unicode_funcs_t"})
    IO ()

-- | Sets the Unicode-functions structure of a buffer to
-- /@unicodeFuncs@/.
-- 
-- /Since: 0.9.2/
bufferSetUnicodeFuncs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ /@unicodeFuncs@/: The Unicode-functions structure
    -> m ()
bufferSetUnicodeFuncs buffer unicodeFuncs = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    unicodeFuncs' <- unsafeManagedPtrGetPtr unicodeFuncs
    hb_buffer_set_unicode_funcs buffer' unicodeFuncs'
    touchManagedPtr buffer
    touchManagedPtr unicodeFuncs
    return ()


-- function buffer_set_segment_properties
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "props"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "segment_properties_t" }
--           , argCType = Just "const hb_segment_properties_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_segment_properties_t to use"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_segment_properties" hb_buffer_set_segment_properties :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr HarfBuzz.SegmentPropertiesT.SegmentPropertiesT -> -- props : TInterface (Name {namespace = "HarfBuzz", name = "segment_properties_t"})
    IO ()

-- | Sets the segment properties of the buffer, a shortcut for calling
-- 'GI.HarfBuzz.Functions.bufferSetDirection', 'GI.HarfBuzz.Functions.bufferSetScript' and
-- 'GI.HarfBuzz.Functions.bufferSetLanguage' individually.
-- 
-- /Since: 0.9.7/
bufferSetSegmentProperties ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> HarfBuzz.SegmentPropertiesT.SegmentPropertiesT
    -- ^ /@props@/: An t'GI.HarfBuzz.Structs.SegmentPropertiesT.SegmentPropertiesT' to use
    -> m ()
bufferSetSegmentProperties buffer props = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    props' <- unsafeManagedPtrGetPtr props
    hb_buffer_set_segment_properties buffer' props'
    touchManagedPtr buffer
    touchManagedPtr props
    return ()


-- function buffer_set_script
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "script_t" }
--           , argCType = Just "hb_script_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_script_t to set."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_script" hb_buffer_set_script :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    CUInt ->                                -- script : TInterface (Name {namespace = "HarfBuzz", name = "script_t"})
    IO ()

-- | Sets the script of /@buffer@/ to /@script@/.
-- 
-- Script is crucial for choosing the proper shaping behaviour for scripts that
-- require it (e.g. Arabic) and the which OpenType features defined in the font
-- to be applied.
-- 
-- You can pass one of the predefined t'GI.HarfBuzz.Enums.ScriptT' values, or use
-- 'GI.HarfBuzz.Functions.scriptFromString' or 'GI.HarfBuzz.Functions.scriptFromIso15924Tag' to get the
-- corresponding script from an ISO 15924 script tag.
-- 
-- /Since: 0.9.2/
bufferSetScript ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> HarfBuzz.Enums.ScriptT
    -- ^ /@script@/: An t'GI.HarfBuzz.Enums.ScriptT' to set.
    -> m ()
bufferSetScript buffer script = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    let script' = (fromIntegral . fromEnum) script
    hb_buffer_set_script buffer' script'
    touchManagedPtr buffer
    return ()


-- function buffer_set_replacement_codepoint
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "replacement"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the replacement #hb_codepoint_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_replacement_codepoint" hb_buffer_set_replacement_codepoint :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- replacement : TBasicType TUInt32
    IO ()

-- | Sets the @/hb_codepoint_t/@ that replaces invalid entries for a given encoding
-- when adding text to /@buffer@/.
-- 
-- Default is 'GI.HarfBuzz.Constants.BUFFER_REPLACEMENT_CODEPOINT_DEFAULT'.
-- 
-- /Since: 0.9.31/
bufferSetReplacementCodepoint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> Word32
    -- ^ /@replacement@/: the replacement @/hb_codepoint_t/@
    -> m ()
bufferSetReplacementCodepoint buffer replacement = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_set_replacement_codepoint buffer' replacement
    touchManagedPtr buffer
    return ()


-- function buffer_set_random_state
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "state"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the new random state"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_random_state" hb_buffer_set_random_state :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- state : TBasicType TUInt
    IO ()

-- | Sets the random state of the buffer. The state changes
-- every time a glyph uses randomness (eg. the @rand@
-- OpenType feature). This function together with
-- 'GI.HarfBuzz.Functions.bufferGetRandomState' allow for transferring
-- the current random state to a subsequent buffer, to
-- get better randomness distribution.
-- 
-- Defaults to 1 and when buffer contents are cleared.
-- A value of 0 disables randomness during shaping.
-- 
-- /Since: 8.4.0/
bufferSetRandomState ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> Word32
    -- ^ /@state@/: the new random state
    -> m ()
bufferSetRandomState buffer state = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_set_random_state buffer' state
    touchManagedPtr buffer
    return ()


-- function buffer_set_not_found_variation_selector_glyph
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "not_found_variation_selector"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the not-found-variation-selector #hb_codepoint_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_not_found_variation_selector_glyph" hb_buffer_set_not_found_variation_selector_glyph :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- not_found_variation_selector : TBasicType TUInt32
    IO ()

-- | Sets the @/hb_codepoint_t/@ that replaces variation-selector characters not resolved
-- in the font during shaping.
-- 
-- The not-found-variation-selector glyph defaults to 'GI.HarfBuzz.Constants.CODEPOINT_INVALID',
-- in which case an unresolved variation-selector will be removed from the glyph
-- string during shaping. This API allows for changing that and retaining a glyph,
-- such that the situation can be detected by the client and handled accordingly
-- (e.g. by using a different font).
-- 
-- /Since: 10.0.0/
bufferSetNotFoundVariationSelectorGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> Word32
    -- ^ /@notFoundVariationSelector@/: the not-found-variation-selector @/hb_codepoint_t/@
    -> m ()
bufferSetNotFoundVariationSelectorGlyph buffer notFoundVariationSelector = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_set_not_found_variation_selector_glyph buffer' notFoundVariationSelector
    touchManagedPtr buffer
    return ()


-- function buffer_set_not_found_glyph
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "not_found"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the not-found #hb_codepoint_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_not_found_glyph" hb_buffer_set_not_found_glyph :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- not_found : TBasicType TUInt32
    IO ()

-- | Sets the @/hb_codepoint_t/@ that replaces characters not found in
-- the font during shaping.
-- 
-- The not-found glyph defaults to zero, sometimes known as the
-- \".notdef\" glyph.  This API allows for differentiating the two.
-- 
-- /Since: 3.1.0/
bufferSetNotFoundGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> Word32
    -- ^ /@notFound@/: the not-found @/hb_codepoint_t/@
    -> m ()
bufferSetNotFoundGlyph buffer notFound = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_set_not_found_glyph buffer' notFound
    touchManagedPtr buffer
    return ()


-- function buffer_set_message_func
-- XXX Could not generate function buffer_set_message_func

-- Not implemented: Unknown destroy type: TInterface (Name {namespace = "HarfBuzz", name = "destroy_func_t"})

-- function buffer_set_length
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The new length of @buffer"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_length" hb_buffer_set_length :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- length : TBasicType TUInt
    IO Int32

-- | Similar to 'GI.HarfBuzz.Functions.bufferPreAllocate', but clears any new items added at the
-- end.
-- 
-- /Since: 0.9.2/
bufferSetLength ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> Word32
    -- ^ /@length@/: The new length of /@buffer@/
    -> m Int32
    -- ^ __Returns:__ @true@ if /@buffer@/ memory allocation succeeded, @false@ otherwise.
bufferSetLength buffer length_ = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_set_length buffer' length_
    touchManagedPtr buffer
    return result


-- function buffer_set_language
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "language_t" }
--           , argCType = Just "hb_language_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An hb_language_t to set"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_language" hb_buffer_set_language :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr HarfBuzz.LanguageT.LanguageT ->     -- language : TInterface (Name {namespace = "HarfBuzz", name = "language_t"})
    IO ()

-- | Sets the language of /@buffer@/ to /@language@/.
-- 
-- Languages are crucial for selecting which OpenType feature to apply to the
-- buffer which can result in applying language-specific behaviour. Languages
-- are orthogonal to the scripts, and though they are related, they are
-- different concepts and should not be confused with each other.
-- 
-- Use 'GI.HarfBuzz.Functions.languageFromString' to convert from BCP 47 language tags to
-- t'GI.HarfBuzz.Structs.LanguageT.LanguageT'.
-- 
-- /Since: 0.9.2/
bufferSetLanguage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> HarfBuzz.LanguageT.LanguageT
    -- ^ /@language@/: An hb_language_t to set
    -> m ()
bufferSetLanguage buffer language = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    language' <- unsafeManagedPtrGetPtr language
    hb_buffer_set_language buffer' language'
    touchManagedPtr buffer
    touchManagedPtr language
    return ()


-- function buffer_set_invisible_glyph
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "invisible"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the invisible #hb_codepoint_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_invisible_glyph" hb_buffer_set_invisible_glyph :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- invisible : TBasicType TUInt32
    IO ()

-- | Sets the @/hb_codepoint_t/@ that replaces invisible characters in
-- the shaping result.  If set to zero (default), the glyph for the
-- U+0020 SPACE character is used.  Otherwise, this value is used
-- verbatim.
-- 
-- /Since: 2.0.0/
bufferSetInvisibleGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> Word32
    -- ^ /@invisible@/: the invisible @/hb_codepoint_t/@
    -> m ()
bufferSetInvisibleGlyph buffer invisible = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_set_invisible_glyph buffer' invisible
    touchManagedPtr buffer
    return ()


-- function buffer_set_flags
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "buffer_flags_t" }
--           , argCType = Just "hb_buffer_flags_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The buffer flags to set"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_flags" hb_buffer_set_flags :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "HarfBuzz", name = "buffer_flags_t"})
    IO ()

-- | Sets /@buffer@/ flags to /@flags@/. See t'GI.HarfBuzz.Flags.BufferFlagsT'.
-- 
-- /Since: 0.9.7/
bufferSetFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> [HarfBuzz.Flags.BufferFlagsT]
    -- ^ /@flags@/: The buffer flags to set
    -> m ()
bufferSetFlags buffer flags = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    let flags' = gflagsToWord flags
    hb_buffer_set_flags buffer' flags'
    touchManagedPtr buffer
    return ()


-- function buffer_set_direction
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "direction"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "direction_t" }
--           , argCType = Just "hb_direction_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #hb_direction_t of the @buffer"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_direction" hb_buffer_set_direction :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    CUInt ->                                -- direction : TInterface (Name {namespace = "HarfBuzz", name = "direction_t"})
    IO ()

-- | Set the text flow direction of the buffer. No shaping can happen without
-- setting /@buffer@/ direction, and it controls the visual direction for the
-- output glyphs; for RTL direction the glyphs will be reversed. Many layout
-- features depend on the proper setting of the direction, for example,
-- reversing RTL text before shaping, then shaping with LTR direction is not
-- the same as keeping the text in logical order and shaping with RTL
-- direction.
-- 
-- /Since: 0.9.2/
bufferSetDirection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> HarfBuzz.Enums.DirectionT
    -- ^ /@direction@/: the t'GI.HarfBuzz.Enums.DirectionT' of the /@buffer@/
    -> m ()
bufferSetDirection buffer direction = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    let direction' = (fromIntegral . fromEnum) direction
    hb_buffer_set_direction buffer' direction'
    touchManagedPtr buffer
    return ()


-- function buffer_set_content_type
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "content_type"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "buffer_content_type_t" }
--           , argCType = Just "hb_buffer_content_type_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The type of buffer contents to set"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_content_type" hb_buffer_set_content_type :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    CUInt ->                                -- content_type : TInterface (Name {namespace = "HarfBuzz", name = "buffer_content_type_t"})
    IO ()

-- | Sets the type of /@buffer@/ contents. Buffers are either empty, contain
-- characters (before shaping), or contain glyphs (the result of shaping).
-- 
-- You rarely need to call this function, since a number of other
-- functions transition the content type for you. Namely:
-- 
-- * A newly created buffer starts with content type
--   'GI.HarfBuzz.Enums.BufferContentTypeTInvalid'. Calling 'GI.HarfBuzz.Functions.bufferReset',
--   'GI.HarfBuzz.Functions.bufferClearContents', as well as calling 'GI.HarfBuzz.Functions.bufferSetLength'
--   with an argument of zero all set the buffer content type to invalid
--   as well.
-- * Calling 'GI.HarfBuzz.Functions.bufferAddUtf8', 'GI.HarfBuzz.Functions.bufferAddUtf16',
--   'GI.HarfBuzz.Functions.bufferAddUtf32', 'GI.HarfBuzz.Functions.bufferAddCodepoints' and
--   'GI.HarfBuzz.Functions.bufferAddLatin1' expect that buffer is either empty and
--   have a content type of invalid, or that buffer content type is
--   'GI.HarfBuzz.Enums.BufferContentTypeTUnicode', and they also set the content
--   type to Unicode if they added anything to an empty buffer.
-- * Finally 'GI.HarfBuzz.Functions.shape' and 'GI.HarfBuzz.Functions.shapeFull' expect that the buffer
--   is either empty and have content type of invalid, or that buffer
--   content type is 'GI.HarfBuzz.Enums.BufferContentTypeTUnicode', and upon
--   success they set the buffer content type to
--   'GI.HarfBuzz.Enums.BufferContentTypeTGlyphs'.
-- 
-- 
-- The above transitions are designed such that one can use a buffer
-- in a loop of \"reset : add-text : shape\" without needing to ever
-- modify the content type manually.
-- 
-- /Since: 0.9.5/
bufferSetContentType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> HarfBuzz.Enums.BufferContentTypeT
    -- ^ /@contentType@/: The type of buffer contents to set
    -> m ()
bufferSetContentType buffer contentType = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    let contentType' = (fromIntegral . fromEnum) contentType
    hb_buffer_set_content_type buffer' contentType'
    touchManagedPtr buffer
    return ()


-- function buffer_set_cluster_level
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cluster_level"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "buffer_cluster_level_t" }
--           , argCType = Just "hb_buffer_cluster_level_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The cluster level to set on the buffer"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_set_cluster_level" hb_buffer_set_cluster_level :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    CUInt ->                                -- cluster_level : TInterface (Name {namespace = "HarfBuzz", name = "buffer_cluster_level_t"})
    IO ()

-- | Sets the cluster level of a buffer. The t'GI.HarfBuzz.Enums.BufferClusterLevelT'
-- dictates one aspect of how HarfBuzz will treat non-base characters
-- during shaping.
-- 
-- /Since: 0.9.42/
bufferSetClusterLevel ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> HarfBuzz.Enums.BufferClusterLevelT
    -- ^ /@clusterLevel@/: The cluster level to set on the buffer
    -> m ()
bufferSetClusterLevel buffer clusterLevel = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    let clusterLevel' = (fromIntegral . fromEnum) clusterLevel
    hb_buffer_set_cluster_level buffer' clusterLevel'
    touchManagedPtr buffer
    return ()


-- function buffer_serialize_unicode
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_buffer_t buffer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the first item in @buffer to serialize."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "end"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the last item in @buffer to serialize."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buf"
--           , argType = TCArray False (-1) 4 (TBasicType TUInt8)
--           , argCType = Just "char*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "output string to\n      write serialized buffer into."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "buf_size"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the size of @buf." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "buf_consumed"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "if not `NULL`, will be set to the number of bytes written into @buf."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "format"
--           , argType =
--               TInterface
--                 Name
--                   { namespace = "HarfBuzz" , name = "buffer_serialize_format_t" }
--           , argCType = Just "hb_buffer_serialize_format_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the #hb_buffer_serialize_format_t to use for formatting the output."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "buffer_serialize_flags_t" }
--           , argCType = Just "hb_buffer_serialize_flags_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the #hb_buffer_serialize_flags_t that control what glyph properties\n        to serialize."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "buf_size"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the size of @buf." , sinceVersion = Nothing }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_serialize_unicode" hb_buffer_serialize_unicode :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- start : TBasicType TUInt
    Word32 ->                               -- end : TBasicType TUInt
    Ptr (Ptr Word8) ->                      -- buf : TCArray False (-1) 4 (TBasicType TUInt8)
    Ptr Word32 ->                           -- buf_size : TBasicType TUInt
    Ptr Word32 ->                           -- buf_consumed : TBasicType TUInt
    CUInt ->                                -- format : TInterface (Name {namespace = "HarfBuzz", name = "buffer_serialize_format_t"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "HarfBuzz", name = "buffer_serialize_flags_t"})
    IO Word32

-- | Serializes /@buffer@/ into a textual representation of its content,
-- when the buffer contains Unicode codepoints (i.e., before shaping). This is
-- useful for showing the contents of the buffer, for example during debugging.
-- There are currently two supported serialization formats:
-- 
-- == text
-- A human-readable, plain text format.
-- The serialized codepoints will look something like:
-- 
-- 
-- === /plain code/
-- >
-- > <U+0651=0|U+0628=1>
-- 
-- 
-- * Glyphs are separated with @|@
-- * Unicode codepoints are expressed as zero-padded four (or more)
--   digit hexadecimal numbers preceded by @U+@
-- * If @/HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS/@ is not set, the cluster
--   will be indicated with a @=@ then t'GI.HarfBuzz.Structs.GlyphInfoT.GlyphInfoT'.@/cluster/@.
-- 
-- 
-- == json
-- A machine-readable, structured format.
-- The serialized codepoints will be a list of objects with the following
-- properties:
-- * @u@: the Unicode codepoint as a decimal integer
-- * @cl@: t'GI.HarfBuzz.Structs.GlyphInfoT.GlyphInfoT'.@/cluster/@ if
--   @/HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS/@ is not set.
-- 
-- 
-- For example:
-- 
-- 
-- === /plain code/
-- >
-- >[{u:1617,cl:0},{u:1576,cl:1}]
-- 
-- 
-- /Since: 2.7.3/
bufferSerializeUnicode ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: an t'GI.HarfBuzz.Structs.BufferT.BufferT' buffer.
    -> Word32
    -- ^ /@start@/: the first item in /@buffer@/ to serialize.
    -> Word32
    -- ^ /@end@/: the last item in /@buffer@/ to serialize.
    -> HarfBuzz.Enums.BufferSerializeFormatT
    -- ^ /@format@/: the t'GI.HarfBuzz.Enums.BufferSerializeFormatT' to use for formatting the output.
    -> [HarfBuzz.Flags.BufferSerializeFlagsT]
    -- ^ /@flags@/: the t'GI.HarfBuzz.Flags.BufferSerializeFlagsT' that control what glyph properties
    --         to serialize.
    -> m ((Word32, ByteString, Word32))
    -- ^ __Returns:__ The number of serialized items.
bufferSerializeUnicode buffer start end format flags = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    buf <- callocMem :: IO (Ptr (Ptr Word8))
    bufSize <- allocMem :: IO (Ptr Word32)
    bufConsumed <- allocMem :: IO (Ptr Word32)
    let format' = (fromIntegral . fromEnum) format
    let flags' = gflagsToWord flags
    result <- hb_buffer_serialize_unicode buffer' start end buf bufSize bufConsumed format' flags'
    bufSize' <- peek bufSize
    buf' <- peek buf
    buf'' <- (unpackByteStringWithLength bufSize') buf'
    freeMem buf'
    bufConsumed' <- peek bufConsumed
    touchManagedPtr buffer
    freeMem buf
    freeMem bufSize
    freeMem bufConsumed
    return (result, buf'', bufConsumed')


-- function buffer_serialize_list_formats
-- Args: []
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_serialize_list_formats" hb_buffer_serialize_list_formats :: 
    IO (Ptr CString)

-- | Returns a list of supported buffer serialization formats.
-- 
-- /Since: 0.9.7/
bufferSerializeListFormats ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [T.Text]
    -- ^ __Returns:__ 
    -- A string array of buffer serialization formats. Should not be freed.
bufferSerializeListFormats  = liftIO $ do
    result <- hb_buffer_serialize_list_formats
    checkUnexpectedReturnNULL "bufferSerializeListFormats" result
    result' <- unpackZeroTerminatedUTF8CArray result
    return result'


-- function buffer_serialize_glyphs
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_buffer_t buffer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the first item in @buffer to serialize."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "end"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the last item in @buffer to serialize."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buf"
--           , argType = TCArray False (-1) 4 (TBasicType TUInt8)
--           , argCType = Just "char*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "output string to\n      write serialized buffer into."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "buf_size"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the size of @buf." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "buf_consumed"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "if not `NULL`, will be set to the number of bytes written into @buf."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the #hb_font_t used to shape this buffer, needed to\n       read glyph names and extents. If `NULL`, an empty font will be used."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "format"
--           , argType =
--               TInterface
--                 Name
--                   { namespace = "HarfBuzz" , name = "buffer_serialize_format_t" }
--           , argCType = Just "hb_buffer_serialize_format_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the #hb_buffer_serialize_format_t to use for formatting the output."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "buffer_serialize_flags_t" }
--           , argCType = Just "hb_buffer_serialize_flags_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the #hb_buffer_serialize_flags_t that control what glyph properties\n        to serialize."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "buf_size"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the size of @buf." , sinceVersion = Nothing }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_serialize_glyphs" hb_buffer_serialize_glyphs :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- start : TBasicType TUInt
    Word32 ->                               -- end : TBasicType TUInt
    Ptr (Ptr Word8) ->                      -- buf : TCArray False (-1) 4 (TBasicType TUInt8)
    Ptr Word32 ->                           -- buf_size : TBasicType TUInt
    Ptr Word32 ->                           -- buf_consumed : TBasicType TUInt
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- format : TInterface (Name {namespace = "HarfBuzz", name = "buffer_serialize_format_t"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "HarfBuzz", name = "buffer_serialize_flags_t"})
    IO Word32

-- | Serializes /@buffer@/ into a textual representation of its glyph content,
-- useful for showing the contents of the buffer, for example during debugging.
-- There are currently two supported serialization formats:
-- 
-- == text
-- A human-readable, plain text format.
-- The serialized glyphs will look something like:
-- 
-- 
-- === /plain code/
-- >
-- >[uni0651=0@518,0+0|uni0628=0+1897]
-- 
-- 
-- * The serialized glyphs are delimited with @[@ and @]@.
-- * Glyphs are separated with @|@
-- * Each glyph starts with glyph name, or glyph index if
--   @/HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES/@ flag is set. Then,
-- 
-- * If @/HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS/@ is not set, @=@ then t'GI.HarfBuzz.Structs.GlyphInfoT.GlyphInfoT'.@/cluster/@.
-- * If @/HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS/@ is not set, the t'GI.HarfBuzz.Structs.GlyphPositionT.GlyphPositionT' in the format:
-- 
-- * If t'GI.HarfBuzz.Structs.GlyphPositionT.GlyphPositionT'.@/x_offset/@ and t'GI.HarfBuzz.Structs.GlyphPositionT.GlyphPositionT'.@/y_offset/@ are not both 0, @\@x_offset,y_offset@. Then,
-- * @+x_advance@, then @,y_advance@ if t'GI.HarfBuzz.Structs.GlyphPositionT.GlyphPositionT'.@/y_advance/@ is not 0. Then,
-- 
-- * If @/HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS/@ is set, the t'GI.HarfBuzz.Structs.GlyphExtentsT.GlyphExtentsT' in the format @\<x_bearing,y_bearing,width,height>@
-- 
-- 
-- == json
-- A machine-readable, structured format.
-- The serialized glyphs will look something like:
-- 
-- 
-- === /plain code/
-- >
-- >[{"g":"uni0651","cl":0,"dx":518,"dy":0,"ax":0,"ay":0},
-- > {"g":"uni0628","cl":0,"dx":0,"dy":0,"ax":1897,"ay":0}]
-- 
-- 
-- Each glyph is a JSON object, with the following properties:
-- * @g@: the glyph name or glyph index if
--   @/HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES/@ flag is set.
-- * @cl@: t'GI.HarfBuzz.Structs.GlyphInfoT.GlyphInfoT'.@/cluster/@ if
--   @/HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS/@ is not set.
-- * @dx@,@dy@,@ax@,@ay@: t'GI.HarfBuzz.Structs.GlyphPositionT.GlyphPositionT'.@/x_offset/@, t'GI.HarfBuzz.Structs.GlyphPositionT.GlyphPositionT'.@/y_offset/@,
--   t'GI.HarfBuzz.Structs.GlyphPositionT.GlyphPositionT'.@/x_advance/@ and t'GI.HarfBuzz.Structs.GlyphPositionT.GlyphPositionT'.@/y_advance/@
--   respectively, if @/HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS/@ is not set.
-- * @xb@,@yb@,@w@,@h@: t'GI.HarfBuzz.Structs.GlyphExtentsT.GlyphExtentsT'.@/x_bearing/@, t'GI.HarfBuzz.Structs.GlyphExtentsT.GlyphExtentsT'.@/y_bearing/@,
--   t'GI.HarfBuzz.Structs.GlyphExtentsT.GlyphExtentsT'.@/width/@ and t'GI.HarfBuzz.Structs.GlyphExtentsT.GlyphExtentsT'.@/height/@ respectively if
--   @/HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS/@ is set.
-- 
-- 
-- /Since: 0.9.7/
bufferSerializeGlyphs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: an t'GI.HarfBuzz.Structs.BufferT.BufferT' buffer.
    -> Word32
    -- ^ /@start@/: the first item in /@buffer@/ to serialize.
    -> Word32
    -- ^ /@end@/: the last item in /@buffer@/ to serialize.
    -> Maybe (HarfBuzz.FontT.FontT)
    -- ^ /@font@/: the t'GI.HarfBuzz.Structs.FontT.FontT' used to shape this buffer, needed to
    --        read glyph names and extents. If @NULL@, an empty font will be used.
    -> HarfBuzz.Enums.BufferSerializeFormatT
    -- ^ /@format@/: the t'GI.HarfBuzz.Enums.BufferSerializeFormatT' to use for formatting the output.
    -> [HarfBuzz.Flags.BufferSerializeFlagsT]
    -- ^ /@flags@/: the t'GI.HarfBuzz.Flags.BufferSerializeFlagsT' that control what glyph properties
    --         to serialize.
    -> m ((Word32, ByteString, Word32))
    -- ^ __Returns:__ The number of serialized items.
bufferSerializeGlyphs buffer start end font format flags = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    buf <- callocMem :: IO (Ptr (Ptr Word8))
    bufSize <- allocMem :: IO (Ptr Word32)
    bufConsumed <- allocMem :: IO (Ptr Word32)
    maybeFont <- case font of
        Nothing -> return FP.nullPtr
        Just jFont -> do
            jFont' <- unsafeManagedPtrGetPtr jFont
            return jFont'
    let format' = (fromIntegral . fromEnum) format
    let flags' = gflagsToWord flags
    result <- hb_buffer_serialize_glyphs buffer' start end buf bufSize bufConsumed maybeFont format' flags'
    bufSize' <- peek bufSize
    buf' <- peek buf
    buf'' <- (unpackByteStringWithLength bufSize') buf'
    freeMem buf'
    bufConsumed' <- peek bufConsumed
    touchManagedPtr buffer
    whenJust font touchManagedPtr
    freeMem buf
    freeMem bufSize
    freeMem bufConsumed
    return (result, buf'', bufConsumed')


-- function buffer_serialize_format_to_string
-- Args: [ Arg
--           { argCName = "format"
--           , argType =
--               TInterface
--                 Name
--                   { namespace = "HarfBuzz" , name = "buffer_serialize_format_t" }
--           , argCType = Just "hb_buffer_serialize_format_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_buffer_serialize_format_t to convert."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_serialize_format_to_string" hb_buffer_serialize_format_to_string :: 
    CUInt ->                                -- format : TInterface (Name {namespace = "HarfBuzz", name = "buffer_serialize_format_t"})
    IO CString

-- | Converts /@format@/ to the string corresponding it, or @NULL@ if it is not a valid
-- t'GI.HarfBuzz.Enums.BufferSerializeFormatT'.
-- 
-- /Since: 0.9.7/
bufferSerializeFormatToString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.Enums.BufferSerializeFormatT
    -- ^ /@format@/: an t'GI.HarfBuzz.Enums.BufferSerializeFormatT' to convert.
    -> m T.Text
    -- ^ __Returns:__ 
    -- A @NULL@ terminated string corresponding to /@format@/. Should not be freed.
bufferSerializeFormatToString format = liftIO $ do
    let format' = (fromIntegral . fromEnum) format
    result <- hb_buffer_serialize_format_to_string format'
    checkUnexpectedReturnNULL "bufferSerializeFormatToString" result
    result' <- cstringToText result
    return result'


-- function buffer_serialize_format_from_string
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a string to parse" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "length of @str, or -1 if string is `NULL` terminated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "length of @str, or -1 if string is `NULL` terminated"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just
--               (TInterface
--                  Name
--                    { namespace = "HarfBuzz" , name = "buffer_serialize_format_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_serialize_format_from_string" hb_buffer_serialize_format_from_string :: 
    Ptr Word8 ->                            -- str : TCArray False (-1) 1 (TBasicType TUInt8)
    Int32 ->                                -- len : TBasicType TInt
    IO CUInt

-- | Parses a string into an t'GI.HarfBuzz.Enums.BufferSerializeFormatT'. Does not check if
-- /@str@/ is a valid buffer serialization format, use
-- 'GI.HarfBuzz.Functions.bufferSerializeListFormats' to get the list of supported formats.
-- 
-- /Since: 0.9.7/
bufferSerializeFormatFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@str@/: a string to parse
    -> m HarfBuzz.Enums.BufferSerializeFormatT
    -- ^ __Returns:__ The parsed t'GI.HarfBuzz.Enums.BufferSerializeFormatT'.
bufferSerializeFormatFromString str = liftIO $ do
    let len = fromIntegral $ B.length str
    str' <- packByteString str
    result <- hb_buffer_serialize_format_from_string str' len
    let result' = (toEnum . fromIntegral) result
    freeMem str'
    return result'


-- function buffer_serialize
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_buffer_t buffer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the first item in @buffer to serialize."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "end"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the last item in @buffer to serialize."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buf"
--           , argType = TCArray False (-1) 4 (TBasicType TUInt8)
--           , argCType = Just "char*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "output string to\n      write serialized buffer into."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "buf_size"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the size of @buf." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "buf_consumed"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "if not `NULL`, will be set to the number of bytes written into @buf."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the #hb_font_t used to shape this buffer, needed to\n       read glyph names and extents. If `NULL`, an empty font will be used."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "format"
--           , argType =
--               TInterface
--                 Name
--                   { namespace = "HarfBuzz" , name = "buffer_serialize_format_t" }
--           , argCType = Just "hb_buffer_serialize_format_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the #hb_buffer_serialize_format_t to use for formatting the output."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "buffer_serialize_flags_t" }
--           , argCType = Just "hb_buffer_serialize_flags_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the #hb_buffer_serialize_flags_t that control what glyph properties\n        to serialize."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "buf_size"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the size of @buf." , sinceVersion = Nothing }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_serialize" hb_buffer_serialize :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- start : TBasicType TUInt
    Word32 ->                               -- end : TBasicType TUInt
    Ptr (Ptr Word8) ->                      -- buf : TCArray False (-1) 4 (TBasicType TUInt8)
    Ptr Word32 ->                           -- buf_size : TBasicType TUInt
    Ptr Word32 ->                           -- buf_consumed : TBasicType TUInt
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- format : TInterface (Name {namespace = "HarfBuzz", name = "buffer_serialize_format_t"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "HarfBuzz", name = "buffer_serialize_flags_t"})
    IO Word32

-- | Serializes /@buffer@/ into a textual representation of its content, whether
-- Unicode codepoints or glyph identifiers and positioning information. This is
-- useful for showing the contents of the buffer, for example during debugging.
-- See the documentation of 'GI.HarfBuzz.Functions.bufferSerializeUnicode' and
-- 'GI.HarfBuzz.Functions.bufferSerializeGlyphs' for a description of the output format.
-- 
-- /Since: 2.7.3/
bufferSerialize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: an t'GI.HarfBuzz.Structs.BufferT.BufferT' buffer.
    -> Word32
    -- ^ /@start@/: the first item in /@buffer@/ to serialize.
    -> Word32
    -- ^ /@end@/: the last item in /@buffer@/ to serialize.
    -> Maybe (HarfBuzz.FontT.FontT)
    -- ^ /@font@/: the t'GI.HarfBuzz.Structs.FontT.FontT' used to shape this buffer, needed to
    --        read glyph names and extents. If @NULL@, an empty font will be used.
    -> HarfBuzz.Enums.BufferSerializeFormatT
    -- ^ /@format@/: the t'GI.HarfBuzz.Enums.BufferSerializeFormatT' to use for formatting the output.
    -> [HarfBuzz.Flags.BufferSerializeFlagsT]
    -- ^ /@flags@/: the t'GI.HarfBuzz.Flags.BufferSerializeFlagsT' that control what glyph properties
    --         to serialize.
    -> m ((Word32, ByteString, Word32))
    -- ^ __Returns:__ The number of serialized items.
bufferSerialize buffer start end font format flags = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    buf <- callocMem :: IO (Ptr (Ptr Word8))
    bufSize <- allocMem :: IO (Ptr Word32)
    bufConsumed <- allocMem :: IO (Ptr Word32)
    maybeFont <- case font of
        Nothing -> return FP.nullPtr
        Just jFont -> do
            jFont' <- unsafeManagedPtrGetPtr jFont
            return jFont'
    let format' = (fromIntegral . fromEnum) format
    let flags' = gflagsToWord flags
    result <- hb_buffer_serialize buffer' start end buf bufSize bufConsumed maybeFont format' flags'
    bufSize' <- peek bufSize
    buf' <- peek buf
    buf'' <- (unpackByteStringWithLength bufSize') buf'
    freeMem buf'
    bufConsumed' <- peek bufConsumed
    touchManagedPtr buffer
    whenJust font touchManagedPtr
    freeMem buf
    freeMem bufSize
    freeMem bufConsumed
    return (result, buf'', bufConsumed')


-- function buffer_reverse_range
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "start index" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "end"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "end index" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_reverse_range" hb_buffer_reverse_range :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- start : TBasicType TUInt
    Word32 ->                               -- end : TBasicType TUInt
    IO ()

-- | Reverses buffer contents between /@start@/ and /@end@/.
-- 
-- /Since: 0.9.41/
bufferReverseRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> Word32
    -- ^ /@start@/: start index
    -> Word32
    -- ^ /@end@/: end index
    -> m ()
bufferReverseRange buffer start end = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_reverse_range buffer' start end
    touchManagedPtr buffer
    return ()


-- function buffer_reverse_clusters
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_reverse_clusters" hb_buffer_reverse_clusters :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO ()

-- | Reverses buffer clusters.  That is, the buffer contents are
-- reversed, then each cluster (consecutive items having the
-- same cluster number) are reversed again.
-- 
-- /Since: 0.9.2/
bufferReverseClusters ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m ()
bufferReverseClusters buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_reverse_clusters buffer'
    touchManagedPtr buffer
    return ()


-- function buffer_reverse
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_reverse" hb_buffer_reverse :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO ()

-- | Reverses buffer contents.
-- 
-- /Since: 0.9.2/
bufferReverse ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m ()
bufferReverse buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_reverse buffer'
    touchManagedPtr buffer
    return ()


-- function buffer_reset
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_reset" hb_buffer_reset :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO ()

-- | Resets the buffer to its initial status, as if it was just newly created
-- with 'GI.HarfBuzz.Functions.bufferCreate'.
-- 
-- /Since: 0.9.2/
bufferReset ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m ()
bufferReset buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_reset buffer'
    touchManagedPtr buffer
    return ()


-- function buffer_pre_allocate
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Number of items to pre allocate."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_pre_allocate" hb_buffer_pre_allocate :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- size : TBasicType TUInt
    IO Int32

-- | Pre allocates memory for /@buffer@/ to fit at least /@size@/ number of items.
-- 
-- /Since: 0.9.2/
bufferPreAllocate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> Word32
    -- ^ /@size@/: Number of items to pre allocate.
    -> m Int32
    -- ^ __Returns:__ @true@ if /@buffer@/ memory allocation succeeded, @false@ otherwise
bufferPreAllocate buffer size = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_pre_allocate buffer' size
    touchManagedPtr buffer
    return result


-- function buffer_normalize_glyphs
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_normalize_glyphs" hb_buffer_normalize_glyphs :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO ()

-- | Reorders a glyph buffer to have canonical in-cluster glyph order \/ position.
-- The resulting clusters should behave identical to pre-reordering clusters.
-- 
-- \<note>This has nothing to do with Unicode normalization.\<\/note>
-- 
-- /Since: 0.9.2/
bufferNormalizeGlyphs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m ()
bufferNormalizeGlyphs buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_normalize_glyphs buffer'
    touchManagedPtr buffer
    return ()


-- function buffer_has_positions
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_buffer_t." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_has_positions" hb_buffer_has_positions :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO Int32

-- | Returns whether /@buffer@/ has glyph position data.
-- A buffer gains position data when 'GI.HarfBuzz.Functions.bufferGetGlyphPositions' is called on it,
-- and cleared of position data when 'GI.HarfBuzz.Functions.bufferClearContents' is called.
-- 
-- /Since: 2.7.3/
bufferHasPositions ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: an t'GI.HarfBuzz.Structs.BufferT.BufferT'.
    -> m Int32
    -- ^ __Returns:__ @true@ if the /@buffer@/ has position array, @false@ otherwise.
bufferHasPositions buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_has_positions buffer'
    touchManagedPtr buffer
    return result


-- function buffer_guess_segment_properties
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_guess_segment_properties" hb_buffer_guess_segment_properties :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO ()

-- | Sets unset buffer segment properties based on buffer Unicode
-- contents.  If buffer is not empty, it must have content type
-- @/HB_BUFFER_CONTENT_TYPE_UNICODE/@.
-- 
-- If buffer script is not set (ie. is @/HB_SCRIPT_INVALID/@), it
-- will be set to the Unicode script of the first character in
-- the buffer that has a script other than @/HB_SCRIPT_COMMON/@,
-- @/HB_SCRIPT_INHERITED/@, and @/HB_SCRIPT_UNKNOWN/@.
-- 
-- Next, if buffer direction is not set (ie. is @/HB_DIRECTION_INVALID/@),
-- it will be set to the natural horizontal direction of the
-- buffer script as returned by 'GI.HarfBuzz.Functions.scriptGetHorizontalDirection'.
-- If 'GI.HarfBuzz.Functions.scriptGetHorizontalDirection' returns @/HB_DIRECTION_INVALID/@,
-- then @/HB_DIRECTION_LTR/@ is used.
-- 
-- Finally, if buffer language is not set (ie. is 'GI.HarfBuzz.Constants.LANGUAGE_INVALID'),
-- it will be set to the process\'s default language as returned by
-- 'GI.HarfBuzz.Functions.languageGetDefault'.  This may change in the future by
-- taking buffer script into consideration when choosing a language.
-- Note that 'GI.HarfBuzz.Functions.languageGetDefault' is NOT threadsafe the first time
-- it is called.  See documentation for that function for details.
-- 
-- /Since: 0.9.7/
bufferGuessSegmentProperties ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m ()
bufferGuessSegmentProperties buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_guess_segment_properties buffer'
    touchManagedPtr buffer
    return ()


-- function buffer_get_unicode_funcs
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "unicode_funcs_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_unicode_funcs" hb_buffer_get_unicode_funcs :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO (Ptr HarfBuzz.UnicodeFuncsT.UnicodeFuncsT)

-- | Fetches the Unicode-functions structure of a buffer.
-- 
-- /Since: 0.9.2/
bufferGetUnicodeFuncs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m HarfBuzz.UnicodeFuncsT.UnicodeFuncsT
    -- ^ __Returns:__ The Unicode-functions structure
bufferGetUnicodeFuncs buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_get_unicode_funcs buffer'
    checkUnexpectedReturnNULL "bufferGetUnicodeFuncs" result
    result' <- (wrapBoxed HarfBuzz.UnicodeFuncsT.UnicodeFuncsT) result
    touchManagedPtr buffer
    return result'


-- function buffer_get_segment_properties
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "props"
--           , argType =
--               TInterface
--                 Name { namespace = "HarfBuzz" , name = "segment_properties_t" }
--           , argCType = Just "hb_segment_properties_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The output #hb_segment_properties_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_segment_properties" hb_buffer_get_segment_properties :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr HarfBuzz.SegmentPropertiesT.SegmentPropertiesT -> -- props : TInterface (Name {namespace = "HarfBuzz", name = "segment_properties_t"})
    IO ()

-- | Sets /@props@/ to the t'GI.HarfBuzz.Structs.SegmentPropertiesT.SegmentPropertiesT' of /@buffer@/.
-- 
-- /Since: 0.9.7/
bufferGetSegmentProperties ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m (HarfBuzz.SegmentPropertiesT.SegmentPropertiesT)
bufferGetSegmentProperties buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    props <- SP.callocBoxedBytes 32 :: IO (Ptr HarfBuzz.SegmentPropertiesT.SegmentPropertiesT)
    hb_buffer_get_segment_properties buffer' props
    props' <- (wrapBoxed HarfBuzz.SegmentPropertiesT.SegmentPropertiesT) props
    touchManagedPtr buffer
    return props'


-- function buffer_get_script
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "script_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_script" hb_buffer_get_script :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO CUInt

-- | Fetches the script of /@buffer@/.
-- 
-- /Since: 0.9.2/
bufferGetScript ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m HarfBuzz.Enums.ScriptT
    -- ^ __Returns:__ The t'GI.HarfBuzz.Enums.ScriptT' of the /@buffer@/
bufferGetScript buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_get_script buffer'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr buffer
    return result'


-- function buffer_get_replacement_codepoint
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_replacement_codepoint" hb_buffer_get_replacement_codepoint :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO Word32

-- | Fetches the @/hb_codepoint_t/@ that replaces invalid entries for a given encoding
-- when adding text to /@buffer@/.
-- 
-- /Since: 0.9.31/
bufferGetReplacementCodepoint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m Word32
    -- ^ __Returns:__ The /@buffer@/ replacement @/hb_codepoint_t/@
bufferGetReplacementCodepoint buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_get_replacement_codepoint buffer'
    touchManagedPtr buffer
    return result


-- function buffer_get_random_state
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_random_state" hb_buffer_get_random_state :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO Word32

-- | See 'GI.HarfBuzz.Functions.bufferSetRandomState'.
-- 
-- /Since: 8.4.0/
bufferGetRandomState ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m Word32
    -- ^ __Returns:__ The /@buffer@/ random state
bufferGetRandomState buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_get_random_state buffer'
    touchManagedPtr buffer
    return result


-- function buffer_get_not_found_variation_selector_glyph
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_not_found_variation_selector_glyph" hb_buffer_get_not_found_variation_selector_glyph :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO Word32

-- | See 'GI.HarfBuzz.Functions.bufferSetNotFoundVariationSelectorGlyph'.
-- 
-- /Since: 10.0.0/
bufferGetNotFoundVariationSelectorGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m Word32
    -- ^ __Returns:__ The /@buffer@/ not-found-variation-selector @/hb_codepoint_t/@
bufferGetNotFoundVariationSelectorGlyph buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_get_not_found_variation_selector_glyph buffer'
    touchManagedPtr buffer
    return result


-- function buffer_get_not_found_glyph
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_not_found_glyph" hb_buffer_get_not_found_glyph :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO Word32

-- | See 'GI.HarfBuzz.Functions.bufferSetNotFoundGlyph'.
-- 
-- /Since: 3.1.0/
bufferGetNotFoundGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m Word32
    -- ^ __Returns:__ The /@buffer@/ not-found @/hb_codepoint_t/@
bufferGetNotFoundGlyph buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_get_not_found_glyph buffer'
    touchManagedPtr buffer
    return result


-- function buffer_get_length
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_length" hb_buffer_get_length :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO Word32

-- | Returns the number of items in the buffer.
-- 
-- /Since: 0.9.2/
bufferGetLength ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m Word32
    -- ^ __Returns:__ The /@buffer@/ length.
    -- The value valid as long as buffer has not been modified.
bufferGetLength buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_get_length buffer'
    touchManagedPtr buffer
    return result


-- function buffer_get_language
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "language_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_language" hb_buffer_get_language :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO (Ptr HarfBuzz.LanguageT.LanguageT)

-- | See 'GI.HarfBuzz.Functions.bufferSetLanguage'.
-- 
-- /Since: 0.9.2/
bufferGetLanguage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m HarfBuzz.LanguageT.LanguageT
    -- ^ __Returns:__ 
    -- The t'GI.HarfBuzz.Structs.LanguageT.LanguageT' of the buffer. Must not be freed by the caller.
bufferGetLanguage buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_get_language buffer'
    checkUnexpectedReturnNULL "bufferGetLanguage" result
    result' <- (newPtr HarfBuzz.LanguageT.LanguageT) result
    touchManagedPtr buffer
    return result'


-- function buffer_get_invisible_glyph
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_invisible_glyph" hb_buffer_get_invisible_glyph :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO Word32

-- | See 'GI.HarfBuzz.Functions.bufferSetInvisibleGlyph'.
-- 
-- /Since: 2.0.0/
bufferGetInvisibleGlyph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m Word32
    -- ^ __Returns:__ The /@buffer@/ invisible @/hb_codepoint_t/@
bufferGetInvisibleGlyph buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_get_invisible_glyph buffer'
    touchManagedPtr buffer
    return result


-- function buffer_get_glyph_positions
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The output length" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "length"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The output length" , sinceVersion = Nothing }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just
--               (TCArray
--                  False
--                  (-1)
--                  1
--                  (TInterface
--                     Name { namespace = "HarfBuzz" , name = "glyph_position_t" }))
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_glyph_positions" hb_buffer_get_glyph_positions :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr Word32 ->                           -- length : TBasicType TUInt
    IO (Ptr HarfBuzz.GlyphPositionT.GlyphPositionT)

-- | Returns /@buffer@/ glyph position array.  Returned pointer
-- is valid as long as /@buffer@/ contents are not modified.
-- 
-- If buffer did not have positions before, the positions will be
-- initialized to zeros, unless this function is called from
-- within a buffer message callback (see 'GI.HarfBuzz.Functions.bufferSetMessageFunc'),
-- in which case @NULL@ is returned.
-- 
-- /Since: 0.9.2/
bufferGetGlyphPositions ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m [HarfBuzz.GlyphPositionT.GlyphPositionT]
    -- ^ __Returns:__ 
    -- The /@buffer@/ glyph position array.
    -- The value valid as long as buffer has not been modified.
bufferGetGlyphPositions buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    length_ <- allocMem :: IO (Ptr Word32)
    result <- hb_buffer_get_glyph_positions buffer' length_
    length_' <- peek length_
    checkUnexpectedReturnNULL "bufferGetGlyphPositions" result
    result' <- (unpackBoxedArrayWithLength 20 length_') result
    result'' <- mapM (newBoxed HarfBuzz.GlyphPositionT.GlyphPositionT) result'
    touchManagedPtr buffer
    freeMem length_
    return result''


-- function buffer_get_glyph_infos
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The output-array length."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "length"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The output-array length."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just
--               (TCArray
--                  False
--                  (-1)
--                  1
--                  (TInterface
--                     Name { namespace = "HarfBuzz" , name = "glyph_info_t" }))
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_glyph_infos" hb_buffer_get_glyph_infos :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr Word32 ->                           -- length : TBasicType TUInt
    IO (Ptr HarfBuzz.GlyphInfoT.GlyphInfoT)

-- | Returns /@buffer@/ glyph information array.  Returned pointer
-- is valid as long as /@buffer@/ contents are not modified.
-- 
-- /Since: 0.9.2/
bufferGetGlyphInfos ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m [HarfBuzz.GlyphInfoT.GlyphInfoT]
    -- ^ __Returns:__ 
    -- The /@buffer@/ glyph information array.
    -- The value valid as long as buffer has not been modified.
bufferGetGlyphInfos buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    length_ <- allocMem :: IO (Ptr Word32)
    result <- hb_buffer_get_glyph_infos buffer' length_
    length_' <- peek length_
    checkUnexpectedReturnNULL "bufferGetGlyphInfos" result
    result' <- (unpackBoxedArrayWithLength 20 length_') result
    result'' <- mapM (newBoxed HarfBuzz.GlyphInfoT.GlyphInfoT) result'
    touchManagedPtr buffer
    freeMem length_
    return result''


-- function buffer_get_flags
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "buffer_flags_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_flags" hb_buffer_get_flags :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO CUInt

-- | Fetches the t'GI.HarfBuzz.Flags.BufferFlagsT' of /@buffer@/.
-- 
-- /Since: 0.9.7/
bufferGetFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m [HarfBuzz.Flags.BufferFlagsT]
    -- ^ __Returns:__ The /@buffer@/ flags
bufferGetFlags buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_get_flags buffer'
    let result' = wordToGFlags result
    touchManagedPtr buffer
    return result'


-- function buffer_get_empty
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_empty" hb_buffer_get_empty :: 
    IO (Ptr HarfBuzz.BufferT.BufferT)

-- | Fetches an empty t'GI.HarfBuzz.Structs.BufferT.BufferT'.
-- 
-- /Since: 0.9.2/
bufferGetEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.BufferT.BufferT
    -- ^ __Returns:__ The empty buffer
bufferGetEmpty  = liftIO $ do
    result <- hb_buffer_get_empty
    checkUnexpectedReturnNULL "bufferGetEmpty" result
    result' <- (wrapBoxed HarfBuzz.BufferT.BufferT) result
    return result'


-- function buffer_get_direction
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "direction_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_direction" hb_buffer_get_direction :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO CUInt

-- | See 'GI.HarfBuzz.Functions.bufferSetDirection'
-- 
-- /Since: 0.9.2/
bufferGetDirection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m HarfBuzz.Enums.DirectionT
    -- ^ __Returns:__ The direction of the /@buffer@/.
bufferGetDirection buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_get_direction buffer'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr buffer
    return result'


-- function buffer_get_content_type
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "buffer_content_type_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_content_type" hb_buffer_get_content_type :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO CUInt

-- | Fetches the type of /@buffer@/ contents. Buffers are either empty, contain
-- characters (before shaping), or contain glyphs (the result of shaping).
-- 
-- /Since: 0.9.5/
bufferGetContentType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m HarfBuzz.Enums.BufferContentTypeT
    -- ^ __Returns:__ The type of /@buffer@/ contents
bufferGetContentType buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_get_content_type buffer'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr buffer
    return result'


-- function buffer_get_cluster_level
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "buffer_cluster_level_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_get_cluster_level" hb_buffer_get_cluster_level :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO CUInt

-- | Fetches the cluster level of a buffer. The t'GI.HarfBuzz.Enums.BufferClusterLevelT'
-- dictates one aspect of how HarfBuzz will treat non-base characters
-- during shaping.
-- 
-- /Since: 0.9.42/
bufferGetClusterLevel ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m HarfBuzz.Enums.BufferClusterLevelT
    -- ^ __Returns:__ The cluster level of /@buffer@/
bufferGetClusterLevel buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_get_cluster_level buffer'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr buffer
    return result'


-- function buffer_diff
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a buffer." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "reference"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "other buffer to compare to."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "dottedcircle_glyph"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "glyph id of U+25CC DOTTED CIRCLE, or (hb_codepoint_t) -1."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "position_fuzz"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "allowed absolute difference in position values."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "HarfBuzz" , name = "buffer_diff_flags_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_diff" hb_buffer_diff :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr HarfBuzz.BufferT.BufferT ->         -- reference : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- dottedcircle_glyph : TBasicType TUInt32
    Word32 ->                               -- position_fuzz : TBasicType TUInt
    IO CUInt

-- | If dottedcircle_glyph is (hb_codepoint_t) -1 then @/HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT/@
-- and @/HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT/@ are never returned.  This should be used by most
-- callers if just comparing two buffers is needed.
-- 
-- /Since: 1.5.0/
bufferDiff ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: a buffer.
    -> HarfBuzz.BufferT.BufferT
    -- ^ /@reference@/: other buffer to compare to.
    -> Word32
    -- ^ /@dottedcircleGlyph@/: glyph id of U+25CC DOTTED CIRCLE, or (hb_codepoint_t) -1.
    -> Word32
    -- ^ /@positionFuzz@/: allowed absolute difference in position values.
    -> m [HarfBuzz.Flags.BufferDiffFlagsT]
bufferDiff buffer reference dottedcircleGlyph positionFuzz = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    reference' <- unsafeManagedPtrGetPtr reference
    result <- hb_buffer_diff buffer' reference' dottedcircleGlyph positionFuzz
    let result' = wordToGFlags result
    touchManagedPtr buffer
    touchManagedPtr reference
    return result'


-- function buffer_deserialize_unicode
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_buffer_t buffer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buf"
--           , argType = TCArray False (-1) 2 (TBasicType TUTF8)
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "string to deserialize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buf_len"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the size of @buf, or -1 if it is `NULL`-terminated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "end_ptr"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char**"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "output pointer to the character after last\n                              consumed one."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "format"
--           , argType =
--               TInterface
--                 Name
--                   { namespace = "HarfBuzz" , name = "buffer_serialize_format_t" }
--           , argCType = Just "hb_buffer_serialize_format_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the #hb_buffer_serialize_format_t of the input @buf"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "buf_len"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "the size of @buf, or -1 if it is `NULL`-terminated"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_deserialize_unicode" hb_buffer_deserialize_unicode :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr CString ->                          -- buf : TCArray False (-1) 2 (TBasicType TUTF8)
    Int32 ->                                -- buf_len : TBasicType TInt
    Ptr CString ->                          -- end_ptr : TBasicType TUTF8
    CUInt ->                                -- format : TInterface (Name {namespace = "HarfBuzz", name = "buffer_serialize_format_t"})
    IO Int32

-- | Deserializes Unicode /@buffer@/ from textual representation in the format
-- produced by 'GI.HarfBuzz.Functions.bufferSerializeUnicode'.
-- 
-- /Since: 2.7.3/
bufferDeserializeUnicode ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: an t'GI.HarfBuzz.Structs.BufferT.BufferT' buffer.
    -> [T.Text]
    -- ^ /@buf@/: string to deserialize
    -> HarfBuzz.Enums.BufferSerializeFormatT
    -- ^ /@format@/: the t'GI.HarfBuzz.Enums.BufferSerializeFormatT' of the input /@buf@/
    -> m ((Int32, T.Text))
    -- ^ __Returns:__ @true@ if the full string was parsed, @false@ otherwise.
bufferDeserializeUnicode buffer buf format = liftIO $ do
    let bufLen = fromIntegral $ P.length buf
    buffer' <- unsafeManagedPtrGetPtr buffer
    buf' <- packUTF8CArray buf
    endPtr <- callocMem :: IO (Ptr CString)
    let format' = (fromIntegral . fromEnum) format
    result <- hb_buffer_deserialize_unicode buffer' buf' bufLen endPtr format'
    endPtr' <- peek endPtr
    endPtr'' <- cstringToText endPtr'
    freeMem endPtr'
    touchManagedPtr buffer
    (mapCArrayWithLength bufLen) freeMem buf'
    freeMem buf'
    freeMem endPtr
    return (result, endPtr'')


-- function buffer_deserialize_glyphs
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #hb_buffer_t buffer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buf"
--           , argType = TCArray False (-1) 2 (TBasicType TUTF8)
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "string to deserialize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buf_len"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the size of @buf, or -1 if it is `NULL`-terminated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "end_ptr"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char**"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "output pointer to the character after last\n                              consumed one."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "font"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "font_t" }
--           , argCType = Just "hb_font_t*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "font for getting glyph IDs"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "format"
--           , argType =
--               TInterface
--                 Name
--                   { namespace = "HarfBuzz" , name = "buffer_serialize_format_t" }
--           , argCType = Just "hb_buffer_serialize_format_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the #hb_buffer_serialize_format_t of the input @buf"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "buf_len"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "the size of @buf, or -1 if it is `NULL`-terminated"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_deserialize_glyphs" hb_buffer_deserialize_glyphs :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr CString ->                          -- buf : TCArray False (-1) 2 (TBasicType TUTF8)
    Int32 ->                                -- buf_len : TBasicType TInt
    Ptr CString ->                          -- end_ptr : TBasicType TUTF8
    Ptr HarfBuzz.FontT.FontT ->             -- font : TInterface (Name {namespace = "HarfBuzz", name = "font_t"})
    CUInt ->                                -- format : TInterface (Name {namespace = "HarfBuzz", name = "buffer_serialize_format_t"})
    IO Int32

-- | Deserializes glyphs /@buffer@/ from textual representation in the format
-- produced by 'GI.HarfBuzz.Functions.bufferSerializeGlyphs'.
-- 
-- /Since: 0.9.7/
bufferDeserializeGlyphs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: an t'GI.HarfBuzz.Structs.BufferT.BufferT' buffer.
    -> [T.Text]
    -- ^ /@buf@/: string to deserialize
    -> Maybe (HarfBuzz.FontT.FontT)
    -- ^ /@font@/: font for getting glyph IDs
    -> HarfBuzz.Enums.BufferSerializeFormatT
    -- ^ /@format@/: the t'GI.HarfBuzz.Enums.BufferSerializeFormatT' of the input /@buf@/
    -> m ((Int32, T.Text))
    -- ^ __Returns:__ @true@ if the full string was parsed, @false@ otherwise.
bufferDeserializeGlyphs buffer buf font format = liftIO $ do
    let bufLen = fromIntegral $ P.length buf
    buffer' <- unsafeManagedPtrGetPtr buffer
    buf' <- packUTF8CArray buf
    endPtr <- callocMem :: IO (Ptr CString)
    maybeFont <- case font of
        Nothing -> return FP.nullPtr
        Just jFont -> do
            jFont' <- unsafeManagedPtrGetPtr jFont
            return jFont'
    let format' = (fromIntegral . fromEnum) format
    result <- hb_buffer_deserialize_glyphs buffer' buf' bufLen endPtr maybeFont format'
    endPtr' <- peek endPtr
    endPtr'' <- cstringToText endPtr'
    freeMem endPtr'
    touchManagedPtr buffer
    whenJust font touchManagedPtr
    (mapCArrayWithLength bufLen) freeMem buf'
    freeMem buf'
    freeMem endPtr
    return (result, endPtr'')


-- function buffer_create_similar
-- Args: [ Arg
--           { argCName = "src"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_create_similar" hb_buffer_create_similar :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- src : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO (Ptr HarfBuzz.BufferT.BufferT)

-- | Creates a new t'GI.HarfBuzz.Structs.BufferT.BufferT', similar to 'GI.HarfBuzz.Functions.bufferCreate'. The only
-- difference is that the buffer is configured similarly to /@src@/.
-- 
-- /Since: 3.3.0/
bufferCreateSimilar ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@src@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m HarfBuzz.BufferT.BufferT
    -- ^ __Returns:__ 
    -- A newly allocated t'GI.HarfBuzz.Structs.BufferT.BufferT', similar to 'GI.HarfBuzz.Functions.bufferCreate'.
bufferCreateSimilar src = liftIO $ do
    src' <- unsafeManagedPtrGetPtr src
    result <- hb_buffer_create_similar src'
    checkUnexpectedReturnNULL "bufferCreateSimilar" result
    result' <- (wrapBoxed HarfBuzz.BufferT.BufferT) result
    touchManagedPtr src
    return result'


-- function buffer_create
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_create" hb_buffer_create :: 
    IO (Ptr HarfBuzz.BufferT.BufferT)

-- | Creates a new t'GI.HarfBuzz.Structs.BufferT.BufferT' with all properties to defaults.
-- 
-- /Since: 0.9.2/
bufferCreate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.BufferT.BufferT
    -- ^ __Returns:__ 
    -- A newly allocated t'GI.HarfBuzz.Structs.BufferT.BufferT' with a reference count of 1. The initial
    -- reference count should be released with @/hb_buffer_destroy()/@ when you are done
    -- using the t'GI.HarfBuzz.Structs.BufferT.BufferT'. This function never returns @NULL@. If memory cannot
    -- be allocated, a special t'GI.HarfBuzz.Structs.BufferT.BufferT' object will be returned on which
    -- 'GI.HarfBuzz.Functions.bufferAllocationSuccessful' returns @false@.
bufferCreate  = liftIO $ do
    result <- hb_buffer_create
    checkUnexpectedReturnNULL "bufferCreate" result
    result' <- (wrapBoxed HarfBuzz.BufferT.BufferT) result
    return result'


-- function buffer_clear_contents
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_clear_contents" hb_buffer_clear_contents :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO ()

-- | Similar to 'GI.HarfBuzz.Functions.bufferReset', but does not clear the Unicode functions and
-- the replacement code point.
-- 
-- /Since: 0.9.11/
bufferClearContents ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m ()
bufferClearContents buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_clear_contents buffer'
    touchManagedPtr buffer
    return ()


-- function buffer_changed
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_changed" hb_buffer_changed :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO ()

-- | Called by a message callback after modifying buffer glyph indices,
-- to update internal caches.
-- 
-- If not called from inside a message callback, does nothing.
-- 
-- /Since: 13.0.0/
bufferChanged ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m ()
bufferChanged buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_changed buffer'
    touchManagedPtr buffer
    return ()


-- function buffer_append
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "source"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "const hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "source #hb_buffer_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "start index into source buffer to copy.  Use 0 to copy from start of buffer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "end"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "end index into source buffer to copy.  Use @UINT_MAX (or ((unsigned int) -1)) to copy to end of buffer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_append" hb_buffer_append :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr HarfBuzz.BufferT.BufferT ->         -- source : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- start : TBasicType TUInt
    Word32 ->                               -- end : TBasicType TUInt
    IO ()

-- | Append (part of) contents of another buffer to this buffer.
-- 
-- /Since: 1.5.0/
bufferAppend ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> HarfBuzz.BufferT.BufferT
    -- ^ /@source@/: source t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> Word32
    -- ^ /@start@/: start index into source buffer to copy.  Use 0 to copy from start of buffer.
    -> Word32
    -- ^ /@end@/: end index into source buffer to copy.  Use /@uINTMAX@/ (or ((unsigned int) -1)) to copy to end of buffer.
    -> m ()
bufferAppend buffer source start end = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    source' <- unsafeManagedPtrGetPtr source
    hb_buffer_append buffer' source' start end
    touchManagedPtr buffer
    touchManagedPtr source
    return ()


-- function buffer_allocation_successful
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_allocation_successful" hb_buffer_allocation_successful :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    IO Int32

-- | Check if allocating memory for the buffer succeeded.
-- 
-- /Since: 0.9.2/
bufferAllocationSuccessful ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> m Int32
    -- ^ __Returns:__ @true@ if /@buffer@/ memory allocation succeeded, @false@ otherwise.
bufferAllocationSuccessful buffer = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    result <- hb_buffer_allocation_successful buffer'
    touchManagedPtr buffer
    return result


-- function buffer_add_utf8
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "An array of UTF-8\n              characters to append."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text_length"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The length of the @text, or -1 if it is `NULL` terminated."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The offset of the first character to add to the @buffer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_length"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The number of characters to add to the @buffer, or -1 for the\n              end of @text (assuming it is `NULL` terminated)."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "text_length"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "The length of the @text, or -1 if it is `NULL` terminated."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_add_utf8" hb_buffer_add_utf8 :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr Word8 ->                            -- text : TCArray False (-1) 2 (TBasicType TUInt8)
    Int32 ->                                -- text_length : TBasicType TInt
    Word32 ->                               -- item_offset : TBasicType TUInt
    Int32 ->                                -- item_length : TBasicType TInt
    IO ()

-- | See 'GI.HarfBuzz.Functions.bufferAddCodepoints'.
-- 
-- Replaces invalid UTF-8 characters with the /@buffer@/ replacement code point,
-- see 'GI.HarfBuzz.Functions.bufferSetReplacementCodepoint'.
-- 
-- /Since: 0.9.2/
bufferAddUtf8 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> ByteString
    -- ^ /@text@/: An array of UTF-8
    --               characters to append.
    -> Word32
    -- ^ /@itemOffset@/: The offset of the first character to add to the /@buffer@/.
    -> Int32
    -- ^ /@itemLength@/: The number of characters to add to the /@buffer@/, or -1 for the
    --               end of /@text@/ (assuming it is @NULL@ terminated).
    -> m ()
bufferAddUtf8 buffer text itemOffset itemLength = liftIO $ do
    let textLength = fromIntegral $ B.length text
    buffer' <- unsafeManagedPtrGetPtr buffer
    text' <- packByteString text
    hb_buffer_add_utf8 buffer' text' textLength itemOffset itemLength
    touchManagedPtr buffer
    freeMem text'
    return ()


-- function buffer_add_utf32
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt32)
--           , argCType = Just "const uint32_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An array of UTF-32 characters to append"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text_length"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The length of the @text, or -1 if it is `NULL` terminated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The offset of the first character to add to the @buffer"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_length"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The number of characters to add to the @buffer, or -1 for the\n              end of @text (assuming it is `NULL` terminated)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "text_length"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "The length of the @text, or -1 if it is `NULL` terminated"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_add_utf32" hb_buffer_add_utf32 :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr Word32 ->                           -- text : TCArray False (-1) 2 (TBasicType TUInt32)
    Int32 ->                                -- text_length : TBasicType TInt
    Word32 ->                               -- item_offset : TBasicType TUInt
    Int32 ->                                -- item_length : TBasicType TInt
    IO ()

-- | See 'GI.HarfBuzz.Functions.bufferAddCodepoints'.
-- 
-- Replaces invalid UTF-32 characters with the /@buffer@/ replacement code point,
-- see 'GI.HarfBuzz.Functions.bufferSetReplacementCodepoint'.
-- 
-- /Since: 0.9.2/
bufferAddUtf32 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> [Word32]
    -- ^ /@text@/: An array of UTF-32 characters to append
    -> Word32
    -- ^ /@itemOffset@/: The offset of the first character to add to the /@buffer@/
    -> Int32
    -- ^ /@itemLength@/: The number of characters to add to the /@buffer@/, or -1 for the
    --               end of /@text@/ (assuming it is @NULL@ terminated)
    -> m ()
bufferAddUtf32 buffer text itemOffset itemLength = liftIO $ do
    let textLength = fromIntegral $ P.length text
    buffer' <- unsafeManagedPtrGetPtr buffer
    text' <- packStorableArray text
    hb_buffer_add_utf32 buffer' text' textLength itemOffset itemLength
    touchManagedPtr buffer
    freeMem text'
    return ()


-- function buffer_add_utf16
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt16)
--           , argCType = Just "const uint16_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An array of UTF-16 characters to append"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text_length"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The length of the @text, or -1 if it is `NULL` terminated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The offset of the first character to add to the @buffer"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_length"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The number of characters to add to the @buffer, or -1 for the\n              end of @text (assuming it is `NULL` terminated)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "text_length"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "The length of the @text, or -1 if it is `NULL` terminated"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_add_utf16" hb_buffer_add_utf16 :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr Word16 ->                           -- text : TCArray False (-1) 2 (TBasicType TUInt16)
    Int32 ->                                -- text_length : TBasicType TInt
    Word32 ->                               -- item_offset : TBasicType TUInt
    Int32 ->                                -- item_length : TBasicType TInt
    IO ()

-- | See 'GI.HarfBuzz.Functions.bufferAddCodepoints'.
-- 
-- Replaces invalid UTF-16 characters with the /@buffer@/ replacement code point,
-- see 'GI.HarfBuzz.Functions.bufferSetReplacementCodepoint'.
-- 
-- /Since: 0.9.2/
bufferAddUtf16 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> [Word16]
    -- ^ /@text@/: An array of UTF-16 characters to append
    -> Word32
    -- ^ /@itemOffset@/: The offset of the first character to add to the /@buffer@/
    -> Int32
    -- ^ /@itemLength@/: The number of characters to add to the /@buffer@/, or -1 for the
    --               end of /@text@/ (assuming it is @NULL@ terminated)
    -> m ()
bufferAddUtf16 buffer text itemOffset itemLength = liftIO $ do
    let textLength = fromIntegral $ P.length text
    buffer' <- unsafeManagedPtrGetPtr buffer
    text' <- packStorableArray text
    hb_buffer_add_utf16 buffer' text' textLength itemOffset itemLength
    touchManagedPtr buffer
    freeMem text'
    return ()


-- function buffer_add_latin1
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , argCType = Just "const uint8_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "an array of UTF-8\n              characters to append"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text_length"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the length of the @text, or -1 if it is `NULL` terminated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the offset of the first character to add to the @buffer"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_length"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the number of characters to add to the @buffer, or -1 for the\n              end of @text (assuming it is `NULL` terminated)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "text_length"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "the length of the @text, or -1 if it is `NULL` terminated"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_add_latin1" hb_buffer_add_latin1 :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr Word8 ->                            -- text : TCArray False (-1) 2 (TBasicType TUInt8)
    Int32 ->                                -- text_length : TBasicType TInt
    Word32 ->                               -- item_offset : TBasicType TUInt
    Int32 ->                                -- item_length : TBasicType TInt
    IO ()

-- | Similar to 'GI.HarfBuzz.Functions.bufferAddCodepoints', but allows only access to first 256
-- Unicode code points that can fit in 8-bit strings.
-- 
-- \<note>Has nothing to do with non-Unicode Latin-1 encoding.\<\/note>
-- 
-- /Since: 0.9.39/
bufferAddLatin1 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> ByteString
    -- ^ /@text@/: an array of UTF-8
    --               characters to append
    -> Word32
    -- ^ /@itemOffset@/: the offset of the first character to add to the /@buffer@/
    -> Int32
    -- ^ /@itemLength@/: the number of characters to add to the /@buffer@/, or -1 for the
    --               end of /@text@/ (assuming it is @NULL@ terminated)
    -> m ()
bufferAddLatin1 buffer text itemOffset itemLength = liftIO $ do
    let textLength = fromIntegral $ B.length text
    buffer' <- unsafeManagedPtrGetPtr buffer
    text' <- packByteString text
    hb_buffer_add_latin1 buffer' text' textLength itemOffset itemLength
    touchManagedPtr buffer
    freeMem text'
    return ()


-- function buffer_add_codepoints
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #hb_buffer_t to append characters to."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt32)
--           , argCType = Just "const hb_codepoint_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an array of Unicode code points to append."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text_length"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the length of the @text, or -1 if it is `NULL` terminated."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the offset of the first code point to add to the @buffer."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_length"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the number of code points to add to the @buffer, or -1 for the\n              end of @text (assuming it is `NULL` terminated)."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "text_length"
--              , argType = TBasicType TInt
--              , argCType = Just "int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "the length of the @text, or -1 if it is `NULL` terminated."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_add_codepoints" hb_buffer_add_codepoints :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Ptr Word32 ->                           -- text : TCArray False (-1) 2 (TBasicType TUInt32)
    Int32 ->                                -- text_length : TBasicType TInt
    Word32 ->                               -- item_offset : TBasicType TUInt
    Int32 ->                                -- item_length : TBasicType TInt
    IO ()

-- | Appends characters from /@text@/ array to /@buffer@/. The /@itemOffset@/ is the
-- position of the first character from /@text@/ that will be appended, and
-- /@itemLength@/ is the number of character. When shaping part of a larger text
-- (e.g. a run of text from a paragraph), instead of passing just the substring
-- corresponding to the run, it is preferable to pass the whole
-- paragraph and specify the run start and length as /@itemOffset@/ and
-- /@itemLength@/, respectively, to give HarfBuzz the full context to be able,
-- for example, to do cross-run Arabic shaping or properly handle combining
-- marks at stat of run.
-- 
-- This function does not check the validity of /@text@/, it is up to the caller
-- to ensure it contains a valid Unicode scalar values.  In contrast,
-- 'GI.HarfBuzz.Functions.bufferAddUtf32' can be used that takes similar input but performs
-- sanity-check on the input.
-- 
-- /Since: 0.9.31/
bufferAddCodepoints ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: a t'GI.HarfBuzz.Structs.BufferT.BufferT' to append characters to.
    -> [Word32]
    -- ^ /@text@/: an array of Unicode code points to append.
    -> Word32
    -- ^ /@itemOffset@/: the offset of the first code point to add to the /@buffer@/.
    -> Int32
    -- ^ /@itemLength@/: the number of code points to add to the /@buffer@/, or -1 for the
    --               end of /@text@/ (assuming it is @NULL@ terminated).
    -> m ()
bufferAddCodepoints buffer text itemOffset itemLength = liftIO $ do
    let textLength = fromIntegral $ P.length text
    buffer' <- unsafeManagedPtrGetPtr buffer
    text' <- packStorableArray text
    hb_buffer_add_codepoints buffer' text' textLength itemOffset itemLength
    touchManagedPtr buffer
    freeMem text'
    return ()


-- function buffer_add
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "buffer_t" }
--           , argCType = Just "hb_buffer_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An #hb_buffer_t" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "codepoint"
--           , argType = TBasicType TUInt32
--           , argCType = Just "hb_codepoint_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A Unicode code point."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cluster"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The cluster value of @codepoint."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_buffer_add" hb_buffer_add :: 
    Ptr HarfBuzz.BufferT.BufferT ->         -- buffer : TInterface (Name {namespace = "HarfBuzz", name = "buffer_t"})
    Word32 ->                               -- codepoint : TBasicType TUInt32
    Word32 ->                               -- cluster : TBasicType TUInt
    IO ()

-- | Appends a character with the Unicode value of /@codepoint@/ to /@buffer@/, and
-- gives it the initial cluster value of /@cluster@/. Clusters can be any thing
-- the client wants, they are usually used to refer to the index of the
-- character in the input text stream and are output in
-- t'GI.HarfBuzz.Structs.GlyphInfoT.GlyphInfoT'.@/cluster/@ field.
-- 
-- This function does not check the validity of /@codepoint@/, it is up to the
-- caller to ensure it is a valid Unicode code point.
-- 
-- /Since: 0.9.7/
bufferAdd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BufferT.BufferT
    -- ^ /@buffer@/: An t'GI.HarfBuzz.Structs.BufferT.BufferT'
    -> Word32
    -- ^ /@codepoint@/: A Unicode code point.
    -> Word32
    -- ^ /@cluster@/: The cluster value of /@codepoint@/.
    -> m ()
bufferAdd buffer codepoint cluster = liftIO $ do
    buffer' <- unsafeManagedPtrGetPtr buffer
    hb_buffer_add buffer' codepoint cluster
    touchManagedPtr buffer
    return ()


-- function blob_make_immutable
-- Args: [ Arg
--           { argCName = "blob"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a blob" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hb_blob_make_immutable" hb_blob_make_immutable :: 
    Ptr HarfBuzz.BlobT.BlobT ->             -- blob : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    IO ()

-- | Makes a blob immutable.
-- 
-- /Since: 0.9.2/
blobMakeImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BlobT.BlobT
    -- ^ /@blob@/: a blob
    -> m ()
blobMakeImmutable blob = liftIO $ do
    blob' <- unsafeManagedPtrGetPtr blob
    hb_blob_make_immutable blob'
    touchManagedPtr blob
    return ()


-- function blob_is_immutable
-- Args: [ Arg
--           { argCName = "blob"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a blob." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_blob_is_immutable" hb_blob_is_immutable :: 
    Ptr HarfBuzz.BlobT.BlobT ->             -- blob : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    IO Int32

-- | Tests whether a blob is immutable.
-- 
-- /Since: 0.9.2/
blobIsImmutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BlobT.BlobT
    -- ^ /@blob@/: a blob.
    -> m Int32
    -- ^ __Returns:__ @true@ if /@blob@/ is immutable, @false@ otherwise
blobIsImmutable blob = liftIO $ do
    blob' <- unsafeManagedPtrGetPtr blob
    result <- hb_blob_is_immutable blob'
    touchManagedPtr blob
    return result


-- function blob_get_length
-- Args: [ Arg
--           { argCName = "blob"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a blob." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_blob_get_length" hb_blob_get_length :: 
    Ptr HarfBuzz.BlobT.BlobT ->             -- blob : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    IO Word32

-- | Fetches the length of a blob\'s data.
-- 
-- /Since: 0.9.2/
blobGetLength ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BlobT.BlobT
    -- ^ /@blob@/: a blob.
    -> m Word32
    -- ^ __Returns:__ the length of /@blob@/ data in bytes.
blobGetLength blob = liftIO $ do
    blob' <- unsafeManagedPtrGetPtr blob
    result <- hb_blob_get_length blob'
    touchManagedPtr blob
    return result


-- function blob_get_empty
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "blob_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_blob_get_empty" hb_blob_get_empty :: 
    IO (Ptr HarfBuzz.BlobT.BlobT)

-- | Returns the singleton empty blob.
-- 
-- See TODO:link object types for more information.
-- 
-- /Since: 0.9.2/
blobGetEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m HarfBuzz.BlobT.BlobT
    -- ^ __Returns:__ The empty blob.
blobGetEmpty  = liftIO $ do
    result <- hb_blob_get_empty
    checkUnexpectedReturnNULL "blobGetEmpty" result
    result' <- (wrapBoxed HarfBuzz.BlobT.BlobT) result
    return result'


-- function blob_get_data_writable
-- Args: [ Arg
--           { argCName = "blob"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a blob." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "output length of the writable data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "length"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "output length of the writable data."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TCArray False (-1) 1 (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "hb_blob_get_data_writable" hb_blob_get_data_writable :: 
    Ptr HarfBuzz.BlobT.BlobT ->             -- blob : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    Ptr Word32 ->                           -- length : TBasicType TUInt
    IO (Ptr CString)

-- | Tries to make blob data writable (possibly copying it) and
-- return pointer to data.
-- 
-- Fails if blob has been made immutable, or if memory allocation
-- fails.
-- 
-- /Since: 0.9.2/
blobGetDataWritable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BlobT.BlobT
    -- ^ /@blob@/: a blob.
    -> m [T.Text]
    -- ^ __Returns:__ Writable blob data,
    -- or @NULL@ if failed.
blobGetDataWritable blob = liftIO $ do
    blob' <- unsafeManagedPtrGetPtr blob
    length_ <- allocMem :: IO (Ptr Word32)
    result <- hb_blob_get_data_writable blob' length_
    length_' <- peek length_
    checkUnexpectedReturnNULL "blobGetDataWritable" result
    result' <- (unpackUTF8CArrayWithLength length_') result
    touchManagedPtr blob
    freeMem length_
    return result'


-- function blob_get_data
-- Args: [ Arg
--           { argCName = "blob"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a blob." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The length in bytes of the data retrieved"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "length"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The length in bytes of the data retrieved"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TCArray False (-1) 1 (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "hb_blob_get_data" hb_blob_get_data :: 
    Ptr HarfBuzz.BlobT.BlobT ->             -- blob : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    Ptr Word32 ->                           -- length : TBasicType TUInt
    IO (Ptr CString)

-- | Fetches the data from a blob.
-- 
-- /Since: 0.9.2/
blobGetData ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BlobT.BlobT
    -- ^ /@blob@/: a blob.
    -> m (Maybe [T.Text])
    -- ^ __Returns:__ the byte data of /@blob@/.
blobGetData blob = liftIO $ do
    blob' <- unsafeManagedPtrGetPtr blob
    length_ <- allocMem :: IO (Ptr Word32)
    result <- hb_blob_get_data blob' length_
    length_' <- peek length_
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (unpackUTF8CArrayWithLength length_') result'
        return result''
    touchManagedPtr blob
    freeMem length_
    return maybeResult


-- function blob_create_sub_blob
-- Args: [ Arg
--           { argCName = "parent"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Parent blob." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Start offset of sub-blob within @parent, in bytes."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of sub-blob."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "blob_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_blob_create_sub_blob" hb_blob_create_sub_blob :: 
    Ptr HarfBuzz.BlobT.BlobT ->             -- parent : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    Word32 ->                               -- offset : TBasicType TUInt
    Word32 ->                               -- length : TBasicType TUInt
    IO (Ptr HarfBuzz.BlobT.BlobT)

-- | Returns a blob that represents a range of bytes in /@parent@/.  The new
-- blob is always created with @/HB_MEMORY_MODE_READONLY/@, meaning that it
-- will never modify data in the parent blob.  The parent data is not
-- expected to be modified, and will result in undefined behavior if it
-- is.
-- 
-- Makes /@parent@/ immutable.
-- 
-- /Since: 0.9.2/
blobCreateSubBlob ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BlobT.BlobT
    -- ^ /@parent@/: Parent blob.
    -> Word32
    -- ^ /@offset@/: Start offset of sub-blob within /@parent@/, in bytes.
    -> Word32
    -- ^ /@length@/: Length of sub-blob.
    -> m HarfBuzz.BlobT.BlobT
    -- ^ __Returns:__ New blob, or the empty blob if something failed or if
    -- /@length@/ is zero or /@offset@/ is beyond the end of /@parent@/\'s data.  Destroy
    -- with @/hb_blob_destroy()/@.
blobCreateSubBlob parent offset length_ = liftIO $ do
    parent' <- unsafeManagedPtrGetPtr parent
    result <- hb_blob_create_sub_blob parent' offset length_
    checkUnexpectedReturnNULL "blobCreateSubBlob" result
    result' <- (wrapBoxed HarfBuzz.BlobT.BlobT) result
    touchManagedPtr parent
    return result'


-- function blob_create_from_file_or_fail
-- Args: [ Arg
--           { argCName = "file_name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A filename" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "blob_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_blob_create_from_file_or_fail" hb_blob_create_from_file_or_fail :: 
    CString ->                              -- file_name : TBasicType TUTF8
    IO (Ptr HarfBuzz.BlobT.BlobT)

-- | Creates a new blob containing the data from the specified file.
-- 
-- The filename is passed directly to the system on all platforms,
-- except on Windows, where the filename is interpreted as UTF-8.
-- Only if the filename is not valid UTF-8, it will be interpreted
-- according to the system codepage.
-- 
-- /Since: 2.8.2/
blobCreateFromFileOrFail ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@fileName@/: A filename
    -> m HarfBuzz.BlobT.BlobT
    -- ^ __Returns:__ An t'GI.HarfBuzz.Structs.BlobT.BlobT' pointer with the content of the file,
    -- or @NULL@ if failed.
blobCreateFromFileOrFail fileName = liftIO $ do
    fileName' <- textToCString fileName
    result <- hb_blob_create_from_file_or_fail fileName'
    checkUnexpectedReturnNULL "blobCreateFromFileOrFail" result
    result' <- (wrapBoxed HarfBuzz.BlobT.BlobT) result
    freeMem fileName'
    return result'


-- function blob_create_from_file
-- Args: [ Arg
--           { argCName = "file_name"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A font filename" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "blob_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_blob_create_from_file" hb_blob_create_from_file :: 
    CString ->                              -- file_name : TBasicType TUTF8
    IO (Ptr HarfBuzz.BlobT.BlobT)

-- | Creates a new blob containing the data from the
-- specified binary font file.
-- 
-- The filename is passed directly to the system on all platforms,
-- except on Windows, where the filename is interpreted as UTF-8.
-- Only if the filename is not valid UTF-8, it will be interpreted
-- according to the system codepage.
-- 
-- /Since: 1.7.7/
blobCreateFromFile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@fileName@/: A font filename
    -> m HarfBuzz.BlobT.BlobT
    -- ^ __Returns:__ An t'GI.HarfBuzz.Structs.BlobT.BlobT' pointer with the content of the file,
    -- or 'GI.HarfBuzz.Functions.blobGetEmpty' if failed.
blobCreateFromFile fileName = liftIO $ do
    fileName' <- textToCString fileName
    result <- hb_blob_create_from_file fileName'
    checkUnexpectedReturnNULL "blobCreateFromFile" result
    result' <- (wrapBoxed HarfBuzz.BlobT.BlobT) result
    freeMem fileName'
    return result'


-- function blob_copy_writable_or_fail
-- Args: [ Arg
--           { argCName = "blob"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "blob_t" }
--           , argCType = Just "hb_blob_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A blob." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "HarfBuzz" , name = "blob_t" })
-- throws : False
-- Skip return : False

foreign import ccall "hb_blob_copy_writable_or_fail" hb_blob_copy_writable_or_fail :: 
    Ptr HarfBuzz.BlobT.BlobT ->             -- blob : TInterface (Name {namespace = "HarfBuzz", name = "blob_t"})
    IO (Ptr HarfBuzz.BlobT.BlobT)

-- | Makes a writable copy of /@blob@/.
-- 
-- /Since: 1.8.0/
blobCopyWritableOrFail ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.BlobT.BlobT
    -- ^ /@blob@/: A blob.
    -> m HarfBuzz.BlobT.BlobT
    -- ^ __Returns:__ The new blob, or nullptr if allocation failed
blobCopyWritableOrFail blob = liftIO $ do
    blob' <- unsafeManagedPtrGetPtr blob
    result <- hb_blob_copy_writable_or_fail blob'
    checkUnexpectedReturnNULL "blobCopyWritableOrFail" result
    result' <- (wrapBoxed HarfBuzz.BlobT.BlobT) result
    touchManagedPtr blob
    return result'


-- function aat_layout_has_tracking
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_aat_layout_has_tracking" hb_aat_layout_has_tracking :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests whether the specified face includes any tracking information
-- in the @trak@ table.
-- 
-- /Since: 2.3.0/
aatLayoutHasTracking ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> m Int32
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
aatLayoutHasTracking face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_aat_layout_has_tracking face'
    touchManagedPtr face
    return result


-- function aat_layout_has_substitution
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_aat_layout_has_substitution" hb_aat_layout_has_substitution :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests whether the specified face includes any substitutions in the
-- @morx@ or @mort@ tables.
-- 
-- \<note>Note: does not examine the @GSUB@ table.\<\/note>
-- 
-- /Since: 2.3.0/
aatLayoutHasSubstitution ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> m Int32
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
aatLayoutHasSubstitution face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_aat_layout_has_substitution face'
    touchManagedPtr face
    return result


-- function aat_layout_has_positioning
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_aat_layout_has_positioning" hb_aat_layout_has_positioning :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    IO Int32

-- | Tests whether the specified face includes any positioning information
-- in the @kerx@ table.
-- 
-- \<note>Note: does not examine the @GPOS@ table.\<\/note>
-- 
-- /Since: 2.3.0/
aatLayoutHasPositioning ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> m Int32
    -- ^ __Returns:__ @true@ if data found, @false@ otherwise
aatLayoutHasPositioning face = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    result <- hb_aat_layout_has_positioning face'
    touchManagedPtr face
    return result


-- function aat_layout_get_feature_types
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first feature type to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of feature types to return;\n                Output = the actual number of feature types returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "features"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 2
--                 (TInterface
--                    Name
--                      { namespace = "HarfBuzz" , name = "aat_layout_feature_type_t" })
--           , argCType = Just "hb_aat_layout_feature_type_t*"
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Array of feature types found"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "feature_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of feature types to return;\n                Output = the actual number of feature types returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_aat_layout_get_feature_types" hb_aat_layout_get_feature_types :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    Word32 ->                               -- start_offset : TBasicType TUInt
    Word32 ->                               -- feature_count : TBasicType TUInt
    Ptr CUInt ->                            -- features : TCArray False (-1) 2 (TInterface (Name {namespace = "HarfBuzz", name = "aat_layout_feature_type_t"}))
    IO Word32

-- | Fetches a list of the AAT feature types included in the specified face.
-- 
-- /Since: 2.2.0/
aatLayoutGetFeatureTypes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> Word32
    -- ^ /@startOffset@/: offset of the first feature type to retrieve
    -> Maybe ([HarfBuzz.Enums.AatLayoutFeatureTypeT])
    -- ^ /@features@/: Array of feature types found
    -> m ((Word32, Maybe [HarfBuzz.Enums.AatLayoutFeatureTypeT]))
    -- ^ __Returns:__ Number of all available feature types.
aatLayoutGetFeatureTypes face startOffset features = liftIO $ do
    let featureCount = case features of
            Nothing -> 0
            Just jFeatures -> fromIntegral $ P.length jFeatures
    face' <- unsafeManagedPtrGetPtr face
    maybeFeatures <- case features of
        Nothing -> return FP.nullPtr
        Just jFeatures -> do
            let jFeatures' = map (fromIntegral . fromEnum) jFeatures
            jFeatures'' <- packStorableArray jFeatures'
            return jFeatures''
    result <- hb_aat_layout_get_feature_types face' startOffset featureCount maybeFeatures
    maybeMaybeFeatures <- convertIfNonNull maybeFeatures $ \maybeFeatures' -> do
        maybeFeatures'' <- (unpackStorableArrayWithLength featureCount) maybeFeatures'
        let maybeFeatures''' = map (toEnum . fromIntegral) maybeFeatures''
        freeMem maybeFeatures'
        return maybeFeatures'''
    touchManagedPtr face
    return (result, maybeMaybeFeatures)


-- function aat_layout_feature_type_get_selector_infos
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_type"
--           , argType =
--               TInterface
--                 Name
--                   { namespace = "HarfBuzz" , name = "aat_layout_feature_type_t" }
--           , argCType = Just "hb_aat_layout_feature_type_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The #hb_aat_layout_feature_type_t of the requested feature type"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_offset"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "offset of the first feature type to retrieve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "selector_count"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Input = the maximum number of selectors to return;\n                 Output = the actual number of selectors returned (may be zero)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "selectors"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 3
--                 (TInterface
--                    Name
--                      { namespace = "HarfBuzz"
--                      , name = "aat_layout_feature_selector_info_t"
--                      })
--           , argCType = Just "hb_aat_layout_feature_selector_info_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "\n            A buffer pointer. The selectors available for the feature type queries."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "default_index"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The index of the feature's default selector, if any"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "selector_count"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int*"
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Input = the maximum number of selectors to return;\n                 Output = the actual number of selectors returned (may be zero)"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_aat_layout_feature_type_get_selector_infos" hb_aat_layout_feature_type_get_selector_infos :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    CUInt ->                                -- feature_type : TInterface (Name {namespace = "HarfBuzz", name = "aat_layout_feature_type_t"})
    Word32 ->                               -- start_offset : TBasicType TUInt
    Word32 ->                               -- selector_count : TBasicType TUInt
    Ptr HarfBuzz.AatLayoutFeatureSelectorInfoT.AatLayoutFeatureSelectorInfoT -> -- selectors : TCArray False (-1) 3 (TInterface (Name {namespace = "HarfBuzz", name = "aat_layout_feature_selector_info_t"}))
    Ptr Word32 ->                           -- default_index : TBasicType TUInt
    IO Word32

-- | Fetches a list of the selectors available for the specified feature in the given face.
-- 
-- If upon return, /@defaultIndex@/ is set to 'GI.HarfBuzz.Constants.AAT_LAYOUT_NO_SELECTOR_INDEX', then
-- the feature type is non-exclusive.  Otherwise, /@defaultIndex@/ is the index of
-- the selector that is selected by default.
-- 
-- /Since: 2.2.0/
aatLayoutFeatureTypeGetSelectorInfos ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> HarfBuzz.Enums.AatLayoutFeatureTypeT
    -- ^ /@featureType@/: The t'GI.HarfBuzz.Enums.AatLayoutFeatureTypeT' of the requested feature type
    -> Word32
    -- ^ /@startOffset@/: offset of the first feature type to retrieve
    -> [HarfBuzz.AatLayoutFeatureSelectorInfoT.AatLayoutFeatureSelectorInfoT]
    -- ^ /@selectors@/: 
    --             A buffer pointer. The selectors available for the feature type queries.
    -> m ((Word32, [HarfBuzz.AatLayoutFeatureSelectorInfoT.AatLayoutFeatureSelectorInfoT], Word32))
    -- ^ __Returns:__ Number of all available feature selectors
aatLayoutFeatureTypeGetSelectorInfos face featureType startOffset selectors = liftIO $ do
    let selectorCount = fromIntegral $ P.length selectors
    face' <- unsafeManagedPtrGetPtr face
    let featureType' = (fromIntegral . fromEnum) featureType
    selectors' <- mapM unsafeManagedPtrGetPtr selectors
    selectors'' <- packBlockArray 16 selectors'
    defaultIndex <- allocMem :: IO (Ptr Word32)
    result <- hb_aat_layout_feature_type_get_selector_infos face' featureType' startOffset selectorCount selectors'' defaultIndex
    selectors''' <- (unpackBlockArrayWithLength 16 selectorCount) selectors''
    selectors'''' <- mapM (wrapPtr HarfBuzz.AatLayoutFeatureSelectorInfoT.AatLayoutFeatureSelectorInfoT) selectors'''
    freeMem selectors''
    defaultIndex' <- peek defaultIndex
    touchManagedPtr face
    mapM_ touchManagedPtr selectors
    freeMem defaultIndex
    return (result, selectors'''', defaultIndex')


-- function aat_layout_feature_type_get_name_id
-- Args: [ Arg
--           { argCName = "face"
--           , argType =
--               TInterface Name { namespace = "HarfBuzz" , name = "face_t" }
--           , argCType = Just "hb_face_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#hb_face_t to work upon"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "feature_type"
--           , argType =
--               TInterface
--                 Name
--                   { namespace = "HarfBuzz" , name = "aat_layout_feature_type_t" }
--           , argCType = Just "hb_aat_layout_feature_type_t"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The #hb_aat_layout_feature_type_t of the requested feature type"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "hb_aat_layout_feature_type_get_name_id" hb_aat_layout_feature_type_get_name_id :: 
    Ptr HarfBuzz.FaceT.FaceT ->             -- face : TInterface (Name {namespace = "HarfBuzz", name = "face_t"})
    CUInt ->                                -- feature_type : TInterface (Name {namespace = "HarfBuzz", name = "aat_layout_feature_type_t"})
    IO Word32

-- | Fetches the name identifier of the specified feature type in the face\'s @name@ table.
-- 
-- /Since: 2.2.0/
aatLayoutFeatureTypeGetNameId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HarfBuzz.FaceT.FaceT
    -- ^ /@face@/: t'GI.HarfBuzz.Structs.FaceT.FaceT' to work upon
    -> HarfBuzz.Enums.AatLayoutFeatureTypeT
    -- ^ /@featureType@/: The t'GI.HarfBuzz.Enums.AatLayoutFeatureTypeT' of the requested feature type
    -> m Word32
    -- ^ __Returns:__ Name identifier of the requested feature type
aatLayoutFeatureTypeGetNameId face featureType = liftIO $ do
    face' <- unsafeManagedPtrGetPtr face
    let featureType' = (fromIntegral . fromEnum) featureType
    result <- hb_aat_layout_feature_type_get_name_id face' featureType'
    touchManagedPtr face
    return result



