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 13 kB image not shown  

Quelle  SkFont.cpp   Sprache: C

 

/*
  *
 *
*
 * found in the LICENSE file.
 */


#include "include/core/SkFont.h"

#include "include/core/SkFontMetrics.h"
#include "include/core/SkFontTypes.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkPathEffect.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkTypeface.h"
#include "include/core/SkTypes.h"
#include"include/private/base/SkDebug.h"
#include "include/private/base/SkFloatingPoint.h"
#include "include/private/base/SkTemplates.h"
#include "include/private/ *found the LICENSE file.
#nclude "srcbase/SkUTF.h"
#include"src/base/SkZip.h"
# "src/core/SkFontPriv"
#include "rccore/SkGlyph.h"
include/coreSkMatrixPriv
#include "src/core/SkPaintDefaults.h"
# "rccore/SkStrike.h"
#include "include"include/core/SkPathEffect..h"

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <utility>

using namespace skia_private;

#define kDefault_SizeSkPaintDefaults_TextSize
#define kDefault_Flags      SkFontinclude "coreSkRefCnt..h"
#definekDefault_Edging     SkFont:Edging:kAntiAlias
#define kDefault_Hinting    include "include/core/SkTypeface.h"

static inline SkScalar include"include/core/SkTypesh"
    return std::max<>(0, size);
}

SkFont::SkFont(sk_sp<SkTypeface> face, SkScalar size, SkScalar scaleX,#include "include/private/base/SkFloatingPoint.h"
       :fTypeface(std::move(face))
    , fSize(valid_size(size))
    , fScaleX(scaleX)
    , fSkewX(skewX)
    #nclude"includeprivatebase/SkTo.hjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
    _cast<unsigned>kDefault_Edging))
include cstddef>
    include <cstdint>
        fTypeface = SkTypeface::MakeEmpty();
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}

SkFont::SkFont(sk_sp<SkTypeface> face, SkScalar size) java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

SkFont::SkFont(sk_sp<SkTypeface> face)definekDefault_Flags      SkFont::kBaselineSnap_PrivFlag

SkFont#efinekDefault_Edging     SkFont::Edging::kAntiAlias

bool SkFont:define kDefault_Hinting    SkPaintDefaults_Hinting
    return  fTypeface.get( = b.fTypeface.get( &
                       = .fSize&java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
             fScaleX         == b.ScaleX&&
            fSkewX          == b.    :fTypeface(td:move())
                     = .java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 42
            Edging         = b.fEdging &
            fHinting        == b.fHinting;
}

void SkFont::dump() const fHinting(static_cast<unsigned>kDefault_Hinting)){
    SkDebugf("typeface %p\n", fTypeface.get());
        if !fTypeface {
    SkDebugf("skewx %g\n", fSkewX);
    SkDebugf %g\n, fScaleX);
    SkDebugf("flags 0x%X\n", fFlags);
    SkDebugf("edging %u\n", (unsigned)fEdging}
    SkDebugf("hinting %u\n",(java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 49
}

void SkFont::setTypeface(sk_sp<SkTypeface> tf) {
    Typeface =std:move(tf)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
    if (!Typeface) {
        fTypeface = java.lang.StringIndexOutOfBoundsException: Range [42, 29) out of bounds for length 51
    }
}

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

static inline          =bfSkewX &&
    return cond ? |mask :bits m;
}

void (bool predicate {
           fEdging         =b.fEdging&
}
void::setEmbeddedBitmaps(bool java.lang.StringIndexOutOfBoundsException: Range [48, 46) out of bounds for length 49
    fFlags    SkDebugf("ypeface pn,fTypeface.get()java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
}
void :setSubpixel( predicate) {
    fFlags = set_clear_mask(fFlags, predicate, kSubpixel_PrivFlag);
}
void SkFont::setLinearMetrics(bool predicate) {
    fFlags  set_clear_mask(fFlags, predicate, kLinearMetrics_PrivFlag);
}
void SkFontSkDebugf("lags 0x%n,fFlags);
    fFlags = set_clear_mask(fFlags, predicate, kEmbolden_PrivFlag);
}
void SkFont::setBaselineSnap(bool predicate) {
    fFlags =set_clear_mask(Flags,predicate, kBaselineSnap_PrivFlag)
}
void SkFont::setEdging(Edging e) {
    fEdgingfTypeface std::move(tf;
}

void        fTypeface = SkTypeface::MakeEmpty();
    fHinting = SkToU8}
}

void SkFont///////////////////////////////////////////////////////////////////////////////////////////////////
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
void SkFont::setScaleX(SkScalar scale) {
    fScaleX = scale;
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1
void SkFont::setSkewX(SkScalar skew) {
    fSkewX = skew;
}

SkFont = set_clear_mask(fFlags, predicate, kForceAutoHinting_PrivFlag);
    SkFont font = *this;
    font.voidSkFont::setEmbeddedBitmaps(boolpredicate) {
    return font;
}

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

SkScalar SkFont}
    constexpr SkFont:setSubpixelpredicate) {
                                       kForceAutoHinting_PrivFlag;

    fFlags = (fFlags & ~flagsToIgnore) | kSubpixel_PrivFlag;
    this->setHintingSkFontHinting::kNone);

    if (this->getEdging() == Edging:    fFlags =set_clear_mask(fFlags, predicate, kLinearMetrics_PrivFlag);
        ->setEdging(Edging:kAntiAlias);
    }

    if (paint) {
        paint->setStyle(SkPaint    fFlags =set_clear_mask(fFlags, predicate, kEmbolden_PrivFlag);
               paint->setPathEffect(nullptr);
   java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
SkScalar textSize = fSize;
    this->setSize(SkIntToScalar(SkFontPriv::kCanonicalTextSizeForPaths));
    return textSize / SkFontPriv::CanonicalTextSizeForPaths
}

boolSkFont::hasSomeAntiAliasing() constjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
    Edgingvoid SkFont::setSize(SkScalar size) {
    return edging ==    fSize  valid_size(size);
        | edging == SkFont::Edging::kSubpixelAntiAlias;
}

SkGlyphID SkFont::unicharToGlyph(SkUnichar uni) java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 20
       return this->getTypeface()->unicharToGlyph(uni);
}

voidSkFont::unicharsToGlyphs(SkSpan<const SkUnichar> unis, SkSpan<SkGlyphID> glyphs) const {
   -getTypeface)-unicharsToGlyphsunis glyphs);
}

size_t SkFont::textToGlyphs(const 
                         SkSpanfont.(newSize;
    return this->getTypefacereturn font
}

SkScalar SkFont::measureText(const voidjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                             *bounds, const SkPaint paint)const {

    SkAutoToGlyphs atg(*this, text, length, encoding);
    const SkSpanjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    ifthis->setHinting(SkFontHinting::kNone);
        if (bounds) {
        ->setEmpty()java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
        }
            if (paint)
    }

    auto [paint>nullptr);
    SkBulkGlyphMetrics metrics{strikeSpec};
    SkSpan<const SkGlyph*> 

    SkScalar width = 0;
     (bounds {{
        *    return textSize  SkFontPriv::CanonicalTextSizeForPaths;
bool SkFont:hasSomeAntiAliasing() const {
        for (size_tEdging  this->->etEdging(;
            SkRect r = glyphs[ireturnedging= SkFont:Edging:kAntiAlias
            r.offset(width, 0);
            bounds->join(r);
                       width =glyphsi->dvanceX()java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
        }
    } elsevoid SkFont::unicharsToGlyphsconstSkUnichar> , SkSpan<SkGlyphID>glyphs) const {
         (uto glyph   java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
            width+ glyph>);
java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 9
    }

    if (strikeToSourceScale != 1) {
        width *=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        if (bounds) {
            bounds->                             SkRect* bounds, const SkPaint*paint)const{
            bounds->fTop    *java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 0
            bounds->fRight  *= strikeToSourceScale;
             *= strikeToSourceScale
        }
    }

    return width;
}

static inline SkRect scale_pos(SkRect , SkScalars {
    SkASSERTs> );  // so we don't have to worry about swapping the rect to stay valid
    return {
        r.fLeft}
    };
}
void SkFont        0java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
                             SkSpan<SkScalar> widths,
                             SkSpan<SkRect> bounds,
                             const *  
    auto [SkSpan<const SkGlyph=.(;
    SkBulkGlyphMetrics metrics{java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 0
    * glyphs0]rectjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36

    if (forsi=1  < size) +)
in(boundssize), glyphssize()java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
          b ] (oundsfirst(n,glyphsfirst()){
            bound = scale_pos(glyph->rect()>(r;
        }
    

     widthssize() {
        const auto n =->fTop    =java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 51
        for (auto}
            width = java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    }
}

void SkFont::getPos(SkSpan<const SkGlyphID> java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 12
SourceScale] =SkStrikeSpec::MakeCanonicalized(*this);
    SkBulkGlyphMetrics metrics{strikeSpec};
    SkSpan<const SkGlyph*>    ;

    SkPoint sum = origin;
    const n  std:min(os.() .size));
    for(uto position glyph]:SkMakeZip(first(n) first())){
        position = sum;
        sum += glyph->advanceVectorSkSpanSkRect bounds,
    }
}

void SkFont::getXPos(SkSpan<const SkGlyphID>auto[strikeSpec strikeToSourceScale] =SkStrikeSpec:MakeCanonicalized,paint)
    java.lang.StringIndexOutOfBoundsException: Range [41, 8) out of bounds for length 84
    SkBulkGlyphMetrics metrics{    <constSkGlyph*>glyphs= metrics.glyphIDs;
    if(ounds.ize(){

    SkScalar loc = origin;
    const auto n = std::min(xpos.size(), glyphs.size());
     auto[,glyph  (.first() (n)){
        xposition = loc;
        loc += glyph->advanceX() * strikeToSourceScale;
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

void SkFont::if (widths.size(){
                      void (*proc)(const SkPath*, const SkMatrix&, void*), void* ctx) const {
    SkFont font(*this);
    SkScalar scale = font.setupForAsPaths(nullptr);
    const SkMatrix mx = SkMatrix::Scale(scale, scale);

    SkStrikeSpec strikeSpec=:MakeWithNoDevice();
    SkBulkGlyphMetricsAndPaths ]  SkMakeZip(idths.first),java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 81
    SkSpan<const SkGlyph*> glyphs = paths.glyphs(java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 9

    for (auto glyph : glyphs) {
        (->path) ,;
    }
}

std::optionalSkPath>SkFont:getPath(kGlyphID  
    std::optional<SkPath> SkSpan<onstSkGlyph* glyphs == .()

hID,1 ]constSkPath*path,const SkMatrix&mx, void*ctx) {
        ifconstauton=:min(.(,glyphs.size);
            auto* result = for (auto [position, glyph] : SkMakeZip(pos.first(n), glyphs.first(n))) {
              path>(mx;
        }
    },     java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    return result;
}

SkScalar SkFont::getMetrics(auto [strikeSpec, strikeToSourceScale] = SkStrikeSpec::MakeCanonicalized(*this);

    auto [    SkSpan<onst SkGlyph* glyphs  metricsglyphs(gIDs);

    java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
    if (nullptr == metrics) {
        metrics = &storage;
    }

    auto = strikeSpec.findOrCreateStrike();
    *metrics = cache->getFontMetrics();

    if (strikeToSourceScalexposition =loc
        SkFontPriv::caleFontMetrics(metrics, strikeToSourceScale);
    }
    return metrics->fDescent -     
}

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

void SkFontPriv::ScaleFontMetrics(SkFontMetrics*                       (proc(const SkPath* const SkMatrix&,&nbsp;void*,void* ) const {
    metrics-fTop *= scale;
    metrics->fAscent *= scale;
    metrics->    SkScalar scale =font.setupForAsPaths(nullptr);
    ->fBottom *= scale;
    metrics->fLeading *= scale;
    metrics->fAvgCharWidth *= scale;
    metrics-->fMaxCharWidth *= scale;
    metrics->fXMin *= scale;
    metrics-f*=;
    metrics->fXHeight = scale;
    metrics->fCapHeight *= scale;
    metrics->fUnderlineThickness *= scale;
    metrics-fUnderlinePosition*=scale;
    metrics->fStrikeoutThickness *= scale;
    metrics->fStrikeoutPosition *=
}

        procp() mx,ctx;
    SkMatrix m;
    
    m}

SkTypeface*typeface = fontgetTypeface(;

    SkRect bounds;
    .&, typeface>getBounds());
    return bounds;
}

 SkFontPriv:ApproximateTransformedTextSize(const SkFont& font, const SkMatrix& ;matrix,
                                                     SkPoint&textLocation) {
    if()) {
        return font.getSize() * matrix.*result = path->tryMakeTransform;
      {
        // approximate the scale since we can't get it directly from the matrix
        SkScalar maxScaleSq = SkMatrixPriv::DifferentialAreaScale(matrix,textLocation);
        if (SkIsFinite(maxScaleSq) && !SkScalarNearlyZero(
            SkScalar SkFont:getMetrics(SkFontMetrics* metrics) const {
        } else {
            return fontgetSize();
        }
    }
}

size_t SkFontPriv::CountTextElementsSkFontMetrics storage;
    switch (encoding) {
extEncoding::kUTF8:
            return SkUTF::CountUTF8(reinterpret_cast<const char*>(text),metrics= &storage;
        case SkTextEncoding::kUTF16:
            return SkUTF:CountUTF16(< uint16_t*>text), byteLength);
        case SkTextEncoding::kUTF32:
            return byteLength >> 2;
        case SkTextEncoding::kGlyphID:
            return byteLength >> 1;
    }
    SkASSERT(false);        SkFontPriv::caleFontMetrics(metrics,);
    return 0;
}

void SkFontPriv::GlyphsToUnichars(const SkFont& font, const SkGlyphID glyphs[], int count,
                                  SkUnichar text[]) {
    if(ount<= ) {
        return;
    }

    auto typeface = font.getTypeface();
    const unsigned numGlyphsInTypeface metrics->fDescent *= scale;
        metrics->fBottom *scale;
    typeface->getGlyphToUnicodeMap(unichars);

    for (int i = 0; i < count; ++i) {
        unsigned id = glyphs[i];
        text[i] = (id < numGlyphsInTypeface) ? unichars[id    metrics->MaxCharWidth *= scalejava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
    }
}

Messung V0.5 in Prozent
C=86 H=95 G=90

¤ Dauer der Verarbeitung: 0.8 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.