• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 Google LLC.
2 
3 #include "modules/skparagraph/include/DartTypes.h"
4 #include "modules/skparagraph/include/ParagraphStyle.h"
5 #include "src/core/SkStringUtils.h"
6 #include "src/utils/SkUTF.h"
7 
8 namespace skia {
9 namespace textlayout {
10 
StrutStyle()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 
ParagraphStyle()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 }
30 
effective_align() const31 TextAlign ParagraphStyle::effective_align() const {
32     if (fTextAlign == TextAlign::kStart) {
33         return (fTextDirection == TextDirection::kLtr) ? TextAlign::kLeft : TextAlign::kRight;
34     } else if (fTextAlign == TextAlign::kEnd) {
35         return (fTextDirection == TextDirection::kLtr) ? TextAlign::kRight : TextAlign::kLeft;
36     } else {
37         return fTextAlign;
38     }
39 }
40 }  // namespace textlayout
41 }  // namespace skia
42