• 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/utils/SkUTF.h"
6 #include "src/core/SkStringUtils.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     fReplaceTabCharacters = false;
30 }
31 
effective_align() const32 TextAlign ParagraphStyle::effective_align() const {
33     if (fTextAlign == TextAlign::kStart) {
34         return (fTextDirection == TextDirection::kLtr) ? TextAlign::kLeft : TextAlign::kRight;
35     } else if (fTextAlign == TextAlign::kEnd) {
36         return (fTextDirection == TextDirection::kLtr) ? TextAlign::kRight : TextAlign::kLeft;
37     } else {
38         return fTextAlign;
39     }
40 }
41 }  // namespace textlayout
42 }  // namespace skia
43