blob: 1f2c046c2cc93517294c3edad9097a55d0b5961b [file] [log] [blame]
/*
* Copyright 2024 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkFontMgr_custom_DEFINED
#define SkFontMgr_custom_DEFINED
#include "include/core/SkFontMgr.h"
#include "include/core/SkFontStyle.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkTArray.h"
class SkData;
class SkStreamAsset;
class SkTypeface;
/**
* SkFontMgr_Fontations_Empty
*
* A SkFontMgr with an empty list of fonts, meant as a basic tool for font instantiation from
* data in testing, see TestFontMgr in FontToolUtils.
*/
class SkFontMgr_Fontations_Empty : public SkFontMgr {
public:
SkFontMgr_Fontations_Empty() = default;
protected:
int onCountFamilies() const override;
void onGetFamilyName(int index, SkString* familyName) const override;
sk_sp<SkFontStyleSet> onCreateStyleSet(int index) const override;
sk_sp<SkFontStyleSet> onMatchFamily(const char familyName[]) const override;
sk_sp<SkTypeface> onMatchFamilyStyle(const char familyName[],
const SkFontStyle& fontStyle) const override;
sk_sp<SkTypeface> onMatchFamilyStyleCharacter(const char familyName[],
const SkFontStyle&,
const char* bcp47[],
int bcp47Count,
SkUnichar character) const override;
sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData> data, int ttcIndex) const override;
sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>,
int ttcIndex) const override;
sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset>,
const SkFontArguments&) const override;
sk_sp<SkTypeface> onMakeFromFile(const char path[], int ttcIndex) const override;
sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[],
SkFontStyle style) const override;
};
#endif