• 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 "modules/skshaper/src/SkUnicode.h"
6 #include "src/core/SkStringUtils.h"
7 #include "src/utils/SkUTF.h"
8 
9 namespace skia {
10 namespace textlayout {
11 
StrutStyle()12 StrutStyle::StrutStyle() {
13     fFontStyle = SkFontStyle::Normal();
14     fFontSize = 14;
15     fHeight = 1;
16     fLeading = -1;
17     fForceHeight = false;
18     fHeightOverride = false;
19     fHalfLeading = false;
20     fEnabled = false;
21 }
22 
ParagraphStyle()23 ParagraphStyle::ParagraphStyle() {
24     fTextAlign = TextAlign::kStart;
25     fTextDirection = TextDirection::kLtr;
26     fLinesLimit = std::numeric_limits<size_t>::max();
27     fHeight = 1;
28     fTextHeightBehavior = TextHeightBehavior::kAll;
29     fHintingIsOn = true;
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