xref: /third_party/skia/experimental/sktext/src/Line.cpp (revision cb93a386)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/skia/experimental/sktext/src/
1// Copyright 2021 Google LLC.
2#include "experimental/sktext/include/Text.h"
3#include "experimental/sktext/src/Line.h"
4
5namespace skia {
6namespace text {
7LogicalLine::LogicalLine(const Stretch& stretch, const Stretch& spaces, SkScalar verticalOffset, bool hardLineBreak)
8    : fTextStart(stretch.glyphStart())
9    , fTextEnd(stretch.glyphEnd())
10    , fWhitespacesEnd (spaces.glyphEnd())
11    , fText(stretch.textRange())
12    , fWhitespaces(spaces.textRange())
13    , fTextWidth(stretch.width())
14    , fSpacesWidth(spaces.width())
15    , fHorizontalOffset(0.0f)
16    , fVerticalOffset(verticalOffset)
17    , fHardLineBreak(hardLineBreak) {
18    SkASSERT(stretch.isEmpty() ||
19                    spaces.isEmpty() ||
20        (stretch.glyphEnd() == spaces.glyphStart()));
21
22    if (!stretch.isEmpty()) {
23        this->fTextMetrics.merge(stretch.textMetrics());
24    }
25    if (!spaces.isEmpty()) {
26        this->fTextMetrics.merge(spaces.textMetrics());
27    }
28}
29} // namespace text
30} // namespace skia
31

Indexes created Thu Nov 07 10:32:03 CST 2024