From 1a950a23a0d4656cb471499e3c33d515ff10ac8b Mon Sep 17 00:00:00 2001 From: Elvin Thudugala Date: Wed, 21 Aug 2019 12:27:02 +1200 Subject: [PATCH] added span support and Unicode UTF32 support --- Source/Plugin.Glypher/FontGlyph.cs | 5 +++++ Source/Plugin.Glypher/GlyphInfo.cs | 17 ++++++++++++++--- Source/Plugin.Glypher/Plugin.Glypher.csproj | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Source/Plugin.Glypher/FontGlyph.cs b/Source/Plugin.Glypher/FontGlyph.cs index 47d8442..4d161b4 100644 --- a/Source/Plugin.Glypher/FontGlyph.cs +++ b/Source/Plugin.Glypher/FontGlyph.cs @@ -55,6 +55,11 @@ private static void SetControl(BindableObject bindable, GlyphInfo newGlyphInfo) label.Text = newGlyphInfo?.Glyph; break; + case Span span: + span.FontFamily = newGlyphInfo?.FontFamily; + span.Text = newGlyphInfo?.Glyph; + break; + case Button button: button.FontFamily = newGlyphInfo?.FontFamily; button.Text = newGlyphInfo?.Glyph; diff --git a/Source/Plugin.Glypher/GlyphInfo.cs b/Source/Plugin.Glypher/GlyphInfo.cs index 5c1802c..bbe8107 100644 --- a/Source/Plugin.Glypher/GlyphInfo.cs +++ b/Source/Plugin.Glypher/GlyphInfo.cs @@ -4,25 +4,36 @@ namespace Plugin.Glypher { /// - /// Font Image representation. + /// Font Image representation. /// [DebuggerDisplay("Name={Name}")] [TypeConverter(typeof(GlyphInfoTypeConverter))] public class GlyphInfo { + private string _glyph; + /// /// Font Family. /// public string FontFamily { get; set; } - + /// /// Glyph /// - public string Glyph { get; set; } + public string Glyph + { + get => UnicodeNumber.HasValue ? char.ConvertFromUtf32(UnicodeNumber.Value) : _glyph; + set => _glyph = value; + } /// /// Glyph Name /// public string Name { get; set; } + + /// + /// Unicode Number + /// + public int? UnicodeNumber { get; set; } } } \ No newline at end of file diff --git a/Source/Plugin.Glypher/Plugin.Glypher.csproj b/Source/Plugin.Glypher/Plugin.Glypher.csproj index 67fb447..b21d2aa 100644 --- a/Source/Plugin.Glypher/Plugin.Glypher.csproj +++ b/Source/Plugin.Glypher/Plugin.Glypher.csproj @@ -20,7 +20,7 @@ This plugin extend support for font-glyphs (font-icons) in Xamarin.Forms applications. https://raw.githubusercontent.com/thudugala/Plugin.Glypher/master/screenshots/icon.png Copyright © Elvin (Tharindu) Thudugala - 1.0.0 + 1.1.0 Check: https://github.com/thudugala/Plugin.Glypher/releases ththlk