Create global settings for font fallback

This commit is contained in:
ExMatics HydrogenC
2023-12-02 17:48:51 +08:00
parent 95f5e31e48
commit 29eb3954c5
10 changed files with 122 additions and 64 deletions
+18 -18
View File
@@ -10,7 +10,7 @@
#include "TextLayoutOptions.h"
class FontAsset;
class FallbackFonts;
class FontFallbackList;
struct FontTextureAtlasSlot;
struct BlockedTextLineCache;
@@ -463,7 +463,7 @@ public:
/// <param name="text">The input text.</param>
/// <param name="layout">The layout properties.</param>
/// <param name="outputLines">The output lines list.</param>
void ProcessText(FallbackFonts* fallbacks, const StringView& text, Array<BlockedTextLineCache>& outputLines, API_PARAM(Ref) const TextLayoutOptions& layout);
void ProcessText(FontFallbackList* fallbacks, const StringView& text, Array<BlockedTextLineCache>& outputLines, API_PARAM(Ref) const TextLayoutOptions& layout);
/// <summary>
/// Processes text to get cached lines for rendering.
@@ -471,7 +471,7 @@ public:
/// <param name="text">The input text.</param>
/// <param name="layout">The layout properties.</param>
/// <returns>The output lines list.</returns>
API_FUNCTION() Array<BlockedTextLineCache> ProcessText(FallbackFonts* fallbacks, const StringView& text, API_PARAM(Ref) const TextLayoutOptions& layout)
API_FUNCTION() Array<BlockedTextLineCache> ProcessText(FontFallbackList* fallbacks, const StringView& text, API_PARAM(Ref) const TextLayoutOptions& layout)
{
Array<BlockedTextLineCache> lines;
ProcessText(fallbacks, text, lines, layout);
@@ -485,7 +485,7 @@ public:
/// <param name="textRange">The input text range (substring range of the input text parameter).</param>
/// <param name="layout">The layout properties.</param>
/// <returns>The output lines list.</returns>
API_FUNCTION() Array<BlockedTextLineCache> ProcessText(FallbackFonts* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, API_PARAM(Ref) const TextLayoutOptions& layout)
API_FUNCTION() Array<BlockedTextLineCache> ProcessText(FontFallbackList* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, API_PARAM(Ref) const TextLayoutOptions& layout)
{
Array<BlockedTextLineCache> lines;
ProcessText(fallbacks, textRange.Substring(text), lines, layout);
@@ -497,7 +497,7 @@ public:
/// </summary>
/// <param name="text">The input text.</param>
/// <returns>The output lines list.</returns>
API_FUNCTION() FORCE_INLINE Array<BlockedTextLineCache> ProcessText(FallbackFonts* fallbacks, const StringView& text)
API_FUNCTION() FORCE_INLINE Array<BlockedTextLineCache> ProcessText(FontFallbackList* fallbacks, const StringView& text)
{
return ProcessText(fallbacks, text, TextLayoutOptions());
}
@@ -508,7 +508,7 @@ public:
/// <param name="text">The input text.</param>
/// <param name="textRange">The input text range (substring range of the input text parameter).</param>
/// <returns>The output lines list.</returns>
API_FUNCTION() FORCE_INLINE Array<BlockedTextLineCache> ProcessText(FallbackFonts* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange)
API_FUNCTION() FORCE_INLINE Array<BlockedTextLineCache> ProcessText(FontFallbackList* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange)
{
return ProcessText(fallbacks, textRange.Substring(text), TextLayoutOptions());
}
@@ -560,7 +560,7 @@ public:
/// <param name="text">The input text to test.</param>
/// <param name="layout">The layout properties.</param>
/// <returns>The minimum size for that text and fot to render properly.</returns>
API_FUNCTION() Float2 MeasureText(FallbackFonts* fallbacks, const StringView& text, API_PARAM(Ref) const TextLayoutOptions& layout);
API_FUNCTION() Float2 MeasureText(FontFallbackList* fallbacks, const StringView& text, API_PARAM(Ref) const TextLayoutOptions& layout);
/// <summary>
/// Measures minimum size of the rectangle that will be needed to draw given text.
@@ -569,7 +569,7 @@ public:
/// <param name="textRange">The input text range (substring range of the input text parameter).</param>
/// <param name="layout">The layout properties.</param>
/// <returns>The minimum size for that text and fot to render properly.</returns>
API_FUNCTION() Float2 MeasureText(FallbackFonts* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, API_PARAM(Ref) const TextLayoutOptions& layout)
API_FUNCTION() Float2 MeasureText(FontFallbackList* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, API_PARAM(Ref) const TextLayoutOptions& layout)
{
return MeasureText(fallbacks, textRange.Substring(text), layout);
}
@@ -579,7 +579,7 @@ public:
/// </summary>.
/// <param name="text">The input text to test.</param>
/// <returns>The minimum size for that text and fot to render properly.</returns>
API_FUNCTION() FORCE_INLINE Float2 MeasureText(FallbackFonts* fallbacks, const StringView& text)
API_FUNCTION() FORCE_INLINE Float2 MeasureText(FontFallbackList* fallbacks, const StringView& text)
{
return MeasureText(fallbacks, text, TextLayoutOptions());
}
@@ -590,7 +590,7 @@ public:
/// <param name="text">The input text to test.</param>
/// <param name="textRange">The input text range (substring range of the input text parameter).</param>
/// <returns>The minimum size for that text and fot to render properly.</returns>
API_FUNCTION() FORCE_INLINE Float2 MeasureText(FallbackFonts* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange)
API_FUNCTION() FORCE_INLINE Float2 MeasureText(FontFallbackList* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange)
{
return MeasureText(fallbacks, textRange.Substring(text), TextLayoutOptions());
}
@@ -647,7 +647,7 @@ public:
/// <param name="location">The input location to test.</param>
/// <param name="layout">The text layout properties.</param>
/// <returns>The selected character position index (can be equal to text length if location is outside of the layout rectangle).</returns>
API_FUNCTION() int32 HitTestText(FallbackFonts* fallbacks, const StringView& text, const Float2& location, API_PARAM(Ref) const TextLayoutOptions& layout);
API_FUNCTION() int32 HitTestText(FontFallbackList* fallbacks, const StringView& text, const Float2& location, API_PARAM(Ref) const TextLayoutOptions& layout);
/// <summary>
/// Calculates hit character index at given location.
@@ -657,7 +657,7 @@ public:
/// <param name="location">The input location to test.</param>
/// <param name="layout">The text layout properties.</param>
/// <returns>The selected character position index (can be equal to text length if location is outside of the layout rectangle).</returns>
API_FUNCTION() int32 HitTestText(FallbackFonts* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, const Float2& location, API_PARAM(Ref) const TextLayoutOptions& layout)
API_FUNCTION() int32 HitTestText(FontFallbackList* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, const Float2& location, API_PARAM(Ref) const TextLayoutOptions& layout)
{
return HitTestText(fallbacks, textRange.Substring(text), location, layout);
}
@@ -668,7 +668,7 @@ public:
/// <param name="text">The input text to test.</param>
/// <param name="location">The input location to test.</param>
/// <returns>The selected character position index (can be equal to text length if location is outside of the layout rectangle).</returns>
API_FUNCTION() FORCE_INLINE int32 HitTestText(FallbackFonts* fallbacks, const StringView& text, const Float2& location)
API_FUNCTION() FORCE_INLINE int32 HitTestText(FontFallbackList* fallbacks, const StringView& text, const Float2& location)
{
return HitTestText(fallbacks, text, location, TextLayoutOptions());
}
@@ -680,7 +680,7 @@ public:
/// <param name="textRange">The input text range (substring range of the input text parameter).</param>
/// <param name="location">The input location to test.</param>
/// <returns>The selected character position index (can be equal to text length if location is outside of the layout rectangle).</returns>
API_FUNCTION() FORCE_INLINE int32 HitTestText(FallbackFonts* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, const Float2& location)
API_FUNCTION() FORCE_INLINE int32 HitTestText(FontFallbackList* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, const Float2& location)
{
return HitTestText(fallbacks, textRange.Substring(text), location, TextLayoutOptions());
}
@@ -737,7 +737,7 @@ public:
/// <param name="index">The text position to get coordinates of.</param>
/// <param name="layout">The text layout properties.</param>
/// <returns>The character position (upper left corner which can be used for a caret position).</returns>
API_FUNCTION() Float2 GetCharPosition(FallbackFonts* fallbacks, const StringView& text, int32 index, API_PARAM(Ref) const TextLayoutOptions& layout);
API_FUNCTION() Float2 GetCharPosition(FontFallbackList* fallbacks, const StringView& text, int32 index, API_PARAM(Ref) const TextLayoutOptions& layout);
/// <summary>
/// Calculates character position for given text and character index.
@@ -747,7 +747,7 @@ public:
/// <param name="index">The text position to get coordinates of.</param>
/// <param name="layout">The text layout properties.</param>
/// <returns>The character position (upper left corner which can be used for a caret position).</returns>
API_FUNCTION() Float2 GetCharPosition(FallbackFonts* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, int32 index, API_PARAM(Ref) const TextLayoutOptions& layout)
API_FUNCTION() Float2 GetCharPosition(FontFallbackList* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, int32 index, API_PARAM(Ref) const TextLayoutOptions& layout)
{
return GetCharPosition(fallbacks, textRange.Substring(text), index, layout);
}
@@ -758,7 +758,7 @@ public:
/// <param name="text">The input text to test.</param>
/// <param name="index">The text position to get coordinates of.</param>
/// <returns>The character position (upper left corner which can be used for a caret position).</returns>
API_FUNCTION() FORCE_INLINE Float2 GetCharPosition(FallbackFonts* fallbacks, const StringView& text, int32 index)
API_FUNCTION() FORCE_INLINE Float2 GetCharPosition(FontFallbackList* fallbacks, const StringView& text, int32 index)
{
return GetCharPosition(fallbacks, text, index, TextLayoutOptions());
}
@@ -770,7 +770,7 @@ public:
/// <param name="textRange">The input text range (substring range of the input text parameter).</param>
/// <param name="index">The text position to get coordinates of.</param>
/// <returns>The character position (upper left corner which can be used for a caret position).</returns>
API_FUNCTION() FORCE_INLINE Float2 GetCharPosition(FallbackFonts* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, int32 index)
API_FUNCTION() FORCE_INLINE Float2 GetCharPosition(FontFallbackList* fallbacks, const StringView& text, API_PARAM(Ref) const TextRange& textRange, int32 index)
{
return GetCharPosition(fallbacks, textRange.Substring(text), index, TextLayoutOptions());
}