Debian Codegraph @

modules/skparagraph/src/ParagraphStyle.cpp

raw
1 // Copyright 2019 Google LLC.
2
3 #include "modules/skparagraph/include/DartTypes.h"
4 #include "modules/skparagraph/include/ParagraphStyle.h"
5 #include "src/base/SkUTF.h"
6 #include "src/core/SkStringUtils.h"
7
8 namespace skia {
9 namespace textlayout {
10
11 StrutStyle::StrutStyle() {
12 fFontStyle = SkFontStyle::Normal();
13 fFontSize = 14;
14 fHeight = 1;
15 fLeading = -1;
16 fForceHeight = false;
17 fHeightOverride = false;
18 fHalfLeading = false;
19 fEnabled = false;
20 }
21
22 ParagraphStyle::ParagraphStyle() {
23 fTextAlign = TextAlign::kStart;
24 fTextDirection = TextDirection::kLtr;
25 fLinesLimit = std::numeric_limits<size_t>::max();
26 fHeight = 1;
27 fTextHeightBehavior = TextHeightBehavior::kAll;
28 fHintingIsOn = true;
29 fReplaceTabCharacters = false;
30 fFakeMissingFontStyles = true;
31 }
32
33 TextAlign ParagraphStyle::effective_align() const {
34 if (fTextAlign == TextAlign::kStart) {
35 return (fTextDirection == TextDirection::kLtr) ? TextAlign::kLeft : TextAlign::kRight;
36 } else if (fTextAlign == TextAlign::kEnd) {
37 return (fTextDirection == TextDirection::kLtr) ? TextAlign::kRight : TextAlign::kLeft;
38 } else {
39 return fTextAlign;
40 }
41 }
42 } // namespace textlayout
43 } // namespace skia