package = org.jetbrains.skiko.skia.native
language = C++
plugin = org.jetbrains.kotlin.native.interop.skia
compilerOpts.osx = -x c++ -std=c++14 \
    -DSK_GL \
    -DSK_SUPPORT_GPU=1 \
    -DSK_SHAPER_CORETEXT_AVAILABLE \
    -DSK_BUILD_FOR_MAC \
    -DSK_METAL \
    -DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1 \
    -DSK_FORCE_DISTANCE_FIELD_TEXT=0 \
    -DSK_GAMMA_APPLY_TO_A8 \
    -DSK_GAMMA_SRGB \
    -DSK_SCALAR_TO_FLOAT_EXCLUDED \
    -DSK_SHAPER_HARFBUZZ_AVAILABLE \
    -DSK_SUPPORT_OPENCL=0 \
    -DSK_UNICODE_AVAILABLE

headers = modules/skparagraph/include/ParagraphBuilder.h modules/skparagraph/include/TypefaceFontProvider.h modules/skparagraph/include/Paragraph.h modules/skparagraph/include/FontCollection.h modules/skparagraph/include/Metrics.h modules/skparagraph/include/ParagraphStyle.h modules/skparagraph/include/TextStyle.h include/core/SkFontMgr.h include/core/SkFilterQuality.h include/core/SkCanvas.h include/core/SkData.h include/core/SkImage.h include/core/SkMath.h include/core/SkPathMeasure.h include/core/SkStream.h include/core/SkSurface.h include/core/SkSurfaceProps.h include/core/SkTypes.h include/core/SkPaint.h include/core/SkPictureRecorder.h include/core/SkPoint3.h include/core/SkImageInfo.h include/core/SkColor.h include/core/SkColorSpace.h include/utils/SkShadowUtils.h include/gpu/GrDirectContext.h include/gpu/GrBackendSurface.h include/gpu/GrConfig.h include/gpu/gl/GrGLInterface.h

headerFilter = modules/skparagraph/include/ParagraphBuilder.h modules/skparagraph/include/TypefaceFontProvider.h modules/skparagraph/include/Paragraph.h modules/skparagraph/include/FontCollection.h modules/skparagraph/include/Metrics.h modules/skparagraph/include/ParagraphStyle.h modules/skparagraph/include/TextStyle.h include/core/SkFontMgr.h include/core/SkFilterQuality.h include/core/SkCanvas.h include/core/SkData.h include/core/SkImage.h include/core/SkMath.h include/core/SkPathMeasure.h include/core/SkStream.h include/core/SkSurface.h include/core/SkSurfaceProps.h include/core/SkTypes.h include/core/SkPaint.h include/core/SkPictureRecorder.h include/core/SkPoint3.h include/core/SkImageInfo.h include/core/SkColor.h include/core/SkColorSpace.h include/utils/SkShadowUtils.h include/gpu/GrDirectContext.h include/gpu/GrBackendSurface.h include/gpu/GrConfig.h include/gpu/gl/GrGLInterface.h

# const overloads are not supported yet
excludedFunctions = mapRect ptr priv

linkerOpts.osx = -framework CoreServices -framework CoreText -framework CoreGraphics -framework Metal

---

static inline skia::textlayout::Paragraph* __ParagraphBuilder__Build(skia::textlayout::ParagraphBuilder* paragraphBuilder) {
    return paragraphBuilder->Build().release();
}

static inline skia::textlayout::ParagraphBuilder* __ParagraphBuilder__make(const skia::textlayout::ParagraphStyle* style, sk_sp<skia::textlayout::FontCollection> fontCollection) {
    return skia::textlayout::ParagraphBuilder::make(*style, fontCollection).release();
}

// This is to wrokaround skia interop's inability to pass c++ classes by value
static inline void __TextStyle__setFontStyle(skia::textlayout::TextStyle* textStyle, SkFontStyle& fontStyle) {
    textStyle->setFontStyle(fontStyle);
}


// static inline SkFontStyle* __SkFontStyle__Normal() {
//     return &SkFontStyle::Normal();
// }

// This is to workaround our inability to construct the default constructor for TypefaceFontProvider
static inline skia::textlayout::TypefaceFontProvider* __TypefaceFontProvider() {
    return new skia::textlayout::TypefaceFontProvider();
}

