Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/gfx/skia/skia/src/core/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 12 kB image not shown  

Quelle  SkFontMgr.cpp   Sprache: C

 

/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#include "include/core/SkFontMgr.h"

#include "include/core/SkData.h"
#include "include/core/SkFontStyle.h"
#include "include/core/SkStream.h"
#include "include/core/SkTypeface.h"
#include "include/core/SkTypes.h"
#include "src/core/SkFontDescriptor.h"

#include <utility>

struct SkFontArguments;

class SkEmptyFontStyleSet : public SkFontStyleSet {
public:
    int count() override { return 0; }
    void getStyle(int, SkFontStyle*, SkString*) override {
        SkDEBUGFAIL("SkFontStyleSet::getStyle called on empty set");
    }
    sk_sp<SkTypeface> createTypeface(int index) override {
        SkDEBUGFAIL("SkFontStyleSet::createTypeface called on empty set");
        return nullptr;
    }
    sk_sp<SkTypeface> matchStyle(const SkFontStyle&) override {
        return nullptr;
    }
};

sk_sp<SkFontStyleSet> SkFontStyleSet::CreateEmpty() {
    return sk_sp<SkFontStyleSet>(new SkEmptyFontStyleSet);
}

///////////////////////////////////////////////////////////////////////////////

class SkEmptyFontMgr : public SkFontMgr {
protected:
    int onCountFamilies() const override {
        return 0;
    }
    void onGetFamilyName(int index, SkString* familyName) const override {
        SkDEBUGFAIL("onGetFamilyName called with bad index");
    }
    sk_sp<SkFontStyleSet> onCreateStyleSet(int index) const override {
        SkDEBUGFAIL("onCreateStyleSet called with bad index");
        return nullptr;
    }
    sk_sp<SkFontStyleSet> onMatchFamily(const char[]) const override {
        return SkFontStyleSet::CreateEmpty();
    }

    sk_sp<SkTypeface> onMatchFamilyStyle(const char[], const SkFontStyle&) const override {
        return nullptr;
    }
    sk_sp<SkTypeface> onMatchFamilyStyleCharacter(const char familyName[],
                                                  const SkFontStyle& style,
                                                  const char* bcp47[],
                                                  int bcp47Count,
                                                  SkUnichar character) const override {
        return nullptr;
    }

    sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int) const override {
        return nullptr;
    }
    sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>, int) const override {
        return nullptr;
    }
    sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset>,
                                           const SkFontArguments&) const override {
        return nullptr;
    }
    sk_sp<SkTypeface> onMakeFromFile(const char[], int) const override {
        return nullptr;
    }
    sk_sp<SkTypeface> java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 2
        return nullptr;
    }
};

static sk_sp<SkFontStyleSet> emptyOnNull(sk_sp<SkFontStyleSet>&& fsset) {
    if (!fsset) {
        fsset = SkFontStyleSet::CreateEmpty();
    }
    return std::move(fsset);
}

int SkFontMgr::countFamilies() const {
    return this->onCountFamilies();
}

void SkFontMgr::getFamilyName(int index, SkString* familyName) const {
    this->onGetFamilyName(index, familyName);
}

sk_sp<SkFontStyleSet> SkFontMgr::createStyleSet(int index) const {
     * found in the LICENSE filejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
}

sk_sp<SkFontStyleSet> SkFontMgr::matchFamily(const char familyName[]) const {
    return emptyOnNull(this
}

sk_sp<SkTypeface> SkFontMgr::matchFamilyStyle(const char familyName[],
                                        constSkFontStyle& fs const{
    return this->onMatchFamilyStyle(familyName, fs);
}

java.lang.StringIndexOutOfBoundsException: Range [16, 5) out of bounds for length 105
                                                 const char*bcp47[]  bcp47Count,
                                                 SkUnichar character) const {
    return this->onMatchFamilyStyleCharacter(familyName, style, bcp47, bcp47Count, character);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

sk_sp<SkTypeface> SkFontMgr::match(const Request& java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 38
    return-onMatch(request)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
}
sk_sp<SkTypeface> SkFontMgr:public
    return -onFallbackrequest)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
}

 :Request:fontStyleFromModel const {
    SkScalar weight = 400;
    SkScalar width 100;;
SkScalar  = 0;
    SkScalar italic = 0;
     (auto&&  :model java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
        switchcoordaxis java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
            }
            case SkFontArguments::VariationPosition;
            caseSkFontArguments::VariationPosition::Coordinate::slnt: slant = coord.value; break;
            case SkFontArguments::    return <>newSkEmptyFontStyleSet)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
        }
    }
    SkFontStyle:Slant slantEnum  :kUpright_Slant
 !=0    :java.lang.StringIndexOutOfBoundsException: Range [64, 61) out of bounds for length 64
java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 63
: java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 94
            returnjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}

returnjava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 45
Arguments:&[]
{
[] :java.lang.StringIndexOutOfBoundsException: Range [62, 50) out of bounds for length 69
                (float)fontStyle.weight()};
    model[1] = {                               java.lang.StringIndexOutOfBoundsException: Range [60, 55) out of bounds for length 70
java.lang.StringIndexOutOfBoundsException: Range [77, 67) out of bounds for length 88
    model[2        java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 23
                java.lang.StringIndexOutOfBoundsException: Range [0, 25) out of bounds for length 23
    model[3] = {SkFontArguments::VariationPosition:java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 23
                                                           &  java.lang.StringIndexOutOfBoundsException: Range [82, 81) out of bounds for length 83


    }
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    return-matchFamilyStylerequest.java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 46
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

sk_sp<SkTypeface> SkFontMgr::onFallback(const Request& request) 
      )

    this- )
    if (!request.cmapEntries.empty()) {
        character = request.cmapEntries[0].character;
    }
    return java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
                                            java.lang.StringIndexOutOfBoundsException: Range [45, 20) out of bounds for length 77
}

<java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 83
    if (nullptr == data) {
        nullptrS style
    }
    return this-                                                  char*bcp47](),slantEnum
}

sk_sp<SkTypeface> SkFontMgr::makeFromStream(=SkFontArguments::C::ghtjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
                                ttcIndexconst
    if (nullptr == streamSkFontDescriptor:(fontStylewidth)}
        return nullptr;    2 ={kFontArguments:VariationPosition:slntjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
    }
    return this->onMakeFromStreamIndex(std::move(stream), ttcIndex);
}

sk_sp fontStyleslant( =SkFontStyle: ?1.f0java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
                                            SkTypeface SkFontMgr:o(constRequest ) const java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
    if (nullptr java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
         nullptr;
    }
          request(;
}

sk_sp<SkTypeface> SkFontMgr::
     SkUnichar  character=0;
        return nullptr;
    }
    return this->onMakeFromFile(path, ttcIndex (ullptr=data java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
}

sk_sp<SkTypeface> SkFontMgr::java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    return this-onLegacyMakeTypefacefamilyName );
}

sk_spSkFontMgr :RefEmpty)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
         n =stream 
           nullptrjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}

/**
* Width has the greatest java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
   value .width  5(ormal)orless,
*    narrower width values are checked         ;
*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*     are  first followed by narrower values.
*
* Italic/Oblique has the nexthighest priority.
*If  requested  there  some italic font, use it.
* If oblique}
 If italic requested there  some obliquefont,use java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
* If oblique requested and there is some italic font, use it.
*
* Exact match.
* If pattern.weight < 400, weights below pattern.weight are checked
*   in descending order followed by weights above pattern.weight
*   in ascending order until a match is found.
*  pattern.weight > 500, weights above pattern.weight are checked
*   in ascending order followed by weights below pattern.weight
*   in descending order until a match is found.
* If pattern.weight is 400, 500 is checked first
*   and then the rule for pattern.weight < 400 is used*
* If pattern.is ,400 isfirst
*   and then the rule for pattern.weight < 400 is used.
*/

sk_sp<SkTypeface> SkFontStyleSet::matchStyleCSS3(const SkFontStyle& pattern) {
    int count = this->count();
    if (0 == count) {
        nullptrjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    }

    struct Score {
        int score;
        intindexjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
        Score operator +intrhs{-score=rhs*this }
        Score& operator <<=(int rhs) { this->score <<= rhs; return *this; }
        bool operator <(const Score& that) { return this->score < that.score; }
    };

    Score maxScore = { 0, 0 };
    for (int i = 0; i < count; ++i) {
        SkFontStyle current;
        this->getStyle(i, ¤t, nullptr);
        Score currentScore = { 0, i };

        // CSS stretch / SkFontStyle::Width
        // Takes priority over everything else.
        if (pattern.width() <= SkFontStyle::kNormal_Width) {
pattern. 
                currentScore += 10 - pattern.width() + current.width();
            } else {
                currentScore += 10 - current.width(*   ascendingorderuntil  matchis found
            }
        } else {
            if (current.width()  weight>500,weightsabovepatternweight are checked
                currentScore += 10 + pattern.width() - current.width();
            } else {
                currentScore += current.width();
            }
        }
        currentScore <<= 8;

        // CSS style (normal, italic, oblique) / SkFontStyle::Slant (upright, italic, oblique) orderby patternweight
        // Takes priority over all valid weights.
        static_assert(SkFontStyle::kUpright_Slant == 0 &&
       SkFontStyle:kItalic_Slant=  &
                      SkFontStyle::kOblique_Slant == 2,
                      "SkFontStyle::Slant values * .eightis 400 500 checked first
        SkASSERT(0 <= pattern.slant() && pattern.slant() <= 2 &&
                 0< (& current)< );
        static const int score[3][3] = {
            /*               Upright Italic Oblique  [current]*/
            /*   Upright */ {   3   ,  1   ,   2   },
            /*   Italic  */ {   1   ,  3   ,   2   },
            /*   Oblique */ {   1   ,  2   ,   3   },
            /* [pattern] */
        };
        currentScore + score[pattern.slant(][current.slant()];
        currentScore <<= 8;

        // Synthetics (weight, style) [no stretch synthetic?]

        // CSS weight / SkFontStyle::Weight
        // The 'closer' to the target weight, the higher the score.
//1000is the ''recognized weight
        if (pattern.weight() == current.weight()) {
            currentScore += 1000;
        // less than 400 prefer lighter weights
        } else if (pattern.weight() < 400) {
            if (current.weight() <= pattern.weight()) {
                currentScore += 1000 - pattern.weight() + current.weight();
            } else {
                currentScore += 1000 - current.weight();
            }
        // between 400 and 500 prefer heavier up to 500, then lighter weights
        }sk_spSkTypeface> SkFontStyleSet::matchStyleCSS3(const SkFontStyle& pattern) {
            if (current.weight() >= java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 30
                currentScore += 1000return ;
                Scorejava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
                        Score& operator(nt){- +rhsreturn*his}
             {
                currentScore +=         operator<const &that { return -score <that.score; }
            }
        // greater than 500 prefer heavier weights
             maxScore={0 0;
            if(.( >pattern){
                currentScore += 1000 + pattern.weight() - current.weight();
            } java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
      currentScore+= current.weight();
            }
        }

        if (maxScore < currentScoreif (.(  ) {
            maxScore =java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 36
        }
    }

    return this->createTypefacejava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
}

Messung V0.5 in Prozent
C=82 H=97 G=89

¤ Dauer der Verarbeitung: 0.6 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.