public static extern void GetDefaultPlatformFontDescription(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FontClient_GetSystemFonts")]
- public static extern void GetSystemFonts(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+ public static extern global::System.IntPtr GetSystemFonts(global::System.Runtime.InteropServices.HandleRef fontClient);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FontClient_GetDescription")]
public static extern void GetDescription(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3);
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => (LeftImageUrl, RightImageUrl).GetHashCode();
}
+
+ /// <summary>
+ /// A struct to pass data of FontInfo PropertyMap.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public struct FontInfo : IEquatable<FontInfo>
+ {
+ /// <summary>
+ /// The FontFamily of the font.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Family { get; set; }
+
+ /// <summary>
+ /// The FontPath of the font.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Path { get; set; }
+
+ /// <summary>
+ /// The FontStyle of the font.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public FontStyle Style { get; set; }
+
+ /// <summary>
+ /// Determines whether the specified object is equal to the current object.
+ /// </summary>
+ /// <param name="obj">The object to compare with the current object.</param>
+ /// <returns>true if equal FontInfo, else false.</returns>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is FontInfo other && this.Equals(other);
+
+ /// <summary>
+ /// Determines whether the specified object is equal to the current object.
+ /// </summary>
+ /// <param name="other">The FontInfo to compare with the current FontInfo.</param>
+ /// <returns>true if equal FontInfo, else false.</returns>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Equals(FontInfo other) => Family == other.Family && Path == other.Path && Style == other.Style;
+
+ /// <summary>
+ /// The == operator.
+ /// </summary>
+ /// <param name="lhsFontInfo">FontInfo to compare</param>
+ /// <param name="rhsFontInfo">FontInfo to be compared</param>
+ /// <returns>true if FontInfos are equal</returns>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static bool operator ==(FontInfo lhsFontInfo, FontInfo rhsFontInfo) => lhsFontInfo.Equals(rhsFontInfo);
+
+ /// <summary>
+ /// The != operator.
+ /// </summary>
+ /// <param name="lhsFontInfo">FontInfo to compare</param>
+ /// <param name="rhsFontInfo">FontInfo to be compared</param>
+ /// <returns>true if FontInfos are not equal</returns>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static bool operator !=(FontInfo lhsFontInfo, FontInfo rhsFontInfo) => !lhsFontInfo.Equals(rhsFontInfo);
+
+ /// <summary>
+ /// Gets the hash code of this FontInfo.
+ /// </summary>
+ /// <returns>The hash code.</returns>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => (Family, Path, Style).GetHashCode();
+ }
}
using TizenSystemSettings.Tizen.System;
using System;
using System.ComponentModel;
+using System.Collections.Generic;
+using Tizen.NUI.Text;
namespace Tizen.NUI.BaseComponents
{
return ret;
}
+ /// <summary>
+ /// This method converts a FontInfo property array to a list and returns it.
+ /// <param name="fontArray">The FontInfo PropertyArray.</param>
+ /// <returns> A list of FontInfo struct. </returns>
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static List<FontInfo> GetFontInfoList(PropertyArray fontArray)
+ {
+ var fontList = new List<FontInfo>();
+ if (fontArray != null)
+ {
+ for (uint i = 0 ; i < fontArray.Count(); i ++)
+ {
+ using (var fontInfoMap = new PropertyMap())
+ using (var propertyValue = fontArray[i])
+ {
+ propertyValue.Get(fontInfoMap);
+
+ if (fontInfoMap.Count() > 0)
+ {
+ var fontInfo = new FontInfo();
+ fontInfo.Family = TextMapHelper.GetStringFromMap(fontInfoMap, "family", "TizenSans");
+ fontInfo.Path = TextMapHelper.GetStringFromMap(fontInfoMap, "path", "");
+ fontInfo.Style = new FontStyle()
+ {
+ Width = (FontWidthType)TextMapHelper.GetIntFromMap(fontInfoMap, "width", 0),
+ Weight = (FontWeightType)TextMapHelper.GetIntFromMap(fontInfoMap, "weight", 0),
+ Slant = (FontSlantType)TextMapHelper.GetIntFromMap(fontInfoMap, "slant", 0),
+ };
+ fontList.Add(fontInfo);
+ }
+ }
+ }
+ }
+ return fontList;
+ }
+
#if PROFILE_TV
private const float FontSizeScaleSmall = 0.8f;
private const float FontSizeScaleNormal = 1.0f;
*
*/
using System.ComponentModel;
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Text;
namespace Tizen.NUI
{
return ret;
}
+ /// <summary>
+ /// Retrieve the list of font info supported by the system.
+ /// </summary>
+ /// <returns>The list of FontInfo</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.FontInfo"/>
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the GetSystemFonts method.
+ /// <code>
+ /// var fontList = FontClient.Instance.GetSystemFonts();
+ /// foreach(Tizen.NUI.Text.FontInfo fontInfo in fontList)
+ /// {
+ /// string fontFamily = fontInfo.Family;
+ /// string fontPath = fontInfo.Path;
+ /// FontWidthType fontWidth = fontInfo.Style.Width;
+ /// FontWeightType fontWeight = fontInfo.Style.Weight;
+ /// FontSlantType fontSlant = fontInfo.Style.Slant;
+ /// }
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public List<FontInfo> GetSystemFonts()
+ {
+ using PropertyArray fontArray = new PropertyArray(Interop.FontClient.GetSystemFonts(SwigCPtr), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ List<FontInfo> fontInfoList;
+ fontInfoList = TextUtils.GetFontInfoList(fontArray);
+ return fontInfoList;
+ }
+
internal static FontClient Get()
{
FontClient ret = new FontClient(Interop.FontClient.Get(), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal void GetSystemFonts(SWIGTYPE_p_std__vectorT_Dali__TextAbstraction__FontDescription_t systemFonts)
- {
- Interop.FontClient.GetSystemFonts(SwigCPtr, SWIGTYPE_p_std__vectorT_Dali__TextAbstraction__FontDescription_t.getCPtr(systemFonts));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
-
internal void GetDescription(uint id, FontDescription fontDescription)
{
Interop.FontClient.GetDescription(SwigCPtr, id, FontDescription.getCPtr(fontDescription));