// Copyright (c) 2021 Huawei Device Co., Ltd. All rights reserved // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SKFONTSTYLESET_OHOS_H #define SKFONTSTYLESET_OHOS_H #include "SkFontMgr.h" #include "FontConfig_ohos.h" #include "SkTypeface_ohos.h" /*! * \brief To implement SkFontStyleSet for ohos platform */ class SkFontStyleSet_OHOS : public SkFontStyleSet { public: SkFontStyleSet_OHOS(const std::shared_ptr& fontConfig, int index, bool isFallback = false); virtual ~SkFontStyleSet_OHOS() override = default; virtual int count() override; virtual void getStyle(int index, SkFontStyle* style, SkString* styleName) override; virtual SkTypeface* createTypeface(int index) override; virtual SkTypeface* matchStyle(const SkFontStyle& pattern) override; private: std::shared_ptr fontConfig_ = nullptr; // the object of FontConfig_OHOS int styleIndex = 0; // the index of the font style set bool isFallback = false; // the flag of font style set. False for fallback family, true for generic family. int tpCount = -1; // the typeface count in the font style set }; #endif /* SKFONTSTYLESET_OHOS_H */