22 int count()
override {
return 0; }
24 SkDEBUGFAIL(
"SkFontStyleSet::getStyle called on empty set");
27 SkDEBUGFAIL(
"SkFontStyleSet::createTypeface called on empty set");
47 SkDEBUGFAIL(
"onGetFamilyName called with bad index");
50 SkDEBUGFAIL(
"onCreateStyleSet called with bad index");
90 return std::move(fsset);
115 const char* bcp47[],
int bcp47Count,
121 if (
nullptr == data) {
128 int ttcIndex)
const {
129 if (
nullptr == stream) {
137 if (
nullptr == stream) {
144 if (
nullptr == path) {
193 Score& operator +=(
int rhs) { this->score += rhs;
return *
this; }
194 Score& operator <<=(
int rhs) { this->score <<= rhs;
return *
this; }
195 bool operator <(
const Score& that) {
return this->score < that.score; }
198 Score maxScore = { 0, 0 };
199 for (
int i = 0; i <
count; ++i) {
201 this->
getStyle(i, ¤t,
nullptr);
202 Score currentScore = { 0, i };
208 currentScore += 10 - pattern.
width() + current.
width();
210 currentScore += 10 - current.
width();
214 currentScore += 10 + pattern.
width() - current.
width();
216 currentScore += current.
width();
226 "SkFontStyle::Slant values not as required.");
228 0 <= current.
slant() && current.
slant() <= 2);
229 static const int score[3][3] = {
236 currentScore += score[pattern.
slant()][current.
slant()];
245 currentScore += 1000;
247 }
else if (pattern.
weight() < 400) {
249 currentScore += 1000 - pattern.
weight() + current.
weight();
251 currentScore += 1000 - current.
weight();
254 }
else if (pattern.
weight() <= 500) {
256 currentScore += 1000 + pattern.
weight() - current.
weight();
258 currentScore += 500 + current.
weight();
260 currentScore += 1000 - current.
weight();
263 }
else if (pattern.
weight() > 500) {
265 currentScore += 1000 + pattern.
weight() - current.
weight();
267 currentScore += current.
weight();
271 if (maxScore < currentScore) {
272 maxScore = currentScore;
#define SkDEBUGFAIL(message)
static sk_sp< SkFontStyleSet > emptyOnNull(sk_sp< SkFontStyleSet > &&fsset)
sk_sp< SkTypeface > onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle &style, const char *bcp47[], int bcp47Count, SkUnichar character) const override
sk_sp< SkTypeface > onMakeFromData(sk_sp< SkData >, int) const override
sk_sp< SkTypeface > onMakeFromStreamIndex(std::unique_ptr< SkStreamAsset >, int) const override
sk_sp< SkTypeface > onMakeFromFile(const char[], int) const override
sk_sp< SkTypeface > onMatchFamilyStyle(const char[], const SkFontStyle &) const override
void onGetFamilyName(int index, SkString *familyName) const override
sk_sp< SkFontStyleSet > onCreateStyleSet(int index) const override
sk_sp< SkFontStyleSet > onMatchFamily(const char[]) const override
int onCountFamilies() const override
sk_sp< SkTypeface > onLegacyMakeTypeface(const char[], SkFontStyle) const override
sk_sp< SkTypeface > onMakeFromStreamArgs(std::unique_ptr< SkStreamAsset >, const SkFontArguments &) const override
sk_sp< SkTypeface > matchStyle(const SkFontStyle &) override
void getStyle(int, SkFontStyle *, SkString *) override
sk_sp< SkTypeface > createTypeface(int index) override
sk_sp< SkFontStyleSet > createStyleSet(int index) const
sk_sp< SkTypeface > matchFamilyStyleCharacter(const char familyName[], const SkFontStyle &, const char *bcp47[], int bcp47Count, SkUnichar character) const
static sk_sp< SkFontMgr > RefEmpty()
sk_sp< SkTypeface > makeFromFile(const char path[], int ttcIndex=0) const
virtual void onGetFamilyName(int index, SkString *familyName) const =0
sk_sp< SkTypeface > makeFromStream(std::unique_ptr< SkStreamAsset >, int ttcIndex=0) const
void getFamilyName(int index, SkString *familyName) const
sk_sp< SkTypeface > makeFromData(sk_sp< SkData >, int ttcIndex=0) const
sk_sp< SkFontStyleSet > matchFamily(const char familyName[]) const
virtual sk_sp< SkTypeface > onMakeFromData(sk_sp< SkData >, int ttcIndex) const =0
virtual sk_sp< SkFontStyleSet > onCreateStyleSet(int index) const =0
int countFamilies() const
virtual sk_sp< SkTypeface > onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle &, const char *bcp47[], int bcp47Count, SkUnichar character) const =0
virtual sk_sp< SkFontStyleSet > onMatchFamily(const char familyName[]) const =0
virtual sk_sp< SkTypeface > onMakeFromStreamIndex(std::unique_ptr< SkStreamAsset >, int ttcIndex) const =0
sk_sp< SkTypeface > legacyMakeTypeface(const char familyName[], SkFontStyle style) const
virtual sk_sp< SkTypeface > onMakeFromStreamArgs(std::unique_ptr< SkStreamAsset >, const SkFontArguments &) const =0
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const
virtual sk_sp< SkTypeface > onMatchFamilyStyle(const char familyName[], const SkFontStyle &) const =0
virtual sk_sp< SkTypeface > onLegacyMakeTypeface(const char familyName[], SkFontStyle) const =0
virtual sk_sp< SkTypeface > onMakeFromFile(const char path[], int ttcIndex) const =0
virtual int onCountFamilies() const =0
static sk_sp< SkFontStyleSet > CreateEmpty()
sk_sp< SkTypeface > matchStyleCSS3(const SkFontStyle &pattern)
virtual sk_sp< SkTypeface > createTypeface(int index)=0
virtual void getStyle(int index, SkFontStyle *, SkString *style)=0
static bool operator<(const SkPlainTextEditor::Editor::TextPosition &u, const SkPlainTextEditor::Editor::TextPosition &v)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args