• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * Provides an interface for writing texts.
18 * @since 7
19 */
20interface TextInterface {
21  /**
22   * Called when writing text.
23   * @since 7
24   */
25  (content?: string | Resource): TextAttribute;
26}
27
28/**
29 * @since 7
30 */
31declare class TextAttribute extends CommonMethod<TextAttribute> {
32  /**
33   * Called when the font color is set.
34   * @since 7
35   */
36  fontColor(value: ResourceColor): TextAttribute;
37
38  /**
39   * Called when the font size is set.
40   * @since 7
41   */
42  fontSize(value: number | string | Resource): TextAttribute;
43
44  /**
45   * Called when the minimum font size of the font is set.
46   * @since 7
47   */
48  minFontSize(value: number | string | Resource): TextAttribute;
49
50  /**
51   * Called when the maximum font size of the font is set.
52   * @since 7
53   */
54  maxFontSize(value: number | string | Resource): TextAttribute;
55
56  /**
57   * Called when the font style of a font is set.
58   * @since 7
59   */
60  fontStyle(value: FontStyle): TextAttribute;
61
62  /**
63   * Called when the font weight is set.
64   * @since 7
65   */
66  fontWeight(value: number | FontWeight | string): TextAttribute;
67
68  /**
69   * Called when the horizontal center mode of the font is set.
70   * @since 7
71   */
72  textAlign(value: TextAlign): TextAttribute;
73
74  /**
75   * Called when the vertical center mode of the font is set.
76   * @since 7
77   */
78  lineHeight(value: number | string | Resource): TextAttribute;
79
80  /**
81   * Called when the overflow mode of the font is set.
82   * @since 7
83   */
84  textOverflow(value: { overflow: TextOverflow }): TextAttribute;
85
86  /**
87   * Called when the font list of text is set.
88   * @since 7
89   */
90  fontFamily(value: string | Resource): TextAttribute;
91
92  /**
93   * Called when the maximum number of lines of text is set.
94   * @since 7
95   */
96  maxLines(value: number): TextAttribute;
97
98  /**
99   * Called when the text decoration of the text is set.
100   * @since 7
101   */
102  decoration(value: { type: TextDecorationType; color?: ResourceColor }): TextAttribute;
103
104  /**
105   * Called when the distance between text fonts is set.
106   * @since 7
107   */
108  letterSpacing(value: number | string): TextAttribute;
109
110  /**
111   * Called when the type of letter in the text font is set.
112   * @since 7
113   */
114  textCase(value: TextCase): TextAttribute;
115
116  /**
117   * Called when the baseline offset is set.
118   * @since 7
119   */
120  baselineOffset(value: number | string): TextAttribute;
121}
122
123declare const TextInstance: TextAttribute;
124declare const Text: TextInterface;
125