[NUI] Introduce FONT_VARIATIONS Property (#6772)
authorChihun Jeong <50663828+ANZ1217@users.noreply.github.com>
Tue, 25 Mar 2025 10:03:29 +0000 (19:03 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 27 Mar 2025 00:43:29 +0000 (09:43 +0900)
* [NUI] Introduce FONT_VARIATIONS Property

* Edit comments and remove Bindable Property.

* Add new function SetProperty(int, float) to modify font variations

* Modify SetProperty function of TextEditor

* Adjust API

* Change SetProperty to InternalSetPropertyFloat

---------

Co-authored-by: ANZ1217 <chihun.jeong@samsung.com>
src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs
src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs
src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
src/Tizen.NUI/src/public/BaseComponents/TextField.cs
src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs

index 6ef685e90fe02943686d25d3d771f35d936d7d9e..acdf156697297ccf8bede5b14881103cfad18fce 100755 (executable)
@@ -343,6 +343,10 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_REMOVE_BACK_INSET_get")]
             public static extern int RemoveBackInsetGet();
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_FONT_VARIATIONS_get")]
+            public static extern int FontVariationsGet();
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_RegisterFontVariationProperty")]
+            public static extern int RegisterFontVariationProperty(global::System.Runtime.InteropServices.HandleRef textEditorRef, string pTag);
         }
     }
 }
index 41279f8f6b1a8364d6af3b804943938ae9e236ee..17e8b74a2d5f1e2b5807988a1e9779919daa2a56 100755 (executable)
@@ -305,6 +305,10 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_Property_REMOVE_BACK_INSET_get")]
             public static extern int RemoveBackInsetGet();
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_Property_FONT_VARIATIONS_get")]
+            public static extern int FontVariationsGet();
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_RegisterFontVariationProperty")]
+            public static extern int RegisterFontVariationProperty(global::System.Runtime.InteropServices.HandleRef textFieldRef, string pTag);
         }
     }
 }
index dc45094c5b9e2c58bc698dbf5d63394d14d410a3..f2546eee62f5f0d359f563b11139dcb96655f6eb 100755 (executable)
@@ -208,6 +208,8 @@ namespace Tizen.NUI
 
             [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_Property_ASYNC_LINE_COUNT_get")]
             public static extern int AsyncLineCountGet();
+            [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_Property_FONT_VARIATIONS_get")]
+            public static extern int FontVariationsGet();
 
             [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_RequestAsyncRenderWithFixedSize")]
             public static extern void RequestAsyncRenderWithFixedSize(HandleRef textLabelRef, float width, float height);
@@ -241,6 +243,8 @@ namespace Tizen.NUI
 
             [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_AsyncHeightForWidthComputedSignal_Disconnect")]
             public static extern void AsyncHeightForWidthComputedDisconnect(HandleRef textLabelRef, HandleRef handler);
+            [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_RegisterFontVariationProperty")]
+            public static extern int RegisterFontVariationProperty(HandleRef textLabelRef, string pTag);
         }
     }
 }
index 102ede9025d13d2379210d61ca082edf17d7af33..10ec4a106836330693e3a48c7181a2bc9050b292 100755 (executable)
@@ -260,6 +260,21 @@ namespace Tizen.NUI.BaseComponents
             return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
         }
 
+        /// <summary>
+        /// Registers FontVariationsProperty with string tag.
+        /// </summary>
+        /// <param name="tag">The tag of font variations.</param>
+        /// <remarks>
+        /// The returned index can be used with animation.
+        /// </remarks>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public int RegisterFontVariationProperty(string tag)
+        {
+            int index = Interop.TextEditor.RegisterFontVariationProperty(SwigCPtr, tag);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return index;
+        }
+
         /// <summary>
         /// The TranslatableText property.<br />
         /// The text can set the SID value.<br />
@@ -5047,6 +5062,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int CharacterSpacing = Interop.TextEditor.CharacterSpacingGet();
             internal static readonly int RemoveFrontInset = Interop.TextEditor.RemoveFrontInsetGet();
             internal static readonly int RemoveBackInset = Interop.TextEditor.RemoveBackInsetGet();
+            internal static readonly int FontVariations = Interop.TextEditor.FontVariationsGet();
 
             internal static void Preload()
             {
@@ -5103,6 +5119,15 @@ namespace Tizen.NUI.BaseComponents
         {
             GrabHandleColor = new Color(r, g, b, a);
         }
+        public void SetFontVariation(string axis, float value)
+        {
+            int index = RegisterFontVariationProperty(axis);
+            Object.InternalSetPropertyFloat(SwigCPtr, index, value);
+        }
+        public void SetFontVariation(int index, float value)
+        {
+            Object.InternalSetPropertyFloat(SwigCPtr, index, value);
+        }
 
         internal class TextEditorLayout : LayoutItem
         {
index 531fb9c8a71884e027239576adfa641b17064b6f..97ea6cca8ac413c59cc7596f69f31478200cf220 100755 (executable)
@@ -332,6 +332,21 @@ namespace Tizen.NUI.BaseComponents
             return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
         }
 
+        /// <summary>
+        /// Registers FontVariationsProperty with string tag.
+        /// </summary>
+        /// <param name="tag">The tag of font variations.</param>
+        /// <remarks>
+        /// The returned index can be used with animation.
+        /// </remarks>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public int RegisterFontVariationProperty(string tag)
+        {
+            int index = Interop.TextField.RegisterFontVariationProperty(SwigCPtr, tag);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return index;
+        }
+
         /// <summary>
         /// The TranslatableText property.<br />
         /// The text can set the SID value.<br />
@@ -4991,6 +5006,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int CharacterSpacing = Interop.TextField.CharacterSpacingGet();
             internal static readonly int RemoveFrontInset = Interop.TextField.RemoveFrontInsetGet();
             internal static readonly int RemoveBackInset = Interop.TextField.RemoveBackInsetGet();
+            internal static readonly int FontVariations = Interop.TextField.FontVariationsGet();
 
             internal static void Preload()
             {
@@ -5054,6 +5070,15 @@ namespace Tizen.NUI.BaseComponents
         {
             GrabHandleColor = new Color(r, g, b, a);
         }
+        public void SetFontVariation(string axis, float value)
+        {
+            int index = RegisterFontVariationProperty(axis);
+            Object.InternalSetPropertyFloat(SwigCPtr, index, value);
+        }
+        public void SetFontVariation(int index, float value)
+        {
+            Object.InternalSetPropertyFloat(SwigCPtr, index, value);
+        }
 
         internal class TextFieldLayout : LayoutItem
         {
index ec605e453f1ba2fe9c633a12cc9e60b6072d180b..6ab4a99835100aecff258e54381b380af1f700b7 100755 (executable)
@@ -411,6 +411,21 @@ namespace Tizen.NUI.BaseComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
+        /// <summary>
+        /// Registers FontVariationsProperty with string tag.
+        /// </summary>
+        /// <param name="tag">The tag of font variations.</param>
+        /// <remarks>
+        /// The returned index can be used with animation.
+        /// </remarks>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public int RegisterFontVariationProperty(string tag)
+        {
+            int index = Interop.TextLabel.RegisterFontVariationProperty(SwigCPtr, tag);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return index;
+        }
+
         /// <summary>
         /// The TranslatableText property.<br />
         /// The text can set the SID value.<br />
@@ -3535,6 +3550,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int RenderMode = Interop.TextLabel.RenderModeGet();
             internal static readonly int ManualRendered = Interop.TextLabel.ManualRenderedGet();
             internal static readonly int AsyncLineCount = Interop.TextLabel.AsyncLineCountGet();
+            internal static readonly int FontVariations = Interop.TextLabel.FontVariationsGet();
             internal static readonly int EllipsisMode = Interop.TextLabel.EllipsisModeGet();
             internal static readonly int IsScrolling = Interop.TextLabel.IsScrollingGet();
 
@@ -3569,5 +3585,14 @@ namespace Tizen.NUI.BaseComponents
         {
             AnchorClickedColor = new Color(r, g, b, a);
         }
+        public void SetFontVariation(string axis, float value)
+        {
+            int index = RegisterFontVariationProperty(axis);
+            Object.InternalSetPropertyFloat(SwigCPtr, index, value);
+        }
+        public void SetFontVariation(int index, float value)
+        {
+            Object.InternalSetPropertyFloat(SwigCPtr, index, value);
+        }
     }
 }