1cb93a386Sopenharmony_ci// Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved
2cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
3cb93a386Sopenharmony_ci// found in the LICENSE file.
4cb93a386Sopenharmony_ci
5cb93a386Sopenharmony_ci#ifndef SKFONTSTYLESET_OHOS_H
6cb93a386Sopenharmony_ci#define SKFONTSTYLESET_OHOS_H
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci#include "SkFontMgr.h"
9cb93a386Sopenharmony_ci
10cb93a386Sopenharmony_ci#include "FontConfig_ohos.h"
11cb93a386Sopenharmony_ci#include "SkTypeface_ohos.h"
12cb93a386Sopenharmony_ci
13cb93a386Sopenharmony_ci/*!
14cb93a386Sopenharmony_ci * \brief To implement SkFontStyleSet for ohos platform
15cb93a386Sopenharmony_ci */
16cb93a386Sopenharmony_ciclass SK_API SkFontStyleSet_OHOS : public SkFontStyleSet {
17cb93a386Sopenharmony_cipublic:
18cb93a386Sopenharmony_ci    SkFontStyleSet_OHOS(const std::shared_ptr<FontConfig_OHOS>& fontConfig,
19cb93a386Sopenharmony_ci        int index, bool isFallback = false);
20cb93a386Sopenharmony_ci    virtual ~SkFontStyleSet_OHOS() override = default;
21cb93a386Sopenharmony_ci    virtual int count() override;
22cb93a386Sopenharmony_ci    virtual void getStyle(int index, SkFontStyle* style, SkString* styleName) override;
23cb93a386Sopenharmony_ci    virtual SkTypeface* createTypeface(int index) override;
24cb93a386Sopenharmony_ci    virtual SkTypeface* matchStyle(const SkFontStyle& pattern) override;
25cb93a386Sopenharmony_ciprivate:
26cb93a386Sopenharmony_ci    std::shared_ptr<FontConfig_OHOS> fontConfig_ = nullptr; // the object of FontConfig_OHOS
27cb93a386Sopenharmony_ci    int styleIndex = 0; // the index of the font style set
28cb93a386Sopenharmony_ci    bool isFallback = false; // the flag of font style set. False for fallback family, true for generic family.
29cb93a386Sopenharmony_ci    int tpCount = -1; // the typeface count in the font style set
30cb93a386Sopenharmony_ci};
31cb93a386Sopenharmony_ci
32cb93a386Sopenharmony_ci#endif /* SKFONTSTYLESET_OHOS_H */
33