diff options
author | Kangho Hur <kangho.hur@samsung.com> | 2017-01-04 01:04:57 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.vlan103.tizen.org> | 2017-01-04 01:04:57 -0800 |
commit | 3e252c25c283b154ca5f383051aeaec07a456ad8 (patch) | |
tree | 6d193628ac96010543ffa38068f98bc67564b581 | |
parent | d3c61a8c72daa733aeef5f4446a5b33450df9184 (diff) | |
parent | c2093d3246ccede000546b071d4e5d1aebf3f968 (diff) | |
download | xamarin-forms-3e252c25c283b154ca5f383051aeaec07a456ad8.tar.gz xamarin-forms-3e252c25c283b154ca5f383051aeaec07a456ad8.tar.bz2 xamarin-forms-3e252c25c283b154ca5f383051aeaec07a456ad8.zip |
Merge "Support Density Independent Pixel on FontSize" into tizen
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Forms.cs | 13 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Native/Span.cs | 2 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs | 8 |
3 files changed, 17 insertions, 6 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Forms.cs b/Xamarin.Forms.Platform.Tizen/Forms.cs index 34828a41..453bab82 100644 --- a/Xamarin.Forms.Platform.Tizen/Forms.cs +++ b/Xamarin.Forms.Platform.Tizen/Forms.cs @@ -11,6 +11,12 @@ namespace Xamarin.Forms.Platform.Tizen { public static class Forms { + static Lazy<int> s_dpi = new Lazy<int>(() => + { + int dpi = 0; + TSystemInfo.TryGetValue<int>("http://tizen.org/feature/screen.dpi", out dpi); + return dpi; + }); class TizenDeviceInfo : DeviceInfo { readonly Size pixelScreenSize; @@ -178,6 +184,11 @@ namespace Xamarin.Forms.Platform.Tizen // TODO: implement me return Color.Black; } + + internal static int ConvertToPixel(double dp) + { + return (int)Math.Round(dp * s_dpi.Value / 160.0); + } } class TizenExpressionSearch : ExpressionVisitor, IExpressionSearch @@ -206,4 +217,4 @@ namespace Xamarin.Forms.Platform.Tizen return base.VisitMember(node); } } -}
\ No newline at end of file +} diff --git a/Xamarin.Forms.Platform.Tizen/Native/Span.cs b/Xamarin.Forms.Platform.Tizen/Native/Span.cs index 7ac4134f..0e3f0000 100644 --- a/Xamarin.Forms.Platform.Tizen/Native/Span.cs +++ b/Xamarin.Forms.Platform.Tizen/Native/Span.cs @@ -175,7 +175,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native if (FontSize != -1) { - _formattingString.AppendFormat("font_size={0} ", FontSize); + _formattingString.AppendFormat("font_size={0} ", Forms.ConvertToPixel(FontSize)); } if ((FontAttributes & FontAttributes.Bold) != 0) diff --git a/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs b/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs index 7d442318..db7ee1de 100644 --- a/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs +++ b/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs @@ -82,14 +82,14 @@ namespace Xamarin.Forms.Platform.Tizen switch (size) { case NamedSize.Micro: - return 16; + return 10; case NamedSize.Small: - return 20; + return 12; case NamedSize.Default: case NamedSize.Medium: - return 24; + return 14; case NamedSize.Large: - return 30; + return 18; default: throw new ArgumentOutOfRangeException(); } |