1bd236e69554eb1e7828988e07ca09db3b003267
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextLabel.cs
1 /*
2  * Copyright(c) 2023 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 extern alias TizenSystemSettings;
19 using TizenSystemSettings.Tizen.System;
20
21 using System;
22 using System.Globalization;
23 using System.ComponentModel;
24 using Tizen.NUI.Text;
25 using Tizen.NUI.Binding;
26
27 namespace Tizen.NUI.BaseComponents
28 {
29     /// <summary>
30     /// A control which renders a short text string.<br />
31     /// Text labels are lightweight, non-editable, and do not respond to the user input.<br />
32     /// </summary>
33     /// <since_tizen> 3 </since_tizen>
34     public partial class TextLabel : View
35     {
36         private class TextLayout : LayoutItem
37         {
38             protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
39             {
40                 // Padding will be automatically applied by DALi TextLabel.
41                 float totalWidth = widthMeasureSpec.Size.AsDecimal();
42                 float totalHeight = heightMeasureSpec.Size.AsDecimal();
43
44                 if (widthMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
45                 {
46                     if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
47                     {
48                         totalHeight = Owner.GetHeightForWidth(totalWidth);
49                         heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
50                     }
51                 }
52                 else
53                 {
54                     var minSize = Owner.MinimumSize;
55                     var maxSize = Owner.MaximumSize;
56                     var naturalSize = Owner.GetNaturalSize();
57
58                     if (heightMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
59                     {
60                         // GetWidthForHeight is not implemented.
61                         float width = naturalSize != null ? naturalSize.Width : 0;
62                         totalWidth = Math.Min(Math.Max(width, minSize.Width), (maxSize.Width < 0 ? Int32.MaxValue : maxSize.Width));
63                         widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
64                     }
65                     else
66                     {
67                         float width = naturalSize != null ? naturalSize.Width : 0;
68                         float height = naturalSize != null ? naturalSize.Height : 0;
69                         totalWidth = Math.Min(Math.Max(width, minSize.Width), (maxSize.Width < 0 ? Int32.MaxValue : maxSize.Width));
70                         totalHeight = Math.Min(Math.Max(height, minSize.Height), (maxSize.Height < 0 ? Int32.MaxValue : maxSize.Height));
71
72                         heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
73                         widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
74                     }
75                 }
76
77                 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
78                 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
79
80                 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
81                                        ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));
82             }
83         }
84
85         static TextLabel() { }
86
87         static internal new void Preload()
88         {
89             // Do not call View.Preload(), since we already call it
90
91             Property.Preload();
92             // Do nothing. Just call for load static values.
93         }
94
95         private static SystemFontTypeChanged systemFontTypeChanged = new SystemFontTypeChanged();
96         private static SystemLocaleLanguageChanged systemLocaleLanguageChanged = new SystemLocaleLanguageChanged();
97         static private string defaultStyleName = "Tizen.NUI.BaseComponents.TextLabel";
98         static private string defaultFontFamily = "BreezeSans";
99         private string textLabelSid = null;
100         private TextLabelSelectorData selectorData;
101         private string fontFamily = defaultFontFamily;
102         private float fontSizeScale = 1.0f;
103
104         private bool textIsEmpty = true;
105
106         private bool hasSystemLanguageChanged = false;
107         private bool hasSystemFontSizeChanged = false;
108         private bool hasSystemFontTypeChanged = false;
109
110         private Color internalTextColor;
111         private Color internalAnchorColor;
112         private Color internalAnchorClickedColor;
113
114         /// <summary>
115         /// Creates the TextLabel control.
116         /// </summary>
117         /// <since_tizen> 3 </since_tizen>
118         public TextLabel() : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
119         {
120             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121         }
122
123         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
124         [EditorBrowsable(EditorBrowsableState.Never)]
125         public TextLabel(TextLabelStyle viewStyle) : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true, viewStyle)
126         {
127         }
128
129         /// <summary>
130         /// Creates the TextLabel with setting the status of shown or hidden.
131         /// </summary>
132         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
133         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
134         [EditorBrowsable(EditorBrowsableState.Never)]
135         public TextLabel(bool shown) : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
136         {
137             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
138             SetVisible(shown);
139         }
140
141         /// <summary>
142         /// Creates the TextLabel control.
143         /// </summary>
144         /// <param name="text">The text to display</param>
145         /// <since_tizen> 3 </since_tizen>
146         public TextLabel(string text) : this(Interop.TextLabel.New(text, ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
147         {
148             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
149             textIsEmpty = string.IsNullOrEmpty(text);
150         }
151
152         /// <summary>
153         /// Creates the TextLabel with setting the status of shown or hidden.
154         /// </summary>
155         /// <param name="text">The text to display</param>
156         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
157         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
158         [EditorBrowsable(EditorBrowsableState.Never)]
159         public TextLabel(string text, bool shown) : this(Interop.TextLabel.New(text, ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
160         {
161             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162             textIsEmpty = string.IsNullOrEmpty(text);
163             SetVisible(shown);
164         }
165
166         internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
167         {
168             if (!shown)
169             {
170                 SetVisible(false);
171             }
172         }
173
174         internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
175         {
176             if (!shown)
177             {
178                 SetVisible(false);
179             }
180         }
181
182         private bool HasStyle()
183         {
184             return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
185         }
186
187         /// <summary>
188         /// The TranslatableText property.<br />
189         /// The text can set the SID value.<br />
190         /// </summary>
191         /// <exception cref='ArgumentNullException'>
192         /// ResourceManager about multilingual is null.
193         /// </exception>
194         /// <since_tizen> 4 </since_tizen>
195         public string TranslatableText
196         {
197             get
198             {
199                 return (string)GetValue(TranslatableTextProperty);
200             }
201             set
202             {
203                 SetValue(TranslatableTextProperty, value);
204             }
205         }
206         private string translatableText
207         {
208             get
209             {
210                 return textLabelSid;
211             }
212             set
213             {
214                 if (NUIApplication.MultilingualResourceManager == null)
215                 {
216                     throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
217                 }
218                 string translatableText = null;
219                 textLabelSid = value;
220                 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
221                 if (translatableText != null)
222                 {
223                     Text = translatableText;
224                     if (hasSystemLanguageChanged == false)
225                     {
226                         systemLocaleLanguageChanged.Add(SystemSettingsLocaleLanguageChanged);
227                         hasSystemLanguageChanged = true;
228                     }
229                 }
230                 else
231                 {
232                     Text = "";
233                 }
234                 NotifyPropertyChanged();
235             }
236         }
237
238         /// <summary>
239         /// The Text property.<br />
240         /// The text to display in the UTF-8 format.<br />
241         /// </summary>
242         /// <since_tizen> 3 </since_tizen>
243         public string Text
244         {
245             get
246             {
247                 return (string)GetValue(TextProperty);
248             }
249             set
250             {
251                 SetValue(TextProperty, value);
252                 NotifyPropertyChanged();
253             }
254         }
255
256         /// <summary>
257         /// The FontFamily property.<br />
258         /// The requested font family to use.<br />
259         /// </summary>
260         /// <since_tizen> 3 </since_tizen>
261         public string FontFamily
262         {
263             get
264             {
265                 return (string)GetValue(FontFamilyProperty);
266             }
267             set
268             {
269                 SetValue(FontFamilyProperty, value);
270                 NotifyPropertyChanged();
271             }
272         }
273
274         private string InternalFontFamily
275         {
276             get
277             {
278                 if (HasStyle())
279                     return fontFamily;
280                 else
281                     return Object.InternalGetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily);
282             }
283             set
284             {
285                 string newFontFamily;
286
287                 if (string.Equals(fontFamily, value)) return;
288
289                 fontFamily = value;
290                 if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
291                 {
292                     try
293                     {
294                         newFontFamily = SystemSettings.FontType;
295                     }
296                     catch (Exception e)
297                     {
298                         Console.WriteLine("{0} Exception caught.", e);
299                         newFontFamily = defaultFontFamily;
300                     }
301                     AddSystemSettingsFontTypeChanged();
302                 }
303                 else
304                 {
305                     newFontFamily = fontFamily;
306                     RemoveSystemSettingsFontTypeChanged();
307                 }
308
309                 SetInternalFontFamily(newFontFamily);
310             }
311         }
312
313         private void SetInternalFontFamily(string fontFamily)
314         {
315             Object.InternalSetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily, (string)fontFamily);
316             RequestLayout();
317         }
318
319         /// <summary>
320         /// The FontStyle property.<br />
321         /// The requested font style to use.<br />
322         /// The fontStyle map contains the following keys :<br />
323         /// <list type="table">
324         /// <item><term>width (string)</term><description>The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded)</description></item>
325         /// <item><term>weight (string)</term><description>The weight key defines the thickness or darkness of the glyphs. (values: thin, ultraLight, extraLight, light, demiLight, semiLight, book, normal, regular, medium, demiBold, semiBold, bold, ultraBold, extraBold, black, heavy, extraBlack)</description></item>
326         /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
327         /// </list>
328         /// </summary>
329         /// <since_tizen> 3 </since_tizen>
330         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
331         public PropertyMap FontStyle
332         {
333             get
334             {
335                 return (PropertyMap)GetValue(FontStyleProperty);
336             }
337             set
338             {
339                 SetValue(FontStyleProperty, value);
340                 NotifyPropertyChanged();
341             }
342         }
343
344         /// <summary>
345         /// Set FontStyle to TextLabel. <br />
346         /// </summary>
347         /// <param name="fontStyle">The FontStyle</param>
348         /// <remarks>
349         /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
350         /// </remarks>
351         /// <example>
352         /// The following example demonstrates how to use the SetFontStyle method.
353         /// <code>
354         /// var fontStyle = new Tizen.NUI.Text.FontStyle();
355         /// fontStyle.Width = FontWidthType.Expanded;
356         /// fontStyle.Weight = FontWeightType.Bold;
357         /// fontStyle.Slant = FontSlantType.Italic;
358         /// label.SetFontStyle(fontStyle);
359         /// </code>
360         /// </example>
361         [EditorBrowsable(EditorBrowsableState.Never)]
362         public void SetFontStyle(FontStyle fontStyle)
363         {
364             using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
365             {
366                 SetValue(FontStyleProperty, fontStyleMap);
367             }
368         }
369
370         /// <summary>
371         /// Get FontStyle from TextLabel. <br />
372         /// </summary>
373         /// <returns>The FontStyle</returns>
374         /// <remarks>
375         /// <see cref="Tizen.NUI.Text.FontStyle"/>
376         /// </remarks>
377         [EditorBrowsable(EditorBrowsableState.Never)]
378         public FontStyle GetFontStyle()
379         {
380             FontStyle fontStyle;
381             using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
382             {
383                 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
384             }
385             return fontStyle;
386         }
387
388         /// <summary>
389         /// The PointSize property.<br />
390         /// The size of font in points.<br />
391         /// </summary>
392         /// <since_tizen> 3 </since_tizen>
393         [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
394         public float PointSize
395         {
396             get
397             {
398                 return (float)GetValue(PointSizeProperty);
399             }
400             set
401             {
402                 SetValue(PointSizeProperty, value);
403                 NotifyPropertyChanged();
404             }
405         }
406
407         /// <summary>
408         /// The MultiLine property.<br />
409         /// The single-line or multi-line layout option.<br />
410         /// </summary>
411         /// <since_tizen> 3 </since_tizen>
412         public bool MultiLine
413         {
414             get
415             {
416                 return (bool)GetValue(MultiLineProperty);
417             }
418             set
419             {
420                 SetValue(MultiLineProperty, value);
421                 NotifyPropertyChanged();
422             }
423         }
424
425         /// <summary>
426         /// The HorizontalAlignment property.<br />
427         /// The line horizontal alignment.<br />
428         /// </summary>
429         /// <since_tizen> 3 </since_tizen>
430         public HorizontalAlignment HorizontalAlignment
431         {
432             get
433             {
434                 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
435             }
436             set
437             {
438                 SetValue(HorizontalAlignmentProperty, value);
439                 NotifyPropertyChanged();
440             }
441         }
442
443         /// <summary>
444         /// The VerticalAlignment property.<br />
445         /// The line vertical alignment.<br />
446         /// </summary>
447         /// <since_tizen> 3 </since_tizen>
448         public VerticalAlignment VerticalAlignment
449         {
450             get
451             {
452                 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
453             }
454             set
455             {
456                 SetValue(VerticalAlignmentProperty, value);
457                 NotifyPropertyChanged();
458             }
459         }
460
461         /// <summary>
462         /// The TextColor property.<br />
463         /// The color of the text.<br />
464         /// Animation framework can be used to change the color of the text when not using mark up.<br />
465         /// Cannot animate the color when text is auto scrolling.<br />
466         /// </summary>
467         /// <remarks>
468         /// The property cascade chaining set is possible. For example, this (textLabel.TextColor.X = 0.1f;) is possible.
469         /// </remarks>
470         /// <since_tizen> 3 </since_tizen>
471         public Color TextColor
472         {
473             get
474             {
475                 Color temp = (Color)GetValue(TextColorProperty);
476                 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
477             }
478             set
479             {
480                 SetValue(TextColorProperty, value);
481                 NotifyPropertyChanged();
482             }
483         }
484
485         /// <summary>
486         /// The ShadowOffset property.<br />
487         /// The drop shadow offset 0 indicates no shadow.<br />
488         /// </summary>
489         /// <since_tizen> 3 </since_tizen>
490         /// <remarks>
491         /// Deprecated.(API Level 6) Use Shadow instead.
492         /// The property cascade chaining set is possible. For example, this (textLabel.ShadowOffset.X = 0.1f;) is possible.
493         /// </remarks>
494         [Obsolete("Do not use this ShadowOffset(Deprecated). Use Shadow instead.")]
495         public Vector2 ShadowOffset
496         {
497             get
498             {
499                 return GetValue(ShadowOffsetProperty) as Vector2;
500             }
501             set
502             {
503                 SetValue(ShadowOffsetProperty, value);
504             }
505         }
506
507         private Vector2 InternalShadowOffset
508         {
509             get
510             {
511                 float x = 0.0f, y = 0.0f;
512                 using (var propertyValue = Shadow.Find(TextLabel.Property.SHADOW, "offset"))
513                 using (var shadowOffset = new Vector2())
514                 {
515                     if (null != propertyValue)
516                     {
517                         propertyValue.Get(shadowOffset);
518                         x = shadowOffset.X;
519                         y = shadowOffset.Y;
520                     }
521                 }
522                 return new Vector2(OnShadowOffsetChanged, x, y);
523             }
524             set
525             {
526                 using (var map = new PropertyMap())
527                 {
528                     map.Add("offset", value);
529
530                     var shadowMap = Shadow;
531                     shadowMap.Merge(map);
532
533                     SetValue(ShadowProperty, shadowMap);
534                     NotifyPropertyChanged();
535                 }
536             }
537         }
538
539         /// <summary>
540         /// The ShadowColor property.<br />
541         /// The color of a drop shadow.<br />
542         /// </summary>
543         /// <since_tizen> 3 </since_tizen>
544         /// <remarks>
545         /// Deprecated.(API Level 6) Use Shadow instead.
546         /// The property cascade chaining set is possible. For example, this (textLabel.ShadowColor.X = 0.1f;) is possible.
547         /// </remarks>
548         [Obsolete("Do not use this ShadowColor(Deprecated). Use Shadow instead.")]
549         public Vector4 ShadowColor
550         {
551             get
552             {
553                 return GetValue(ShadowColorProperty) as Vector4;
554             }
555             set
556             {
557                 SetValue(ShadowColorProperty, value);
558             }
559         }
560
561         private Vector4 InternalShadowColor
562         {
563             get
564             {
565                 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
566                 using (var propertyValue = Shadow.Find(TextLabel.Property.SHADOW, "color"))
567                 using (var shadowColor = new Vector4())
568                 {
569                     if (null != propertyValue)
570                     {
571                         propertyValue.Get(shadowColor);
572                         x = shadowColor.X;
573                         y = shadowColor.Y;
574                         z = shadowColor.Z;
575                         w = shadowColor.W;
576                     }
577                 }
578                 return new Vector4(OnShadowColorChanged, x, y, z, w);
579             }
580             set
581             {
582                 using (var map = new PropertyMap())
583                 {
584                     map.Add("color", value);
585                     var shadowMap = Shadow;
586                     shadowMap.Merge(map);
587                     SetValue(ShadowProperty, shadowMap);
588                     NotifyPropertyChanged();
589                 }
590             }
591         }
592
593         /// <summary>
594         /// The UnderlineEnabled property.<br />
595         /// The underline enabled flag.<br />
596         /// </summary>
597         /// <since_tizen> 3 </since_tizen>
598         /// <remarks>
599         /// Deprecated.(API Level 6) Use Underline instead.
600         /// </remarks>
601         [Obsolete("Do not use this UnderlineEnabled(Deprecated). Use Underline instead.")]
602         public bool UnderlineEnabled
603         {
604             get
605             {
606                 return (bool)GetValue(UnderlineEnabledProperty);
607             }
608             set
609             {
610                 SetValue(UnderlineEnabledProperty, value);
611             }
612         }
613
614         private bool InternalUnderlineEnabled
615         {
616             get
617             {
618                 bool underlineEnabled = false;
619                 using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "enable"))
620                 {
621                     if (propertyValue != null)
622                     {
623                         propertyValue.Get(out underlineEnabled);
624                     }
625                 }
626                 return underlineEnabled;
627             }
628             set
629             {
630                 using (var map = new PropertyMap())
631                 {
632                     map.Add("enable", value);
633                     var undelineMap = Underline;
634                     undelineMap.Merge(map);
635                     SetValue(UnderlineProperty, undelineMap);
636                     NotifyPropertyChanged();
637                 }
638             }
639         }
640
641         /// <summary>
642         /// The UnderlineColor property.<br />
643         /// Overrides the underline height from font metrics.<br />
644         /// </summary>
645         /// <since_tizen> 3 </since_tizen>
646         /// <remarks>
647         /// Deprecated.(API Level 6) Use Underline instead.
648         /// The property cascade chaining set is possible. For example, this (textLabel.UnderlineColor.X = 0.1f;) is possible.
649         /// </remarks>
650         [Obsolete("Do not use this UnderlineColor(Deprecated). Use Underline instead.")]
651         public Vector4 UnderlineColor
652         {
653             get
654             {
655                 return GetValue(UnderlineColorProperty) as Vector4;
656             }
657             set
658             {
659                 SetValue(UnderlineColorProperty, value);
660             }
661         }
662
663         private Vector4 InternalUnderlineColor
664         {
665             get
666             {
667                 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
668                 using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "color"))
669                 using (var underlineColor = new Vector4())
670                 {
671                     if (null != propertyValue)
672                     {
673                         propertyValue.Get(underlineColor);
674                         x = underlineColor.X;
675                         y = underlineColor.Y;
676                         z = underlineColor.Z;
677                         w = underlineColor.W;
678                     }
679                 }
680                 return new Vector4(OnUnderlineColorChanged, x, y, z, w);
681             }
682             set
683             {
684                 using (var map = new PropertyMap())
685                 {
686                     map.Add("color", value);
687                     var undelineMap = Underline;
688                     undelineMap.Merge(map);
689                     SetValue(UnderlineProperty, undelineMap);
690                     NotifyPropertyChanged();
691                 }
692             }
693         }
694
695         /// <summary>
696         /// The UnderlineHeight property.<br />
697         /// Overrides the underline height from font metrics.<br />
698         /// </summary>
699         /// <since_tizen> 3 </since_tizen>
700         /// <remarks>
701         /// Deprecated.(API Level 6) Use Underline instead.
702         /// </remarks>
703         [Obsolete("Do not use this UnderlineHeight(Deprecated). Use Underline instead.")]
704         public float UnderlineHeight
705         {
706             get
707             {
708                 return (float)GetValue(UnderlineHeightProperty);
709             }
710             set
711             {
712                 SetValue(UnderlineHeightProperty, value);
713             }
714         }
715
716         private float InternalUnderlineHeight
717         {
718             get
719             {
720                 float underlineHeight = 0.0f;
721                 using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "height"))
722                 {
723                     if (null != propertyValue)
724                     {
725                         propertyValue.Get(out underlineHeight);
726                     }
727                 }
728                 return underlineHeight;
729             }
730             set
731             {
732                 using (var map = new PropertyMap())
733                 {
734                     map.Add("height", value);
735                     var undelineMap = Underline;
736                     undelineMap.Merge(map);
737                     SetValue(UnderlineProperty, undelineMap);
738                     NotifyPropertyChanged();
739                 }
740             }
741         }
742
743         /// <summary>
744         /// The EnableMarkup property.<br />
745         /// Whether the mark-up processing is enabled.<br />
746         /// </summary>
747         /// <since_tizen> 3 </since_tizen>
748         public bool EnableMarkup
749         {
750             get
751             {
752                 return (bool)GetValue(EnableMarkupProperty);
753             }
754             set
755             {
756                 SetValue(EnableMarkupProperty, value);
757                 NotifyPropertyChanged();
758             }
759         }
760
761         /// <summary>
762         /// The EnableAutoScroll property.<br />
763         /// Starts or stops auto scrolling.<br />
764         /// </summary>
765         /// <since_tizen> 3 </since_tizen>
766         public bool EnableAutoScroll
767         {
768             get
769             {
770                 return (bool)GetValue(EnableAutoScrollProperty);
771             }
772             set
773             {
774                 SetValue(EnableAutoScrollProperty, value);
775                 NotifyPropertyChanged();
776             }
777         }
778
779         /// <summary>
780         /// The AutoScrollSpeed property.<br />
781         /// Sets the speed of scrolling in pixels per second.<br />
782         /// </summary>
783         /// <since_tizen> 3 </since_tizen>
784         public int AutoScrollSpeed
785         {
786             get
787             {
788                 return (int)GetValue(AutoScrollSpeedProperty);
789             }
790             set
791             {
792                 SetValue(AutoScrollSpeedProperty, value);
793                 NotifyPropertyChanged();
794             }
795         }
796
797         /// <summary>
798         /// The AutoScrollLoopCount property.<br />
799         /// Number of complete loops when scrolling enabled.<br />
800         /// </summary>
801         /// <since_tizen> 3 </since_tizen>
802         public int AutoScrollLoopCount
803         {
804             get
805             {
806                 return (int)GetValue(AutoScrollLoopCountProperty);
807             }
808             set
809             {
810                 SetValue(AutoScrollLoopCountProperty, value);
811                 NotifyPropertyChanged();
812             }
813         }
814
815         /// <summary>
816         /// The AutoScrollGap property.<br />
817         /// Gap before scrolling wraps.<br />
818         /// </summary>
819         /// <since_tizen> 3 </since_tizen>
820         public float AutoScrollGap
821         {
822             get
823             {
824                 return (float)GetValue(AutoScrollGapProperty);
825             }
826             set
827             {
828                 SetValue(AutoScrollGapProperty, value);
829                 NotifyPropertyChanged();
830             }
831         }
832
833         /// <summary>
834         /// The LineSpacing property.<br />
835         /// The default extra space between lines in points.<br />
836         /// </summary>
837         /// <since_tizen> 3 </since_tizen>
838         public float LineSpacing
839         {
840             get
841             {
842                 return (float)GetValue(LineSpacingProperty);
843             }
844             set
845             {
846                 SetValue(LineSpacingProperty, value);
847                 NotifyPropertyChanged();
848             }
849         }
850
851         /// <summary>
852         /// The relative height of the line (a factor that will be multiplied by text height). <br />
853         /// If the value is less than 1, the lines could to be overlapped.
854         /// </summary>
855         [EditorBrowsable(EditorBrowsableState.Never)]
856         public float RelativeLineHeight
857         {
858             get
859             {
860                 return (float)GetValue(RelativeLineHeightProperty);
861             }
862             set
863             {
864                 SetValue(RelativeLineHeightProperty, value);
865                 NotifyPropertyChanged();
866             }
867         }
868
869         /// <summary>
870         /// The Underline property.<br />
871         /// The default underline parameters.<br />
872         /// The underline map contains the following keys :<br />
873         /// <list type="table">
874         /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
875         /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
876         /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
877         /// </list>
878         /// </summary>
879         /// <since_tizen> 3 </since_tizen>
880         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
881         public PropertyMap Underline
882         {
883             get
884             {
885                 return (PropertyMap)GetValue(UnderlineProperty);
886             }
887             set
888             {
889                 SetValue(UnderlineProperty, value);
890                 NotifyPropertyChanged();
891             }
892         }
893
894         /// <summary>
895         /// Set Underline to TextLabel. <br />
896         /// </summary>
897         /// <param name="underline">The Underline</param>
898         /// <remarks>
899         /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
900         /// </remarks>
901         /// <example>
902         /// The following example demonstrates how to use the SetUnderline method.
903         /// <code>
904         /// var underline = new Tizen.NUI.Text.Underline();
905         /// underline.Enable = true;
906         /// underline.Color = new Color("#3498DB");
907         /// underline.Height = 2.0f;
908         /// label.SetUnderline(underline);
909         /// </code>
910         /// </example>
911         [EditorBrowsable(EditorBrowsableState.Never)]
912         public void SetUnderline(Underline underline)
913         {
914             using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
915             {
916                 SetValue(UnderlineProperty, underlineMap);
917             }
918         }
919
920         /// <summary>
921         /// Get Underline from TextLabel. <br />
922         /// </summary>
923         /// <returns>The Underline</returns>
924         /// <remarks>
925         /// <see cref="Tizen.NUI.Text.Underline"/>
926         /// </remarks>
927         [EditorBrowsable(EditorBrowsableState.Never)]
928         public Underline GetUnderline()
929         {
930             Underline underline;
931             using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
932             {
933                 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
934             }
935             return underline;
936         }
937
938         /// <summary>
939         /// The Shadow property.<br />
940         /// The default shadow parameters.<br />
941         /// The shadow map contains the following keys :<br />
942         /// <list type="table">
943         /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
944         /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
945         /// <item><term>blurRadius (float)</term><description>The radius of the Gaussian blur for the soft shadow (If not provided then the soft shadow is not enabled)</description></item>
946         /// </list>
947         /// </summary>
948         /// <since_tizen> 3 </since_tizen>
949         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
950         public PropertyMap Shadow
951         {
952             get
953             {
954                 return (PropertyMap)GetValue(ShadowProperty);
955             }
956             set
957             {
958                 SetValue(ShadowProperty, value);
959                 NotifyPropertyChanged();
960             }
961         }
962
963         /// <summary>
964         /// Set Shadow to TextLabel. <br />
965         /// </summary>
966         /// <param name="shadow">The Shadow</param>
967         /// <remarks>
968         /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
969         /// </remarks>
970         /// <example>
971         /// The following example demonstrates how to use the SetShadow method.
972         /// <code>
973         /// var shadow = new Tizen.NUI.Text.Shadow();
974         /// shadow.Offset = new Vector2(3, 3);
975         /// shadow.Color = new Color("#F1C40F");
976         /// shadow.BlurRadius = 4.0f;
977         /// label.SetShadow(shadow);
978         /// </code>
979         /// </example>
980         [EditorBrowsable(EditorBrowsableState.Never)]
981         public void SetShadow(Tizen.NUI.Text.Shadow shadow)
982         {
983             using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
984             {
985                 SetValue(ShadowProperty, shadowMap);
986             }
987         }
988
989         /// <summary>
990         /// Get Shadow from TextLabel. <br />
991         /// </summary>
992         /// <returns>The Shadow</returns>
993         /// <remarks>
994         /// <see cref="Tizen.NUI.Text.Shadow"/>
995         /// </remarks>
996         [EditorBrowsable(EditorBrowsableState.Never)]
997         public Tizen.NUI.Text.Shadow GetShadow()
998         {
999             Tizen.NUI.Text.Shadow shadow;
1000             using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1001             {
1002                 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1003             }
1004             return shadow;
1005         }
1006
1007         /// <summary>
1008         /// Describes a text shadow for a TextLabel.
1009         /// It is null by default.
1010         /// </summary>
1011         [EditorBrowsable(EditorBrowsableState.Never)]
1012         public TextShadow TextShadow
1013         {
1014             get
1015             {
1016                 return (TextShadow)GetValue(TextShadowProperty);
1017             }
1018             set
1019             {
1020                 SetValue(TextShadowProperty, value);
1021                 NotifyPropertyChanged();
1022             }
1023         }
1024
1025         /// <summary>
1026         /// The Emboss property.<br />
1027         /// The default emboss parameters.<br />
1028         /// </summary>
1029         /// <since_tizen> 3 </since_tizen>
1030         public string Emboss
1031         {
1032             get
1033             {
1034                 return (string)GetValue(EmbossProperty);
1035             }
1036             set
1037             {
1038                 SetValue(EmbossProperty, value);
1039                 NotifyPropertyChanged();
1040             }
1041         }
1042
1043         /// <summary>
1044         /// The Outline property.<br />
1045         /// The default outline parameters.<br />
1046         /// The outline map contains the following keys :<br />
1047         /// <list type="table">
1048         /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1049         /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1050         /// </list>
1051         /// </summary>
1052         /// <since_tizen> 3 </since_tizen>
1053         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1054         public PropertyMap Outline
1055         {
1056             get
1057             {
1058                 return (PropertyMap)GetValue(OutlineProperty);
1059             }
1060             set
1061             {
1062                 SetValue(OutlineProperty, value);
1063                 NotifyPropertyChanged();
1064             }
1065         }
1066
1067         /// <summary>
1068         /// Set Outline to TextLabel. <br />
1069         /// </summary>
1070         /// <param name="outline">The Outline</param>
1071         /// <remarks>
1072         /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1073         /// </remarks>
1074         /// <example>
1075         /// The following example demonstrates how to use the SetOutline method.
1076         /// <code>
1077         /// var outline = new Tizen.NUI.Text.Outline();
1078         /// outline.Width = 2.0f;
1079         /// outline.Color = new Color("#45B39D");
1080         /// label.SetOutline(outline);
1081         /// </code>
1082         /// </example>
1083         [EditorBrowsable(EditorBrowsableState.Never)]
1084         public void SetOutline(Outline outline)
1085         {
1086             using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1087             {
1088                 SetValue(OutlineProperty, outlineMap);
1089             }
1090         }
1091
1092         /// <summary>
1093         /// Get Outline from TextLabel. <br />
1094         /// </summary>
1095         /// <returns>The Outline</returns>
1096         /// <remarks>
1097         /// <see cref="Tizen.NUI.Text.Outline"/>
1098         /// </remarks>
1099         [EditorBrowsable(EditorBrowsableState.Never)]
1100         public Outline GetOutline()
1101         {
1102             Outline outline;
1103             using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1104             {
1105                 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1106             }
1107             return outline;
1108         }
1109
1110         /// <summary>
1111         /// Set Strikethrough to TextLabel. <br />
1112         /// </summary>
1113         /// <param name="strikethrough">The Strikethrough</param>
1114         /// <remarks>
1115         /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
1116         /// </remarks>
1117         /// <example>
1118         /// The following example demonstrates how to use the SetStrikethrough method.
1119         /// <code>
1120         /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
1121         /// strikethrough.Enable = true;
1122         /// strikethrough.Color = new Color("#3498DB");
1123         /// strikethrough.Height = 2.0f;
1124         /// label.SetStrikethrough(strikethrough);
1125         /// </code>
1126         /// </example>
1127         [EditorBrowsable(EditorBrowsableState.Never)]
1128         public void SetStrikethrough(Strikethrough strikethrough)
1129         {
1130             using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
1131             using (var propertyValue = new PropertyValue(map))
1132             {
1133                 SetProperty(TextLabel.Property.Strikethrough, propertyValue);
1134             }
1135         }
1136
1137         /// <summary>
1138         /// Get Strikethrough from TextLabel. <br />
1139         /// </summary>
1140         /// <returns>The Strikethrough</returns>
1141         /// <remarks>
1142         /// <see cref="Tizen.NUI.Text.Strikethrough"/>
1143         /// </remarks>
1144         [EditorBrowsable(EditorBrowsableState.Never)]
1145         public Strikethrough GetStrikethrough()
1146         {
1147             Strikethrough strikethrough;
1148             using (var propertyValue = GetProperty(TextLabel.Property.Strikethrough))
1149             using (var map = new PropertyMap())
1150             {
1151                 propertyValue.Get(map);
1152                 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
1153             }
1154             return strikethrough;
1155         }
1156
1157         /// <summary>
1158         /// The PixelSize property.<br />
1159         /// The size of font in pixels.<br />
1160         /// </summary>
1161         /// <since_tizen> 3 </since_tizen>
1162         [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1163         public float PixelSize
1164         {
1165             get
1166             {
1167                 return (float)GetValue(PixelSizeProperty);
1168             }
1169             set
1170             {
1171                 SetValue(PixelSizeProperty, value);
1172                 NotifyPropertyChanged();
1173             }
1174         }
1175
1176         /// <summary>
1177         /// The Ellipsis property.<br />
1178         /// Enable or disable the ellipsis.<br />
1179         /// </summary>
1180         /// <since_tizen> 3 </since_tizen>
1181         public bool Ellipsis
1182         {
1183             get
1184             {
1185                 return (bool)GetValue(EllipsisProperty);
1186             }
1187             set
1188             {
1189                 SetValue(EllipsisProperty, value);
1190                 NotifyPropertyChanged();
1191             }
1192         }
1193
1194         /// <summary>
1195         /// The ellipsis position of the text.
1196         /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
1197         /// </summary>
1198         /// <since_tizen> 9 </since_tizen>
1199         public EllipsisPosition EllipsisPosition
1200         {
1201             get
1202             {
1203                 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1204             }
1205             set
1206             {
1207                 SetValue(EllipsisPositionProperty, value);
1208                 NotifyPropertyChanged();
1209             }
1210         }
1211
1212         /// <summary>
1213         /// The AutoScrollLoopDelay property.<br />
1214         /// The amount of time to delay the starting time of auto scrolling and further loops.<br />
1215         /// </summary>
1216         /// <since_tizen> 3 </since_tizen>
1217         public float AutoScrollLoopDelay
1218         {
1219             get
1220             {
1221                 return (float)GetValue(AutoScrollLoopDelayProperty);
1222             }
1223             set
1224             {
1225                 SetValue(AutoScrollLoopDelayProperty, value);
1226                 NotifyPropertyChanged();
1227             }
1228         }
1229
1230         /// <summary>
1231         /// The AutoScrollStopMode property.<br />
1232         /// The auto scrolling stop behaviour.<br />
1233         /// The default value is AutoScrollStopMode.FinishLoop. <br />
1234         /// </summary>
1235         /// <since_tizen> 3 </since_tizen>
1236         public AutoScrollStopMode AutoScrollStopMode
1237         {
1238             get
1239             {
1240                 return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
1241             }
1242             set
1243             {
1244                 SetValue(AutoScrollStopModeProperty, value);
1245                 NotifyPropertyChanged();
1246             }
1247         }
1248
1249         /// <summary>
1250         /// The line count of the text.
1251         /// </summary>
1252         /// <since_tizen> 3 </since_tizen>
1253         public int LineCount
1254         {
1255             get
1256             {
1257                 int lineCount = 0;
1258                 using (var propertyValue = GetProperty(TextLabel.Property.LineCount))
1259                 {
1260                     propertyValue.Get(out lineCount);
1261                 }
1262                 return lineCount;
1263             }
1264         }
1265
1266         /// <summary>
1267         /// The LineWrapMode property.<br />
1268         /// line wrap mode when the text lines over layout width.<br />
1269         /// </summary>
1270         /// <since_tizen> 4 </since_tizen>
1271         public LineWrapMode LineWrapMode
1272         {
1273             get
1274             {
1275                 return (LineWrapMode)GetValue(LineWrapModeProperty);
1276             }
1277             set
1278             {
1279                 SetValue(LineWrapModeProperty, value);
1280                 NotifyPropertyChanged();
1281             }
1282         }
1283
1284         /// <summary>
1285         /// The direction of the text such as left to right or right to left.
1286         /// </summary>
1287         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1288         [EditorBrowsable(EditorBrowsableState.Never)]
1289         public TextDirection TextDirection
1290         {
1291             get
1292             {
1293                 int textDirection = 0;
1294                 using (var propertyValue = GetProperty(TextLabel.Property.TextDirection))
1295                 {
1296                     propertyValue.Get(out textDirection);
1297                 }
1298                 return (TextDirection)textDirection;
1299             }
1300         }
1301
1302         /// <summary>
1303         /// The vertical line alignment of the text.
1304         /// </summary>
1305         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1306         [EditorBrowsable(EditorBrowsableState.Never)]
1307         public VerticalLineAlignment VerticalLineAlignment
1308         {
1309             get
1310             {
1311                 return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
1312             }
1313             set
1314             {
1315                 SetValue(VerticalLineAlignmentProperty, value);
1316                 NotifyPropertyChanged();
1317             }
1318         }
1319
1320         /// <summary>
1321         /// The text alignment to match the direction of the system language.
1322         /// </summary>
1323         /// <since_tizen> 6 </since_tizen>
1324         public bool MatchSystemLanguageDirection
1325         {
1326             get
1327             {
1328                 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1329             }
1330             set
1331             {
1332                 SetValue(MatchSystemLanguageDirectionProperty, value);
1333                 NotifyPropertyChanged();
1334             }
1335         }
1336
1337         /// <summary>
1338         /// The text fit parameters.<br />
1339         /// The textFit map contains the following keys :<br />
1340         /// <list type="table">
1341         /// <item><term>enable (bool)</term><description>True to enable the text fit or false to disable (the default value is false)</description></item>
1342         /// <item><term>minSize (float)</term><description>Minimum Size for text fit (the default value is 10.f)</description></item>
1343         /// <item><term>maxSize (float)</term><description>Maximum Size for text fit (the default value is 100.f)</description></item>
1344         /// <item><term>stepSize (float)</term><description>Step Size for font increase (the default value is 1.f)</description></item>
1345         /// <item><term>fontSize (string)</term><description>The size type of font, You can choose between "pointSize" or "pixelSize". (the default value is "pointSize")</description></item>
1346         /// </list>
1347         /// </summary>
1348         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1349         [EditorBrowsable(EditorBrowsableState.Never)]
1350         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1351         public PropertyMap TextFit
1352         {
1353             get
1354             {
1355                 return (PropertyMap)GetValue(TextFitProperty);
1356             }
1357             set
1358             {
1359                 SetValue(TextFitProperty, value);
1360                 NotifyPropertyChanged();
1361             }
1362         }
1363
1364         /// <summary>
1365         /// Set TextFit to TextLabel. <br />
1366         /// </summary>
1367         /// <param name="textFit">The TextFit</param>
1368         /// <remarks>
1369         /// SetTextFit specifies the textFit of the text through <see cref="Tizen.NUI.Text.TextFit"/>. <br />
1370         /// </remarks>
1371         /// <example>
1372         /// The following example demonstrates how to use the SetTextFit method.
1373         /// <code>
1374         /// var textFit = new Tizen.NUI.Text.TextFit();
1375         /// textFit.Enable = true;
1376         /// textFit.MinSize = 10.0f;
1377         /// textFit.MaxSize = 100.0f;
1378         /// textFit.StepSize = 5.0f;
1379         /// textFit.FontSizeType = FontSizeType.PointSize;
1380         /// label.SetTextFit(textFit);
1381         /// </code>
1382         /// </example>
1383         [EditorBrowsable(EditorBrowsableState.Never)]
1384         public void SetTextFit(TextFit textFit)
1385         {
1386             using (var textFitMap = TextMapHelper.GetTextFitMap(textFit))
1387             {
1388                 SetValue(TextFitProperty, textFitMap);
1389             }
1390         }
1391
1392         /// <summary>
1393         /// Get TextFit from TextLabel. <br />
1394         /// </summary>
1395         /// <returns>The TextFit</returns>
1396         /// <remarks>
1397         /// TextFit is always returned based on PointSize. <br />
1398         /// If the user sets FontSizeType to PixelSize, then MinSize, MaxSize, and StepSize are converted based on PointSize and returned. <br />
1399         /// <see cref="Tizen.NUI.Text.TextFit"/>
1400         /// </remarks>
1401         [EditorBrowsable(EditorBrowsableState.Never)]
1402         public TextFit GetTextFit()
1403         {
1404             TextFit textFit;
1405             using (var textFitMap = (PropertyMap)GetValue(TextFitProperty))
1406             {
1407                 textFit = TextMapHelper.GetTextFitStruct(textFitMap);
1408             }
1409             return textFit;
1410         }
1411
1412         /// <summary>
1413         /// Set TextFitArray to TextLabel. <br />
1414         /// TextFitArray finds and applies the largest PointSize that fits among OptionList.
1415         /// </summary>
1416         /// <param name="textFitArray">The TextFitArray</param>
1417         /// <remarks>
1418         /// TextFitArray tries binary search by default. <br />
1419         /// The precondition for TextFitArray to perform binary search is sorting in ascending order of MinLineSize. <br />
1420         /// Because if MinLineSize is not sorted in ascending order, <br />
1421         /// binary search cannot guarantee that it will always find the best value. <br />
1422         /// In this case, the search sequentially starts from the largest PointSize. <br />
1423         /// If TextFitArrayOption's MinLineSize is set to null or 0, <br />
1424         /// TextFitArray is calculated without applying MinLineSize. <br />
1425         /// If TextFitArray is enabled, TextLabel's MinLineSize property is ignored. <br />
1426         /// See <see cref="Tizen.NUI.Text.TextFitArray"/> and <see cref="Tizen.NUI.Text.TextFitArrayOption"/>.
1427         /// </remarks>
1428         /// <example>
1429         /// The following example demonstrates how to use the SetTextFitArray method. <br />
1430         /// <code>
1431         /// var textFitArray = new Tizen.NUI.Text.TextFitArray();
1432         /// textFitArray.Enable = true;
1433         /// textFitArray.OptionList = new List&lt;Tizen.NUI.Text.TextFitArrayOption&gt;()
1434         /// {
1435         ///     new Tizen.NUI.Text.TextFitArrayOption(12, 18),
1436         ///     new Tizen.NUI.Text.TextFitArrayOption(24, 40),
1437         ///     new Tizen.NUI.Text.TextFitArrayOption(28, 48),
1438         ///     new Tizen.NUI.Text.TextFitArrayOption(32, 56),
1439         ///     new Tizen.NUI.Text.TextFitArrayOption(50, 72),
1440         /// };
1441         /// label.SetTextFitArray(textFitArray);
1442         /// </code>
1443         /// <br />
1444         /// The table below shows cases where binary search is possible and where it is not possible. <br />
1445         /// <code>
1446         /// [Binary search possible]
1447         /// |            | List index  |  0 |  1 |  2 |  3 |
1448         /// | OptionList | PointSize   | 24 | 28 | 32 | 48 |
1449         /// |            | MinLineSize | 40 | 48 | 48 | 62 | &lt;&lt; MinLineSize sorted in ascending order
1450         ///                                    ^    ^
1451         ///                                    same values â€‹are not a problem
1452         ///
1453         /// [Binary search not possible]
1454         /// |            | List index  |  0 |  1 |  2 |  3 |
1455         /// | OptionList | PointSize   | 24 | 28 | 32 | 48 |
1456         /// |            | MinLineSize | 40 | 48 | 38 | 62 | &lt;&lt; MinLineSize is not sorted in ascending order
1457         ///                                         ^
1458         /// </code>
1459         /// </example>
1460         [EditorBrowsable(EditorBrowsableState.Never)]
1461         public void SetTextFitArray(TextFitArray textFitArray)
1462         {
1463             bool enable = textFitArray.Enable;
1464             int optionListSize = textFitArray.OptionList?.Count ?? 0;
1465
1466             float[] pointSizeArray = new float[optionListSize];
1467             float[] minLineSizeArray = new float[optionListSize];
1468
1469             for (int i = 0 ; i < optionListSize ; i ++)
1470             {
1471                 TextFitArrayOption option = textFitArray.OptionList[i];
1472                 pointSizeArray[i] = option.PointSize;
1473                 minLineSizeArray[i] = option.MinLineSize ?? 0;
1474             }
1475
1476             Interop.TextLabel.SetTextFitArray(SwigCPtr, enable, (uint)optionListSize, pointSizeArray, minLineSizeArray);
1477             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1478         }
1479
1480         /// <summary>
1481         /// Get TextFitArray from TextLabel.
1482         /// </summary>
1483         /// <returns>The TextFitArray</returns>
1484         /// <remarks>
1485         /// See <see cref="Tizen.NUI.Text.TextFitArray"/> and <see cref="Tizen.NUI.Text.TextFitArrayOption"/>.
1486         /// </remarks>
1487         /// <example>
1488         /// The following example demonstrates how to use the GetTextFitArray method. <br />
1489         /// <code>
1490         /// Tizen.NUI.Text.TextFitArray textFitArray = label.GetTextFitArray();
1491         /// bool enable = textFitArray.Enable;
1492         /// var optionList = textFitArray.OptionList;
1493         /// foreach(Tizen.NUI.Text.TextFitArrayOption option in optionList)
1494         /// {
1495         ///     float pointSize = option.PointSize;
1496         ///     float minLinesize = option.MinLineSize;
1497         /// }
1498         /// </code>
1499         /// </example>
1500         [EditorBrowsable(EditorBrowsableState.Never)]
1501         public TextFitArray GetTextFitArray()
1502         {
1503             using PropertyMap textFitArrayMap = new PropertyMap(Interop.TextLabel.GetTextFitArray(SwigCPtr), true);
1504             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1505
1506             TextFitArray textFitArray;
1507             textFitArray = TextUtils.GetMapToTextFitArray(textFitArrayMap);
1508             return textFitArray;
1509         }
1510
1511         /// <summary>
1512         /// The MinLineSize property.<br />
1513         /// The height of the line in points. <br />
1514         /// If the font size is larger than the line size, it works with the font size. <br />
1515         /// </summary>
1516         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1517         [EditorBrowsable(EditorBrowsableState.Never)]
1518         public float MinLineSize
1519         {
1520             get
1521             {
1522                 return (float)GetValue(MinLineSizeProperty);
1523             }
1524             set
1525             {
1526                 SetValue(MinLineSizeProperty, value);
1527                 NotifyPropertyChanged();
1528             }
1529         }
1530
1531         /// <summary>
1532         /// The spaces between characters in Pixels.
1533         /// <remarks>
1534         /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
1535         /// The default value is 0.f which does nothing.
1536         ///</remarks>
1537         /// </summary>
1538         [EditorBrowsable(EditorBrowsableState.Never)]
1539         public float CharacterSpacing
1540         {
1541             get
1542             {
1543                 return (float)GetValue(CharacterSpacingProperty);
1544             }
1545             set
1546             {
1547                 SetValue(CharacterSpacingProperty, value);
1548                 NotifyPropertyChanged();
1549             }
1550         }
1551
1552         /// <summary>
1553         /// The AnchorColor property.<br />
1554         /// The color of the anchor.<br />
1555         /// This property is used as the default color of the markup anchor tag.<br />
1556         /// If there is a color attribute in the markup anchor tag, the markup attribute takes precedence.
1557         /// </summary>
1558         /// <remarks>
1559         /// The property cascade chaining set is possible. For example, this (textLabel.AnchorColor.X = 0.1f;) is possible.
1560         /// </remarks>
1561         [EditorBrowsable(EditorBrowsableState.Never)]
1562         public Color AnchorColor
1563         {
1564             get
1565             {
1566                 Color color = (Color)GetValue(AnchorColorProperty);
1567                 return new Color(OnAnchorColorChanged, color.R, color.G, color.B, color.A);
1568             }
1569             set
1570             {
1571                 SetValue(AnchorColorProperty, value);
1572                 NotifyPropertyChanged();
1573             }
1574         }
1575
1576         /// <summary>
1577         /// The AnchorClickedColor property.<br />
1578         /// The color of the clicked anchor.<br />
1579         /// This property is used as the default clicked color of the markup anchor tag.<br />
1580         /// If there is a color attribute in the markup anchor tag, the markup attribute takes precedence.
1581         /// </summary>
1582         /// <remarks>
1583         /// The property cascade chaining set is possible. For example, this (textLabel.AnchorClickedColor.X = 0.1f;) is possible.
1584         /// </remarks>
1585         [EditorBrowsable(EditorBrowsableState.Never)]
1586         public Color AnchorClickedColor
1587         {
1588             get
1589             {
1590                 Color color = (Color)GetValue(AnchorClickedColorProperty);
1591                 return new Color(OnAnchorClickedColorChanged, color.R, color.G, color.B, color.A);
1592             }
1593             set
1594             {
1595                 SetValue(AnchorClickedColorProperty, value);
1596                 NotifyPropertyChanged();
1597             }
1598         }
1599
1600         /// <summary>
1601         /// The FontSizeScale property for scaling the specified font size up or down. <br />
1602         /// The default value is 1.0. <br />
1603         /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
1604         /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
1605         /// </summary>
1606         /// <since_tizen> 9 </since_tizen>
1607         public float FontSizeScale
1608         {
1609             get
1610             {
1611                 return (float)GetValue(FontSizeScaleProperty);
1612             }
1613             set
1614             {
1615                 SetValue(FontSizeScaleProperty, value);
1616                 NotifyPropertyChanged();
1617             }
1618         }
1619
1620         private float InternalFontSizeScale
1621         {
1622             get
1623             {
1624                 return fontSizeScale;
1625             }
1626             set
1627             {
1628                 float newFontSizeScale;
1629
1630                 if (fontSizeScale == value) return;
1631
1632                 fontSizeScale = value;
1633                 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
1634                 {
1635                     SystemSettingsFontSize systemSettingsFontSize;
1636
1637                     try
1638                     {
1639                         systemSettingsFontSize = SystemSettings.FontSize;
1640                     }
1641                     catch (Exception e)
1642                     {
1643                         Console.WriteLine("{0} Exception caught.", e);
1644                         systemSettingsFontSize = SystemSettingsFontSize.Normal;
1645                     }
1646                     newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
1647                     AddSystemSettingsFontSizeChanged();
1648                 }
1649                 else
1650                 {
1651                     newFontSizeScale = fontSizeScale;
1652                     RemoveSystemSettingsFontSizeChanged();
1653                 }
1654
1655                 SetInternalFontSizeScale(newFontSizeScale);
1656             }
1657         }
1658
1659         private void SetInternalFontSizeScale(float fontSizeScale)
1660         {
1661
1662             Object.InternalSetPropertyFloat(this.SwigCPtr, TextLabel.Property.FontSizeScale, (float)fontSizeScale);
1663             RequestLayout();
1664         }
1665
1666         /// <summary>
1667         /// The EnableFontSizeScale property.<br />
1668         /// Whether the font size scale is enabled. (The default value is true)
1669         /// </summary>
1670         [EditorBrowsable(EditorBrowsableState.Never)]
1671         public bool EnableFontSizeScale
1672         {
1673             get
1674             {
1675                 return (bool)GetValue(EnableFontSizeScaleProperty);
1676             }
1677             set
1678             {
1679                 SetValue(EnableFontSizeScaleProperty, value);
1680                 NotifyPropertyChanged();
1681             }
1682         }
1683
1684         private TextLabelSelectorData EnsureSelectorData() => selectorData ?? (selectorData = new TextLabelSelectorData());
1685
1686         /// <summary>
1687         /// Downcasts a handle to textLabel handle
1688         /// </summary>
1689         /// <param name="handle"></param>
1690         /// <returns></returns>
1691         /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
1692         /// <since_tizen> 3 </since_tizen>
1693         /// Do not use this, that will be deprecated. Use as keyword instead.
1694         [Obsolete("Do not use this, that will be deprecated. Use as keyword instead. " +
1695             "Like: " +
1696             "BaseHandle handle = new TextLabel(\"Hello World!\"); " +
1697             "TextLabel label = handle as TextLabel")]
1698         [EditorBrowsable(EditorBrowsableState.Never)]
1699         public static TextLabel DownCast(BaseHandle handle)
1700         {
1701             if (null == handle)
1702             {
1703                 throw new ArgumentNullException(nameof(handle));
1704             }
1705             TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel;
1706             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1707             return ret;
1708         }
1709
1710         /// <inheritdoc/>
1711         [EditorBrowsable(EditorBrowsableState.Never)]
1712         protected override void Dispose(DisposeTypes type)
1713         {
1714             if (disposed)
1715             {
1716                 return;
1717             }
1718
1719             internalTextColor?.Dispose();
1720             internalAnchorColor?.Dispose();
1721             internalAnchorClickedColor?.Dispose();
1722
1723             if (hasSystemLanguageChanged)
1724             {
1725                 systemLocaleLanguageChanged.Remove(SystemSettingsLocaleLanguageChanged);
1726             }
1727
1728             RemoveSystemSettingsFontTypeChanged();
1729             RemoveSystemSettingsFontSizeChanged();
1730
1731             if (type == DisposeTypes.Explicit)
1732             {
1733                 //Called by User
1734                 //Release your own managed resources here.
1735                 //You should release all of your own disposable objects here.
1736                 selectorData?.Reset(this);
1737             }
1738
1739             if (this.HasBody())
1740             {
1741                 if (textLabelTextFitChangedCallbackDelegate != null)
1742                 {
1743                     TextFitChangedSignal().Disconnect(textLabelTextFitChangedCallbackDelegate);
1744                 }
1745             }
1746
1747             base.Dispose(type);
1748         }
1749
1750         /// This will not be public opened.
1751         [EditorBrowsable(EditorBrowsableState.Never)]
1752         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1753         {
1754             Interop.TextLabel.DeleteTextLabel(swigCPtr);
1755         }
1756
1757         /// <summary>
1758         /// Get attribues, it is abstract function and must be override.
1759         /// </summary>
1760         [EditorBrowsable(EditorBrowsableState.Never)]
1761         protected override ViewStyle CreateViewStyle()
1762         {
1763             return new TextLabelStyle();
1764         }
1765
1766         internal override LayoutItem CreateDefaultLayout()
1767         {
1768             return new TextLayout();
1769         }
1770
1771         /// <summary>
1772         /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
1773         /// </summary>
1774         protected override void OnBindingContextChanged()
1775         {
1776             base.OnBindingContextChanged();
1777         }
1778
1779         private void SystemSettingsLocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1780         {
1781             Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
1782         }
1783
1784         private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
1785         {
1786             float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
1787             SetInternalFontSizeScale(newFontSizeScale);
1788         }
1789
1790         private void AddSystemSettingsFontSizeChanged()
1791         {
1792             if (hasSystemFontSizeChanged != true)
1793             {
1794                 try
1795                 {
1796                     SystemFontSizeChangedManager.Add(SystemSettingsFontSizeChanged);
1797                     hasSystemFontSizeChanged = true;
1798                 }
1799                 catch (Exception e)
1800                 {
1801                     Console.WriteLine("{0} Exception caught.", e);
1802                     hasSystemFontSizeChanged = false;
1803                 }
1804             }
1805         }
1806
1807         private void RemoveSystemSettingsFontSizeChanged()
1808         {
1809             if (hasSystemFontSizeChanged == true)
1810             {
1811                 try
1812                 {
1813                     SystemFontSizeChangedManager.Remove(SystemSettingsFontSizeChanged);
1814                     hasSystemFontSizeChanged = false;
1815                 }
1816                 catch (Exception e)
1817                 {
1818                     Console.WriteLine("{0} Exception caught.", e);
1819                     hasSystemFontSizeChanged = true;
1820                 }
1821             }
1822         }
1823
1824         private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
1825         {
1826             SetInternalFontFamily(e.Value);
1827         }
1828
1829         private void AddSystemSettingsFontTypeChanged()
1830         {
1831             if (HasStyle() && !hasSystemFontTypeChanged)
1832             {
1833                 try
1834                 {
1835                     systemFontTypeChanged.Add(SystemSettingsFontTypeChanged);
1836                     hasSystemFontTypeChanged = true;
1837                 }
1838                 catch (Exception e)
1839                 {
1840                     Console.WriteLine("{0} Exception caught.", e);
1841                     hasSystemFontTypeChanged = false;
1842                 }
1843             }
1844         }
1845         
1846         private void RemoveSystemSettingsFontTypeChanged()
1847         {
1848             if (hasSystemFontTypeChanged)
1849             {
1850                 try
1851                 {
1852                     systemFontTypeChanged.Remove(SystemSettingsFontTypeChanged);
1853                     hasSystemFontTypeChanged = false;
1854                 }
1855                 catch (Exception e)
1856                 {
1857                     Console.WriteLine("{0} Exception caught.", e);
1858                     hasSystemFontTypeChanged = true;
1859                 }
1860             }
1861         }
1862
1863         private void RequestLayout()
1864         {
1865             Layout?.RequestLayout();
1866         }
1867
1868         internal new class Property
1869         {
1870             internal static readonly int TEXT = Interop.TextLabel.TextGet();
1871             internal static readonly int FontFamily = Interop.TextLabel.FontFamilyGet();
1872             internal static readonly int FontStyle = Interop.TextLabel.FontStyleGet();
1873             internal static readonly int PointSize = Interop.TextLabel.PointSizeGet();
1874             internal static readonly int MultiLine = Interop.TextLabel.MultiLineGet();
1875             internal static readonly int HorizontalAlignment = Interop.TextLabel.HorizontalAlignmentGet();
1876             internal static readonly int VerticalAlignment = Interop.TextLabel.VerticalAlignmentGet();
1877             internal static readonly int TextColor = Interop.TextLabel.TextColorGet();
1878             internal static readonly int EnableMarkup = Interop.TextLabel.EnableMarkupGet();
1879             internal static readonly int EnableAutoScroll = Interop.TextLabel.EnableAutoScrollGet();
1880             internal static readonly int AutoScrollSpeed = Interop.TextLabel.AutoScrollSpeedGet();
1881             internal static readonly int AutoScrollLoopCount = Interop.TextLabel.AutoScrollLoopCountGet();
1882             internal static readonly int AutoScrollGap = Interop.TextLabel.AutoScrollGapGet();
1883             internal static readonly int LineSpacing = Interop.TextLabel.LineSpacingGet();
1884             internal static readonly int RelativeLineHeight = Interop.TextLabel.RelativeLineHeightGet();
1885             internal static readonly int UNDERLINE = Interop.TextLabel.UnderlineGet();
1886             internal static readonly int SHADOW = Interop.TextLabel.ShadowGet();
1887             internal static readonly int EMBOSS = Interop.TextLabel.EmbossGet();
1888             internal static readonly int OUTLINE = Interop.TextLabel.OutlineGet();
1889             internal static readonly int PixelSize = Interop.TextLabel.PixelSizeGet();
1890             internal static readonly int ELLIPSIS = Interop.TextLabel.EllipsisGet();
1891             internal static readonly int AutoScrollStopMode = Interop.TextLabel.AutoScrollStopModeGet();
1892             internal static readonly int AutoScrollLoopDelay = Interop.TextLabel.AutoScrollLoopDelayGet();
1893             internal static readonly int LineCount = Interop.TextLabel.LineCountGet();
1894             internal static readonly int LineWrapMode = Interop.TextLabel.LineWrapModeGet();
1895             internal static readonly int TextDirection = Interop.TextLabel.TextDirectionGet();
1896             internal static readonly int VerticalLineAlignment = Interop.TextLabel.VerticalLineAlignmentGet();
1897             internal static readonly int MatchSystemLanguageDirection = Interop.TextLabel.MatchSystemLanguageDirectionGet();
1898             internal static readonly int TextFit = Interop.TextLabel.TextFitGet();
1899             internal static readonly int MinLineSize = Interop.TextLabel.MinLineSizeGet();
1900             internal static readonly int FontSizeScale = Interop.TextLabel.FontSizeScaleGet();
1901             internal static readonly int EnableFontSizeScale = Interop.TextLabel.EnableFontSizeScaleGet();
1902             internal static readonly int EllipsisPosition = Interop.TextLabel.EllipsisPositionGet();
1903             internal static readonly int Strikethrough = Interop.TextLabel.StrikethroughGet();
1904             internal static readonly int CharacterSpacing = Interop.TextLabel.CharacterSpacingGet();
1905             internal static readonly int AnchorColor = Interop.TextLabel.AnchorColorGet();
1906             internal static readonly int AnchorClickedColor = Interop.TextLabel.AnchorClickedColorGet();
1907
1908
1909             internal static void Preload()
1910             {
1911                 // Do nothing. Just call for load static values.
1912             }
1913         }
1914
1915         private void OnShadowColorChanged(float x, float y, float z, float w)
1916         {
1917             ShadowColor = new Vector4(x, y, z, w);
1918         }
1919         private void OnShadowOffsetChanged(float x, float y)
1920         {
1921             ShadowOffset = new Vector2(x, y);
1922         }
1923         private void OnTextColorChanged(float r, float g, float b, float a)
1924         {
1925             TextColor = new Color(r, g, b, a);
1926         }
1927         private void OnUnderlineColorChanged(float x, float y, float z, float w)
1928         {
1929             UnderlineColor = new Vector4(x, y, z, w);
1930         }
1931         private void OnAnchorColorChanged(float r, float g, float b, float a)
1932         {
1933             AnchorColor = new Color(r, g, b, a);
1934         }
1935         private void OnAnchorClickedColorChanged(float r, float g, float b, float a)
1936         {
1937             AnchorClickedColor = new Color(r, g, b, a);
1938         }
1939     }
1940 }