Flutter Engine
minikin::LineWidths Class Reference

#include <LineBreaker.h>

Public Member Functions

void setWidths (float firstWidth, int firstWidthLineCount, float restWidth)
 
void setIndents (const std::vector< float > &indents)
 
bool isConstant () const
 
float getLineWidth (int line) const
 
void clear ()
 

Detailed Description

Definition at line 55 of file LineBreaker.h.

Member Function Documentation

◆ clear()

void minikin::LineWidths::clear ( )
inline

Definition at line 79 of file LineBreaker.h.

79 { mIndents.clear(); }

◆ getLineWidth()

float minikin::LineWidths::getLineWidth ( int  line) const
inline

Definition at line 68 of file LineBreaker.h.

References width.

68  {
69  float width = (line < mFirstWidthLineCount) ? mFirstWidth : mRestWidth;
70  if (!mIndents.empty()) {
71  if ((size_t)line < mIndents.size()) {
72  width -= mIndents[line];
73  } else {
74  width -= mIndents.back();
75  }
76  }
77  return width;
78  }
int32_t width

◆ isConstant()

bool minikin::LineWidths::isConstant ( ) const
inline

Definition at line 63 of file LineBreaker.h.

63  {
64  // technically mFirstWidthLineCount == 0 would count too, but doesn't
65  // actually happen
66  return mRestWidth == mFirstWidth && mIndents.empty();
67  }

◆ setIndents()

void minikin::LineWidths::setIndents ( const std::vector< float > &  indents)
inline

Definition at line 62 of file LineBreaker.h.

Referenced by minikin::LineBreaker::charWidths().

62 { mIndents = indents; }

◆ setWidths()

void minikin::LineWidths::setWidths ( float  firstWidth,
int  firstWidthLineCount,
float  restWidth 
)
inline

Definition at line 57 of file LineBreaker.h.

57  {
58  mFirstWidth = firstWidth;
59  mFirstWidthLineCount = firstWidthLineCount;
60  mRestWidth = restWidth;
61  }

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