From: Bowon Ryu Date: Thu, 25 May 2023 05:09:30 +0000 (+0900) Subject: [NUI] Add font thread sync creation option X-Git-Tag: accepted/tizen/unified/20231205.024657~301 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f8e74ad1462064258aa185672855fffcd5d7ce71;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Add font thread sync creation option If sync creation is true, font thread creation guarantees syncronization with the main thread. The main thread runs the font thread and waits, and it wakes up upon receiving a notification from the font thread. If it doesn't receive a notification within the specified time, it wakes up due to a timeout. Signed-off-by: Bowon Ryu --- diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.FontClient.cs b/src/Tizen.NUI/src/internal/Interop/Interop.FontClient.cs index 279ff95..1f3970b 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.FontClient.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.FontClient.cs @@ -23,10 +23,10 @@ namespace Tizen.NUI { //for FontClient [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FontClient_PreCache")] - public static extern void PreCache(string[] fallbackFamilyArray, int fallbackFamilySize, string[] extraFamilyArray, int extraFamilySize, string localeFamily, bool useThread); + public static extern void PreCache(string[] fallbackFamilyArray, int fallbackFamilySize, string[] extraFamilyArray, int extraFamilySize, string localeFamily, bool useThread, bool syncCreation); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FontClient_FontPreLoad")] - public static extern void FontPreLoad(string[] fontPathArray, int fontPathSize, string[] memoryFontPathArray, int memoryFontPathSize, bool useThread); + public static extern void FontPreLoad(string[] fontPathArray, int fontPathSize, string[] memoryFontPathArray, int memoryFontPathSize, bool useThread, bool syncCreation); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FontClient_DEFAULT_POINT_SIZE_get")] public static extern uint DefaultPointSizeGet(); diff --git a/src/Tizen.NUI/src/public/Utility/FontClient.cs b/src/Tizen.NUI/src/public/Utility/FontClient.cs index 2f77e04..81a6642 100755 --- a/src/Tizen.NUI/src/public/Utility/FontClient.cs +++ b/src/Tizen.NUI/src/public/Utility/FontClient.cs @@ -72,15 +72,16 @@ namespace Tizen.NUI /// A list of additional font families to be pre-cached. /// A locale font family to be pre-cached. /// True if the font client should create thread and perform pre-caching, false otherwise. + /// True if thread creation guarantees syncronization with the main thread, false async creation. Optional, the default value is true. [EditorBrowsable(EditorBrowsableState.Never)] - public static void PreCache(List fallbackFamilyList, List extraFamilyList, string localeFamily, bool useThread) + public static void PreCache(List fallbackFamilyList, List extraFamilyList, string localeFamily, bool useThread, bool syncCreation = true) { int fallbackFamilySize = fallbackFamilyList?.Count ?? 0; int extraFamilySize = extraFamilyList?.Count ?? 0; string[] fallbackFamilyArray = fallbackFamilySize > 0 ? fallbackFamilyList.ToArray() : null; string[] extraFamilyArray = extraFamilySize > 0 ? extraFamilyList.ToArray() : null; - Interop.FontClient.PreCache(fallbackFamilyArray, fallbackFamilySize, extraFamilyArray, extraFamilySize, localeFamily, useThread); + Interop.FontClient.PreCache(fallbackFamilyArray, fallbackFamilySize, extraFamilyArray, extraFamilySize, localeFamily, useThread, syncCreation); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -95,16 +96,17 @@ namespace Tizen.NUI /// /// A list of font paths to be pre-loaded. /// A list of memory font paths to be pre-loaded. - /// if the font client should create thread and perform font pre-loading, false otherwise. + /// True if the font client should create thread and perform font pre-loading, false otherwise. + /// True if thread creation guarantees syncronization with the main thread, false async creation. Optional, the default value is true. [EditorBrowsable(EditorBrowsableState.Never)] - public static void FontPreLoad(List fontPathList, List memoryFontPathList, bool useThread) + public static void FontPreLoad(List fontPathList, List memoryFontPathList, bool useThread, bool syncCreation = true) { int fontPathSize = fontPathList?.Count ?? 0; int memoryFontPathSize = memoryFontPathList?.Count ?? 0; string[] fontPathArray = fontPathSize > 0 ? fontPathList.ToArray() : null; string[] memoryFontPathArray = memoryFontPathSize > 0 ? memoryFontPathList.ToArray() : null; - Interop.FontClient.FontPreLoad(fontPathArray, fontPathSize, memoryFontPathArray, memoryFontPathSize, useThread); + Interop.FontClient.FontPreLoad(fontPathArray, fontPathSize, memoryFontPathArray, memoryFontPathSize, useThread, syncCreation); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); }