Flutter Engine
The Flutter Engine
Public Member Functions | Friends | List of all members
skia::textlayout::InternalLineMetrics Class Reference

#include <Run.h>

Public Member Functions

 InternalLineMetrics ()
 
 InternalLineMetrics (bool forceStrut)
 
 InternalLineMetrics (SkScalar a, SkScalar d, SkScalar l)
 
 InternalLineMetrics (SkScalar a, SkScalar d, SkScalar l, SkScalar ra, SkScalar rd, SkScalar rl)
 
 InternalLineMetrics (const SkFont &font, bool forceStrut)
 
void add (Run *run)
 
void add (InternalLineMetrics other)
 
void clean ()
 
bool isClean ()
 
SkScalar delta () const
 
void updateLineMetrics (InternalLineMetrics &metrics)
 
SkScalar runTop (const Run *run, LineMetricStyle ascentStyle) const
 
SkScalar height () const
 
void update (SkScalar a, SkScalar d, SkScalar l)
 
void updateRawData (SkScalar ra, SkScalar rd)
 
SkScalar alphabeticBaseline () const
 
SkScalar ideographicBaseline () const
 
SkScalar deltaBaselines () const
 
SkScalar baseline () const
 
SkScalar ascent () const
 
SkScalar descent () const
 
SkScalar leading () const
 
SkScalar rawAscent () const
 
SkScalar rawDescent () const
 
void setForceStrut (bool value)
 
bool getForceStrut () const
 

Friends

class ParagraphImpl
 
class TextWrapper
 
class TextLine
 

Detailed Description

Definition at line 367 of file Run.h.

Constructor & Destructor Documentation

◆ InternalLineMetrics() [1/5]

skia::textlayout::InternalLineMetrics::InternalLineMetrics ( )
inline

Definition at line 370 of file Run.h.

370 {
371 clean();
372 fForceStrut = false;
373 }

◆ InternalLineMetrics() [2/5]

skia::textlayout::InternalLineMetrics::InternalLineMetrics ( bool  forceStrut)
inline

Definition at line 375 of file Run.h.

375 {
376 clean();
377 fForceStrut = forceStrut;
378 }

◆ InternalLineMetrics() [3/5]

skia::textlayout::InternalLineMetrics::InternalLineMetrics ( SkScalar  a,
SkScalar  d,
SkScalar  l 
)
inline

Definition at line 380 of file Run.h.

380 {
381 fAscent = a;
382 fDescent = d;
383 fLeading = l;
384 fRawAscent = a;
385 fRawDescent = d;
386 fRawLeading = l;
387 fForceStrut = false;
388 }
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19
struct MyStruct a[10]

◆ InternalLineMetrics() [4/5]

skia::textlayout::InternalLineMetrics::InternalLineMetrics ( SkScalar  a,
SkScalar  d,
SkScalar  l,
SkScalar  ra,
SkScalar  rd,
SkScalar  rl 
)
inline

Definition at line 390 of file Run.h.

390 {
391 fAscent = a;
392 fDescent = d;
393 fLeading = l;
394 fRawAscent = ra;
395 fRawDescent = rd;
396 fRawLeading = rl;
397 fForceStrut = false;
398 }

◆ InternalLineMetrics() [5/5]

skia::textlayout::InternalLineMetrics::InternalLineMetrics ( const SkFont font,
bool  forceStrut 
)
inline

Definition at line 400 of file Run.h.

400 {
401 SkFontMetrics metrics;
402 font.getMetrics(&metrics);
403 fAscent = metrics.fAscent;
404 fDescent = metrics.fDescent;
405 fLeading = metrics.fLeading;
406 fRawAscent = metrics.fAscent;
407 fRawDescent = metrics.fDescent;
408 fRawLeading = metrics.fLeading;
409 fForceStrut = forceStrut;
410 }
font
Font Metadata and Metrics.
SkScalar fLeading
distance to add between lines, typically positive or zero
Definition: SkFontMetrics.h:57
SkScalar fAscent
distance to reserve above baseline, typically negative
Definition: SkFontMetrics.h:54
SkScalar fDescent
distance to reserve below baseline, typically positive
Definition: SkFontMetrics.h:55

Member Function Documentation

◆ add() [1/2]

void skia::textlayout::InternalLineMetrics::add ( InternalLineMetrics  other)
inline

Definition at line 425 of file Run.h.

425 {
426 fAscent = std::min(fAscent, other.fAscent);
427 fDescent = std::max(fDescent, other.fDescent);
428 fLeading = std::max(fLeading, other.fLeading);
429 fRawAscent = std::min(fRawAscent, other.fRawAscent);
430 fRawDescent = std::max(fRawDescent, other.fRawDescent);
431 fRawLeading = std::max(fRawLeading, other.fRawLeading);
432 }
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48

◆ add() [2/2]

void skia::textlayout::InternalLineMetrics::add ( Run run)
inline

Definition at line 412 of file Run.h.

412 {
413 if (fForceStrut) {
414 return;
415 }
416 fAscent = std::min(fAscent, run->correctAscent());
417 fDescent = std::max(fDescent, run->correctDescent());
418 fLeading = std::max(fLeading, run->correctLeading());
419
420 fRawAscent = std::min(fRawAscent, run->ascent());
421 fRawDescent = std::max(fRawDescent, run->descent());
422 fRawLeading = std::max(fRawLeading, run->leading());
423 }
Definition: run.py:1

◆ alphabeticBaseline()

SkScalar skia::textlayout::InternalLineMetrics::alphabeticBaseline ( ) const
inline

Definition at line 491 of file Run.h.

491{ return fLeading / 2 - fAscent; }

◆ ascent()

SkScalar skia::textlayout::InternalLineMetrics::ascent ( ) const
inline

Definition at line 495 of file Run.h.

495{ return fAscent; }

◆ baseline()

SkScalar skia::textlayout::InternalLineMetrics::baseline ( ) const
inline

Definition at line 494 of file Run.h.

494{ return fLeading / 2 - fAscent; }

◆ clean()

void skia::textlayout::InternalLineMetrics::clean ( )
inline

Definition at line 434 of file Run.h.

434 {
435 fAscent = SK_ScalarMax;
436 fDescent = SK_ScalarMin;
437 fLeading = 0;
438 fRawAscent = SK_ScalarMax;
439 fRawDescent = SK_ScalarMin;
440 fRawLeading = 0;
441 }
#define SK_ScalarMin
Definition: SkScalar.h:25
#define SK_ScalarMax
Definition: SkScalar.h:24

◆ delta()

SkScalar skia::textlayout::InternalLineMetrics::delta ( ) const
inline

Definition at line 452 of file Run.h.

452{ return height() - ideographicBaseline(); }
SkScalar ideographicBaseline() const
Definition: Run.h:492

◆ deltaBaselines()

SkScalar skia::textlayout::InternalLineMetrics::deltaBaselines ( ) const
inline

Definition at line 493 of file Run.h.

493{ return fLeading / 2 + fDescent; }

◆ descent()

SkScalar skia::textlayout::InternalLineMetrics::descent ( ) const
inline

Definition at line 496 of file Run.h.

496{ return fDescent; }

◆ getForceStrut()

bool skia::textlayout::InternalLineMetrics::getForceStrut ( ) const
inline

Definition at line 501 of file Run.h.

501{ return fForceStrut; }

◆ height()

SkScalar skia::textlayout::InternalLineMetrics::height ( ) const
inline

Definition at line 476 of file Run.h.

476 {
477 return ::round((double)fDescent - fAscent + fLeading);
478 }
static void round(SkPoint *p)

◆ ideographicBaseline()

SkScalar skia::textlayout::InternalLineMetrics::ideographicBaseline ( ) const
inline

Definition at line 492 of file Run.h.

492{ return fDescent - fAscent + fLeading; }

◆ isClean()

bool skia::textlayout::InternalLineMetrics::isClean ( )
inline

Definition at line 443 of file Run.h.

443 {
444 return (fAscent == SK_ScalarMax &&
445 fDescent == SK_ScalarMin &&
446 fLeading == 0 &&
447 fRawAscent == SK_ScalarMax &&
448 fRawDescent == SK_ScalarMin &&
449 fRawLeading == 0);
450 }

◆ leading()

SkScalar skia::textlayout::InternalLineMetrics::leading ( ) const
inline

Definition at line 497 of file Run.h.

497{ return fLeading; }

◆ rawAscent()

SkScalar skia::textlayout::InternalLineMetrics::rawAscent ( ) const
inline

Definition at line 498 of file Run.h.

498{ return fRawAscent; }

◆ rawDescent()

SkScalar skia::textlayout::InternalLineMetrics::rawDescent ( ) const
inline

Definition at line 499 of file Run.h.

499{ return fRawDescent; }

◆ runTop()

SkScalar skia::textlayout::InternalLineMetrics::runTop ( const Run run,
LineMetricStyle  ascentStyle 
) const
inline

Definition at line 471 of file Run.h.

471 {
472 return fLeading / 2 - fAscent +
473 (ascentStyle == LineMetricStyle::Typographic ? run->ascent() : run->correctAscent()) + delta();
474 }

◆ setForceStrut()

void skia::textlayout::InternalLineMetrics::setForceStrut ( bool  value)
inline

Definition at line 500 of file Run.h.

500{ fForceStrut = value; }
uint8_t value

◆ update()

void skia::textlayout::InternalLineMetrics::update ( SkScalar  a,
SkScalar  d,
SkScalar  l 
)
inline

Definition at line 480 of file Run.h.

480 {
481 fAscent = a;
482 fDescent = d;
483 fLeading = l;
484 }

◆ updateLineMetrics()

void skia::textlayout::InternalLineMetrics::updateLineMetrics ( InternalLineMetrics metrics)
inline

Definition at line 454 of file Run.h.

454 {
455 if (metrics.fForceStrut) {
456 metrics.fAscent = fAscent;
457 metrics.fDescent = fDescent;
458 metrics.fLeading = fLeading;
459 metrics.fRawAscent = fRawAscent;
460 metrics.fRawDescent = fRawDescent;
461 metrics.fRawLeading = fRawLeading;
462 } else {
463 // This is another of those flutter changes. To be removed...
464 metrics.fAscent = std::min(metrics.fAscent, fAscent - fLeading / 2.0f);
465 metrics.fDescent = std::max(metrics.fDescent, fDescent + fLeading / 2.0f);
466 metrics.fRawAscent = std::min(metrics.fRawAscent, fRawAscent - fRawLeading / 2.0f);
467 metrics.fRawDescent = std::max(metrics.fRawDescent, fRawDescent + fRawLeading / 2.0f);
468 }
469 }

◆ updateRawData()

void skia::textlayout::InternalLineMetrics::updateRawData ( SkScalar  ra,
SkScalar  rd 
)
inline

Definition at line 486 of file Run.h.

486 {
487 fRawAscent = ra;
488 fRawDescent = rd;
489 }

Friends And Related Function Documentation

◆ ParagraphImpl

friend class ParagraphImpl
friend

Definition at line 505 of file Run.h.

◆ TextLine

friend class TextLine
friend

Definition at line 507 of file Run.h.

◆ TextWrapper

friend class TextWrapper
friend

Definition at line 506 of file Run.h.


The documentation for this class was generated from the following file: