1 /*
2 * Copyright 2021 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7 // This file is a part of a POC for more automated generation of binding code.
8 // It can be edited manually (for now).
9
10 #include "modules/skparagraph/include/DartTypes.h"
11 #include "modules/skparagraph/include/Paragraph.h"
12
13 #include <emscripten/bind.h>
14
15 using namespace emscripten;
16
17 namespace para = skia::textlayout;
18
EMSCRIPTEN_BINDINGS(ParagraphGen)19 EMSCRIPTEN_BINDINGS(ParagraphGen) {
20 enum_<para::Affinity>("Affinity")
21 .value("Upstream", para::Affinity::kUpstream)
22 .value("Downstream", para::Affinity::kDownstream);
23
24 enum_<para::TextDecorationStyle>("DecorationStyle")
25 .value("Solid", para::TextDecorationStyle::kSolid)
26 .value("Double", para::TextDecorationStyle::kDouble)
27 .value("Dotted", para::TextDecorationStyle::kDotted)
28 .value("Dashed", para::TextDecorationStyle::kDashed)
29 .value("Wavy", para::TextDecorationStyle::kWavy);
30
31 enum_<SkFontStyle::Slant>("FontSlant")
32 .value("Upright", SkFontStyle::Slant::kUpright_Slant)
33 .value("Italic", SkFontStyle::Slant::kItalic_Slant)
34 .value("Oblique", SkFontStyle::Slant::kOblique_Slant);
35
36 enum_<SkFontStyle::Weight>("FontWeight")
37 .value("Invisible", SkFontStyle::Weight::kInvisible_Weight)
38 .value("Thin", SkFontStyle::Weight::kThin_Weight)
39 .value("ExtraLight", SkFontStyle::Weight::kExtraLight_Weight)
40 .value("Light", SkFontStyle::Weight::kLight_Weight)
41 .value("Normal", SkFontStyle::Weight::kNormal_Weight)
42 .value("Medium", SkFontStyle::Weight::kMedium_Weight)
43 .value("SemiBold", SkFontStyle::Weight::kSemiBold_Weight)
44 .value("Bold", SkFontStyle::Weight::kBold_Weight)
45 .value("ExtraBold", SkFontStyle::Weight::kExtraBold_Weight)
46 .value("Black", SkFontStyle::Weight::kBlack_Weight)
47 .value("ExtraBlack", SkFontStyle::Weight::kExtraBlack_Weight);
48
49 enum_<SkFontStyle::Width>("FontWidth")
50 .value("UltraCondensed", SkFontStyle::Width::kUltraCondensed_Width)
51 .value("ExtraCondensed", SkFontStyle::Width::kExtraCondensed_Width)
52 .value("Condensed", SkFontStyle::Width::kCondensed_Width)
53 .value("SemiCondensed", SkFontStyle::Width::kSemiCondensed_Width)
54 .value("Normal", SkFontStyle::Width::kNormal_Width)
55 .value("SemiExpanded", SkFontStyle::Width::kSemiExpanded_Width)
56 .value("Expanded", SkFontStyle::Width::kExpanded_Width)
57 .value("ExtraExpanded", SkFontStyle::Width::kExtraExpanded_Width)
58 .value("UltraExpanded", SkFontStyle::Width::kUltraExpanded_Width);
59
60 enum_<para::PlaceholderAlignment>("PlaceholderAlignment")
61 .value("Baseline", para::PlaceholderAlignment::kBaseline)
62 .value("AboveBaseline", para::PlaceholderAlignment::kAboveBaseline)
63 .value("BelowBaseline", para::PlaceholderAlignment::kBelowBaseline)
64 .value("Top", para::PlaceholderAlignment::kTop)
65 .value("Bottom", para::PlaceholderAlignment::kBottom)
66 .value("Middle", para::PlaceholderAlignment::kMiddle);
67
68 enum_<para::RectHeightStyle>("RectHeightStyle")
69 .value("Tight", para::RectHeightStyle::kTight)
70 .value("Max", para::RectHeightStyle::kMax)
71 .value("IncludeLineSpacingMiddle", para::RectHeightStyle::kIncludeLineSpacingMiddle)
72 .value("IncludeLineSpacingTop", para::RectHeightStyle::kIncludeLineSpacingTop)
73 .value("IncludeLineSpacingBottom", para::RectHeightStyle::kIncludeLineSpacingBottom)
74 .value("Strut", para::RectHeightStyle::kStrut);
75
76 enum_<para::RectWidthStyle>("RectWidthStyle")
77 .value("Tight", para::RectWidthStyle::kTight)
78 .value("Max", para::RectWidthStyle::kMax);
79
80 enum_<para::TextAlign>("TextAlign")
81 .value("Left", para::TextAlign::kLeft)
82 .value("Right", para::TextAlign::kRight)
83 .value("Center", para::TextAlign::kCenter)
84 .value("Justify", para::TextAlign::kJustify)
85 .value("Start", para::TextAlign::kStart)
86 .value("End", para::TextAlign::kEnd);
87
88 enum_<para::TextBaseline>("TextBaseline")
89 .value("Alphabetic", para::TextBaseline::kAlphabetic)
90 .value("Ideographic", para::TextBaseline::kIdeographic);
91
92 enum_<para::TextDirection>("TextDirection")
93 .value("LTR", para::TextDirection::kLtr)
94 .value("RTL", para::TextDirection::kRtl);
95
96 enum_<para::TextHeightBehavior>("TextHeightBehavior")
97 .value("All", para::TextHeightBehavior::kAll)
98 .value("DisableFirstAscent", para::TextHeightBehavior::kDisableFirstAscent)
99 .value("DisableLastDescent", para::TextHeightBehavior::kDisableLastDescent)
100 .value("DisableAll", para::TextHeightBehavior::kDisableAll);
101 }
102