summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/Native
diff options
context:
space:
mode:
authorKangho Hur <kangho.hur@samsung.com>2017-01-24 14:09:11 +0900
committerKangho Hur <kangho.hur@samsung.com>2017-07-10 11:11:18 +0900
commitc77de371139ff9df3202f40727534e93fb13a809 (patch)
treef30c91a488e8a3ee7f855acbd79c95176e38ce8d /Xamarin.Forms.Platform.Tizen/Native
parentf65fa0d4b5f601295ab87b1cc82b1c6b0ee1ed29 (diff)
downloadxamarin-forms-c77de371139ff9df3202f40727534e93fb13a809.tar.gz
xamarin-forms-c77de371139ff9df3202f40727534e93fb13a809.tar.bz2
xamarin-forms-c77de371139ff9df3202f40727534e93fb13a809.zip
Add FontWeight for Label and Entry
- This change is for the referernce application (Clock) to follow UX guideline. (Internal only). - We will improve design and implementation of this APIs in the next release, if requred. Change-Id: Ifac91174a5859adecc9ec6bff1a1d568512ee70b
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Native')
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/Entry.cs26
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/FontWeight.cs21
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/Label.cs21
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/Span.cs47
4 files changed, 114 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Entry.cs b/Xamarin.Forms.Platform.Tizen/Native/Entry.cs
index 808155c5..003a298b 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/Entry.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Entry.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using ElmSharp;
using EEntry = ElmSharp.Entry;
using EColor = ElmSharp.Color;
@@ -180,6 +180,30 @@ namespace Xamarin.Forms.Platform.Tizen.Native
}
/// <summary>
+ /// Gets or sets the font weight for the text.
+ /// </summary>
+ /// <value>The weight of the font.</value>
+ public FontWeight FontWeight
+ {
+ get
+ {
+ return _span.FontWeight;
+ }
+
+ set
+ {
+ if (value != _span.FontWeight)
+ {
+ _span.FontWeight = value;
+ ApplyTextAndStyle();
+
+ _placeholderSpan.FontWeight = value;
+ ApplyPlaceholderAndStyle();
+ }
+ }
+ }
+
+ /// <summary>
/// Gets or sets the horizontal text alignment of both text and placeholder.
/// </summary>
/// <value>The horizontal text alignment of both text and placeholder.</value>
diff --git a/Xamarin.Forms.Platform.Tizen/Native/FontWeight.cs b/Xamarin.Forms.Platform.Tizen/Native/FontWeight.cs
new file mode 100644
index 00000000..90bb6370
--- /dev/null
+++ b/Xamarin.Forms.Platform.Tizen/Native/FontWeight.cs
@@ -0,0 +1,21 @@
+namespace Xamarin.Forms.Platform.Tizen.Native
+{
+ /// <summary>
+ /// Enumerates values that describe options for line braking.
+ /// </summary>
+ public enum FontWeight
+ {
+ None,
+ Normal,
+ Thin,
+ UltraLight,
+ Light,
+ Book,
+ Medium,
+ SemiBold,
+ Bold,
+ UltraBold,
+ Black,
+ ExtraBlack
+ }
+}
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Label.cs b/Xamarin.Forms.Platform.Tizen/Native/Label.cs
index 9d52cde2..231127c2 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/Label.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Label.cs
@@ -175,6 +175,27 @@ namespace Xamarin.Forms.Platform.Tizen.Native
}
/// <summary>
+ /// Gets or sets the font weight for the text.
+ /// </summary>
+ /// <value>The weight of the font.</value>
+ public FontWeight FontWeight
+ {
+ get
+ {
+ return _span.FontWeight;
+ }
+
+ set
+ {
+ if (value != _span.FontWeight)
+ {
+ _span.FontWeight = value;
+ ApplyTextAndStyle();
+ }
+ }
+ }
+
+ /// <summary>
/// Gets or sets the line wrap option.
/// </summary>
/// <value>The line break mode.</value>
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Span.cs b/Xamarin.Forms.Platform.Tizen/Native/Span.cs
index 4a5daf3c..028e9db9 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/Span.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Span.cs
@@ -77,6 +77,11 @@ namespace Xamarin.Forms.Platform.Tizen.Native
public double FontSize { get; set; }
/// <summary>
+ /// Gets or sets the font weight for the text.
+ /// </summary>
+ public FontWeight FontWeight { get; set; }
+
+ /// <summary>
/// Gets or sets the line break mode for the text.
/// See <see cref="LineBreakMode"/> for information about LineBreakMode.
/// </summary>
@@ -112,6 +117,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
Text = "";
FontFamily = "";
FontSize = -1;
+ FontWeight = FontWeight.None;
FontAttributes = FontAttributes.None;
ForegroundColor = EColor.Default;
BackgroundColor = EColor.Default;
@@ -183,6 +189,47 @@ namespace Xamarin.Forms.Platform.Tizen.Native
{
_formattingString.Append("font_weight=Bold ");
}
+ else
+ {
+ // FontWeight is only available in case of FontAttributes.Bold is not used.
+ switch (FontWeight)
+ {
+ case FontWeight.Bold:
+ _formattingString.Append("font_weight=Bold ");
+ break;
+ case FontWeight.SemiBold:
+ _formattingString.Append("font_weight=SemiBold ");
+ break;
+ case FontWeight.UltraBold:
+ _formattingString.Append("font_weight=UltraBold ");
+ break;
+ case FontWeight.Black:
+ _formattingString.Append("font_weight=Black ");
+ break;
+ case FontWeight.ExtraBlack:
+ _formattingString.Append("font_weight=ExtraBlack ");
+ break;
+ case FontWeight.Book:
+ _formattingString.Append("font_weight=Book ");
+ break;
+ case FontWeight.Light:
+ _formattingString.Append("font_weight=Light ");
+ break;
+ case FontWeight.Medium:
+ _formattingString.Append("font_weight=Medium ");
+ break;
+ case FontWeight.Normal:
+ _formattingString.Append("font_weight=Normal ");
+ break;
+ case FontWeight.Thin:
+ _formattingString.Append("font_weight=Thin ");
+ break;
+ case FontWeight.UltraLight:
+ _formattingString.Append("font_weight=UltraLight ");
+ break;
+ }
+ }
+
if ((FontAttributes & FontAttributes.Italic) != 0)
{
_formattingString.Append("font_style=italic ");