diff --git a/examples/DemoRunner/Builds/Android/app/CMakeLists.txt b/examples/DemoRunner/Builds/Android/app/CMakeLists.txt
index c2a9d1d2a9..7d09a8d777 100644
--- a/examples/DemoRunner/Builds/Android/app/CMakeLists.txt
+++ b/examples/DemoRunner/Builds/Android/app/CMakeLists.txt
@@ -1480,8 +1480,14 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsContext.h"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.h"
"../../../../../modules/juce_graphics/detail/juce_Ranges.cpp"
"../../../../../modules/juce_graphics/detail/juce_Ranges.h"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"
@@ -1850,10 +1856,7 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
- "../../../../../modules/juce_graphics/fonts/juce_JustifiedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_LruCache.h"
- "../../../../../modules/juce_graphics/fonts/juce_ShapedText.cpp"
- "../../../../../modules/juce_graphics/fonts/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.h"
"../../../../../modules/juce_graphics/fonts/juce_Typeface.cpp"
@@ -4081,8 +4084,14 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsContext.h"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.h"
"../../../../../modules/juce_graphics/detail/juce_Ranges.cpp"
"../../../../../modules/juce_graphics/detail/juce_Ranges.h"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"
@@ -4451,10 +4460,7 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
- "../../../../../modules/juce_graphics/fonts/juce_JustifiedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_LruCache.h"
- "../../../../../modules/juce_graphics/fonts/juce_ShapedText.cpp"
- "../../../../../modules/juce_graphics/fonts/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.h"
"../../../../../modules/juce_graphics/fonts/juce_Typeface.cpp"
diff --git a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj
index 9017e2d6eb..3fab09bb7b 100644
--- a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj
+++ b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj
@@ -1902,9 +1902,18 @@
true
+
+ true
+
true
+
+ true
+
+
+ true
+
true
@@ -2157,15 +2166,6 @@
true
-
- true
-
-
- true
-
-
- true
-
true
@@ -4043,7 +4043,10 @@
+
+
+
diff --git a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters
index 45fef9920e..276d765e18 100644
--- a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters
+++ b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters
@@ -2671,9 +2671,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
@@ -2926,15 +2935,6 @@
JUCE Modules\juce_graphics\fonts
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
JUCE Modules\juce_graphics\fonts
@@ -6531,9 +6531,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
diff --git a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj
index 6e3237face..6396281066 100644
--- a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj
+++ b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj
@@ -1902,9 +1902,18 @@
true
+
+ true
+
true
+
+ true
+
+
+ true
+
true
@@ -2157,15 +2166,6 @@
true
-
- true
-
-
- true
-
-
- true
-
true
@@ -4043,7 +4043,10 @@
+
+
+
diff --git a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters
index 9b96768177..61a2b6fc37 100644
--- a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters
+++ b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters
@@ -2671,9 +2671,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
@@ -2926,15 +2935,6 @@
JUCE Modules\juce_graphics\fonts
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
JUCE Modules\juce_graphics\fonts
@@ -6531,9 +6531,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
diff --git a/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt b/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt
index 95041f7d0e..ea17b539e0 100644
--- a/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt
+++ b/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt
@@ -1242,8 +1242,14 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsContext.h"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.h"
"../../../../../modules/juce_graphics/detail/juce_Ranges.cpp"
"../../../../../modules/juce_graphics/detail/juce_Ranges.h"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"
@@ -1612,10 +1618,7 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
- "../../../../../modules/juce_graphics/fonts/juce_JustifiedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_LruCache.h"
- "../../../../../modules/juce_graphics/fonts/juce_ShapedText.cpp"
- "../../../../../modules/juce_graphics/fonts/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.h"
"../../../../../modules/juce_graphics/fonts/juce_Typeface.cpp"
@@ -3503,8 +3506,14 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsContext.h"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.h"
"../../../../../modules/juce_graphics/detail/juce_Ranges.cpp"
"../../../../../modules/juce_graphics/detail/juce_Ranges.h"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"
@@ -3873,10 +3882,7 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
- "../../../../../modules/juce_graphics/fonts/juce_JustifiedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_LruCache.h"
- "../../../../../modules/juce_graphics/fonts/juce_ShapedText.cpp"
- "../../../../../modules/juce_graphics/fonts/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.h"
"../../../../../modules/juce_graphics/fonts/juce_Typeface.cpp"
diff --git a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj
index 4f096cb98b..3820dd2448 100644
--- a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj
+++ b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj
@@ -1595,9 +1595,18 @@
true
+
+ true
+
true
+
+ true
+
+
+ true
+
true
@@ -1850,15 +1859,6 @@
true
-
- true
-
-
- true
-
-
- true
-
true
@@ -3498,7 +3498,10 @@
+
+
+
diff --git a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters
index 12373b1cb1..f6c18101ed 100644
--- a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters
+++ b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters
@@ -2188,9 +2188,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
@@ -2443,15 +2452,6 @@
JUCE Modules\juce_graphics\fonts
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
JUCE Modules\juce_graphics\fonts
@@ -5541,9 +5541,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
diff --git a/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt b/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt
index b8355d4bcb..01b5d2df93 100644
--- a/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt
+++ b/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt
@@ -1372,8 +1372,14 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsContext.h"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.h"
"../../../../../modules/juce_graphics/detail/juce_Ranges.cpp"
"../../../../../modules/juce_graphics/detail/juce_Ranges.h"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"
@@ -1742,10 +1748,7 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
- "../../../../../modules/juce_graphics/fonts/juce_JustifiedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_LruCache.h"
- "../../../../../modules/juce_graphics/fonts/juce_ShapedText.cpp"
- "../../../../../modules/juce_graphics/fonts/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.h"
"../../../../../modules/juce_graphics/fonts/juce_Typeface.cpp"
@@ -3786,8 +3789,14 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsContext.h"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.h"
"../../../../../modules/juce_graphics/detail/juce_Ranges.cpp"
"../../../../../modules/juce_graphics/detail/juce_Ranges.h"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"
@@ -4156,10 +4165,7 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
- "../../../../../modules/juce_graphics/fonts/juce_JustifiedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_LruCache.h"
- "../../../../../modules/juce_graphics/fonts/juce_ShapedText.cpp"
- "../../../../../modules/juce_graphics/fonts/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.h"
"../../../../../modules/juce_graphics/fonts/juce_Typeface.cpp"
diff --git a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj
index f2a86ca45a..e0652288d0 100644
--- a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj
+++ b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj
@@ -1729,9 +1729,18 @@
true
+
+ true
+
true
+
+ true
+
+
+ true
+
true
@@ -1984,15 +1993,6 @@
true
-
- true
-
-
- true
-
-
- true
-
true
@@ -3731,7 +3731,10 @@
+
+
+
diff --git a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters
index dfb02f0219..a19bae6c76 100644
--- a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters
+++ b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters
@@ -2395,9 +2395,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
@@ -2650,15 +2659,6 @@
JUCE Modules\juce_graphics\fonts
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
JUCE Modules\juce_graphics\fonts
@@ -5976,9 +5976,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
diff --git a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj
index 93194cda9b..697e6b3e89 100644
--- a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj
+++ b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj
@@ -1729,9 +1729,18 @@
true
+
+ true
+
true
+
+ true
+
+
+ true
+
true
@@ -1984,15 +1993,6 @@
true
-
- true
-
-
- true
-
-
- true
-
true
@@ -3731,7 +3731,10 @@
+
+
+
diff --git a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters
index 471da9c5c8..de14c66afe 100644
--- a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters
+++ b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters
@@ -2395,9 +2395,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
@@ -2650,15 +2659,6 @@
JUCE Modules\juce_graphics\fonts
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
JUCE Modules\juce_graphics\fonts
@@ -5976,9 +5976,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
diff --git a/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt b/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt
index b28b8e0216..778886efbc 100644
--- a/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt
+++ b/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt
@@ -1261,8 +1261,14 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsContext.h"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.h"
"../../../../../modules/juce_graphics/detail/juce_Ranges.cpp"
"../../../../../modules/juce_graphics/detail/juce_Ranges.h"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"
@@ -1631,10 +1637,7 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
- "../../../../../modules/juce_graphics/fonts/juce_JustifiedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_LruCache.h"
- "../../../../../modules/juce_graphics/fonts/juce_ShapedText.cpp"
- "../../../../../modules/juce_graphics/fonts/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.h"
"../../../../../modules/juce_graphics/fonts/juce_Typeface.cpp"
@@ -3602,8 +3605,14 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsContext.h"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp"
"../../../../../modules/juce_graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_JustifiedText.h"
"../../../../../modules/juce_graphics/detail/juce_Ranges.cpp"
"../../../../../modules/juce_graphics/detail/juce_Ranges.h"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
+ "../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"
@@ -3972,10 +3981,7 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
- "../../../../../modules/juce_graphics/fonts/juce_JustifiedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_LruCache.h"
- "../../../../../modules/juce_graphics/fonts/juce_ShapedText.cpp"
- "../../../../../modules/juce_graphics/fonts/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.cpp"
"../../../../../modules/juce_graphics/fonts/juce_TextLayout.h"
"../../../../../modules/juce_graphics/fonts/juce_Typeface.cpp"
diff --git a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj
index 164851b324..cd3895bdc9 100644
--- a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj
+++ b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj
@@ -1616,9 +1616,18 @@
true
+
+ true
+
true
+
+ true
+
+
+ true
+
true
@@ -1871,15 +1880,6 @@
true
-
- true
-
-
- true
-
-
- true
-
true
@@ -3596,7 +3596,10 @@
+
+
+
diff --git a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters
index ab01f0448f..958b7e982a 100644
--- a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters
+++ b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters
@@ -2242,9 +2242,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
@@ -2497,15 +2506,6 @@
JUCE Modules\juce_graphics\fonts
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
JUCE Modules\juce_graphics\fonts
@@ -5703,9 +5703,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
diff --git a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj
index cc0835df14..657323bbda 100644
--- a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj
+++ b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj
@@ -758,9 +758,18 @@
true
+
+ true
+
true
+
+ true
+
+
+ true
+
true
@@ -1013,15 +1022,6 @@
true
-
- true
-
-
- true
-
-
- true
-
true
@@ -2296,7 +2296,10 @@
+
+
+
diff --git a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters
index 93020039ce..f7c9574861 100644
--- a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters
+++ b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters
@@ -1081,9 +1081,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
@@ -1336,15 +1345,6 @@
JUCE Modules\juce_graphics\fonts
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
JUCE Modules\juce_graphics\fonts
@@ -3345,9 +3345,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
diff --git a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj
index cdacd9e00e..37b4e845d6 100644
--- a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj
+++ b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj
@@ -758,9 +758,18 @@
true
+
+ true
+
true
+
+ true
+
+
+ true
+
true
@@ -1013,15 +1022,6 @@
true
-
- true
-
-
- true
-
-
- true
-
true
@@ -2296,7 +2296,10 @@
+
+
+
diff --git a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters
index 28853ad793..49d6ad81de 100644
--- a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters
+++ b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters
@@ -1081,9 +1081,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
@@ -1336,15 +1345,6 @@
JUCE Modules\juce_graphics\fonts
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
JUCE Modules\juce_graphics\fonts
@@ -3345,9 +3345,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
diff --git a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj
index 1f75eda82f..452f017650 100644
--- a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj
+++ b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj
@@ -1737,9 +1737,18 @@
true
+
+ true
+
true
+
+ true
+
+
+ true
+
true
@@ -1992,15 +2001,6 @@
true
-
- true
-
-
- true
-
-
- true
-
true
@@ -3843,7 +3843,10 @@
+
+
+
diff --git a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters
index 667b31b270..962fc80158 100644
--- a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters
+++ b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters
@@ -2443,9 +2443,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
@@ -2698,15 +2707,6 @@
JUCE Modules\juce_graphics\fonts
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
JUCE Modules\juce_graphics\fonts
@@ -6135,9 +6135,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
diff --git a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj
index 682607a761..649c5f48d6 100644
--- a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj
+++ b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj
@@ -1737,9 +1737,18 @@
true
+
+ true
+
true
+
+ true
+
+
+ true
+
true
@@ -1992,15 +2001,6 @@
true
-
- true
-
-
- true
-
-
- true
-
true
@@ -3843,7 +3843,10 @@
+
+
+
diff --git a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters
index cff829e468..c06c9377ea 100644
--- a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters
+++ b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters
@@ -2443,9 +2443,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
@@ -2698,15 +2707,6 @@
JUCE Modules\juce_graphics\fonts
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
JUCE Modules\juce_graphics\fonts
@@ -6135,9 +6135,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
diff --git a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj
index 232083cf08..919ef9fd48 100644
--- a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj
+++ b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj
@@ -1615,9 +1615,18 @@
true
+
+ true
+
true
+
+ true
+
+
+ true
+
true
@@ -1870,15 +1879,6 @@
true
-
- true
-
-
- true
-
-
- true
-
true
@@ -3572,7 +3572,10 @@
+
+
+
diff --git a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj.filters b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj.filters
index 35f9cd57c4..1e701fc9da 100644
--- a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj.filters
+++ b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_DynamicLibrary.vcxproj.filters
@@ -2239,9 +2239,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
@@ -2494,15 +2503,6 @@
JUCE Modules\juce_graphics\fonts
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
-
- JUCE Modules\juce_graphics\fonts
-
JUCE Modules\juce_graphics\fonts
@@ -5670,9 +5670,18 @@
JUCE Modules\juce_graphics\contexts
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\detail
+
+ JUCE Modules\juce_graphics\detail
+
+
+ JUCE Modules\juce_graphics\detail
+
JUCE Modules\juce_graphics\effects
diff --git a/modules/juce_graphics/fonts/juce_JustifiedText.cpp b/modules/juce_graphics/detail/juce_JustifiedText.cpp
similarity index 79%
rename from modules/juce_graphics/fonts/juce_JustifiedText.cpp
rename to modules/juce_graphics/detail/juce_JustifiedText.cpp
index 6c367a2dc7..daf1c7102e 100644
--- a/modules/juce_graphics/fonts/juce_JustifiedText.cpp
+++ b/modules/juce_graphics/detail/juce_JustifiedText.cpp
@@ -32,62 +32,9 @@
==============================================================================
*/
-namespace juce
+namespace juce::detail
{
-template
-constexpr auto partiallyUnpackImpl (Tuple&& tuple, std::index_sequence)
-{
- return std::tie (std::get (tuple)...);
-}
-
-template
-constexpr auto partiallyUnpack (Tuple&& tuple)
-{
- return partiallyUnpackImpl (std::forward (tuple), std::make_index_sequence{});
-}
-
-class JustifiedText
-{
-private:
- enum class DrawType
- {
- normal,
- ellipsis
- };
-
-public:
- JustifiedText (const SimpleShapedText& t, const ShapedTextOptions& options);
-
- template
- void accessTogetherWith (Callable&& callback, RangedValues&&... rangedValues) const;
-
- /* The callback receives (Span glyphs,
- Span> positions,
- Font font,
- Range glyphRange,
- int64 lineNumber) // So far this has been indexed from 0 per SimpleShapedText
- // object, but maybe we'll find we want global text level
- // line numbers, so only assume they are increasing by one
- */
- template
- void access (Callable&& callback) const;
-
- /* This is how much cumulative widths glyphs take up in each line. Whether the trailing
- whitespace is included depends on the ShapedTextOptions::getWhitespaceShouldFitInLine()
- setting.
- */
- auto& getMinimumRequiredWidthForLines() const { return minimumRequiredWidthsForLine; }
-
-private:
- const SimpleShapedText& shapedText;
- detail::RangedValues> lineAnchors;
- std::optional ellipsis;
- detail::RangedValues rangesToDraw;
- detail::RangedValues whitespaceStretch;
- std::vector minimumRequiredWidthsForLine;
-};
-
void drawJustifiedText (const JustifiedText& text, const Graphics& g, AffineTransform);
//==============================================================================
@@ -496,59 +443,6 @@ JustifiedText::JustifiedText (const SimpleShapedText& t, const ShapedTextOptions
realign.extraWhitespaceAdvance);
}
-template
-void JustifiedText::accessTogetherWith (Callable&& callback, RangedValues&&... rangedValues) const
-{
- std::optional lastLine;
- Point anchor{};
-
- for (const auto item : makeIntersectingRangedValues (&shapedText.getLineNumbers(),
- &shapedText.getResolvedFonts(),
- &lineAnchors,
- &rangesToDraw,
- &whitespaceStretch,
- (&rangedValues)...))
- {
- const auto& [range, line, font, lineAnchor, drawType, stretch] = partiallyUnpack<0, 6> (item);
- const auto& rest = partiallyUnpack<6, std::tuple_size_v - 6> (item);
-
- if (std::exchange (lastLine, line) != line)
- anchor = lineAnchor;
-
- const auto glyphs = [this, r = range, dt = drawType]() -> Span
- {
- if (dt == DrawType::ellipsis)
- return ellipsis->getGlyphs();
-
- return shapedText.getGlyphs (r);
- }();
-
- std::vector> positions (glyphs.size());
-
- std::transform (glyphs.begin(), glyphs.end(), positions.begin(), [&anchor, &s = stretch] (auto& glyph)
- {
- auto result = anchor + glyph.offset;
-
- anchor += glyph.advance;
-
- if (glyph.whitespace)
- anchor.addXY (s, 0.0f);
-
- return result;
- });
-
- const auto callbackFont = drawType == DrawType::ellipsis ? ellipsis->getResolvedFonts().front().value : font;
- const auto callbackParameters = std::tuple_cat (std::tie (glyphs, positions, callbackFont, range, line), rest);
-
- const auto invokeNullChecked = [&] (auto&... params)
- {
- NullCheckedInvocation::invoke (callback, params...);
- };
-
- std::apply (invokeNullChecked, callbackParameters);
- }
-}
-
template
void JustifiedText::access (Callable&& callback) const
{
@@ -577,4 +471,4 @@ void drawJustifiedText (const JustifiedText& text, const Graphics& g, AffineTran
});
}
-} // namespace juce
+} // namespace juce::detail
diff --git a/modules/juce_graphics/detail/juce_JustifiedText.h b/modules/juce_graphics/detail/juce_JustifiedText.h
new file mode 100644
index 0000000000..70a79ff7b2
--- /dev/null
+++ b/modules/juce_graphics/detail/juce_JustifiedText.h
@@ -0,0 +1,144 @@
+/*
+ ==============================================================================
+
+ This file is part of the JUCE framework.
+ Copyright (c) Raw Material Software Limited
+
+ JUCE is an open source framework subject to commercial or open source
+ licensing.
+
+ By downloading, installing, or using the JUCE framework, or combining the
+ JUCE framework with any other source code, object code, content or any other
+ copyrightable work, you agree to the terms of the JUCE End User Licence
+ Agreement, and all incorporated terms including the JUCE Privacy Policy and
+ the JUCE Website Terms of Service, as applicable, which will bind you. If you
+ do not agree to the terms of these agreements, we will not license the JUCE
+ framework to you, and you must discontinue the installation or download
+ process and cease use of the JUCE framework.
+
+ JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/
+ JUCE Privacy Policy: https://juce.com/juce-privacy-policy
+ JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/
+
+ Or:
+
+ You may also use this code under the terms of the AGPLv3:
+ https://www.gnu.org/licenses/agpl-3.0.en.html
+
+ THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL
+ WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
+
+ ==============================================================================
+*/
+
+namespace juce::detail
+{
+
+template
+constexpr auto partiallyUnpackImpl (Tuple&& tuple, std::index_sequence)
+{
+ return std::tie (std::get (tuple)...);
+}
+
+template
+constexpr auto partiallyUnpack (Tuple&& tuple)
+{
+ return partiallyUnpackImpl (std::forward (tuple), std::make_index_sequence{});
+}
+
+class JustifiedText
+{
+private:
+ enum class DrawType
+ {
+ normal,
+ ellipsis
+ };
+
+public:
+ JustifiedText (const SimpleShapedText& t, const ShapedTextOptions& options);
+
+ template
+ void accessTogetherWith (Callable&& callback, RangedValues&&... rangedValues) const
+ {
+ std::optional lastLine;
+ Point anchor {};
+
+ for (const auto item : makeIntersectingRangedValues (&shapedText.getLineNumbers(),
+ &shapedText.getResolvedFonts(),
+ &lineAnchors,
+ &rangesToDraw,
+ &whitespaceStretch,
+ (&rangedValues)...))
+ {
+ const auto& [range, line, font, lineAnchor, drawType, stretch] = partiallyUnpack<0, 6> (item);
+ const auto& rest = partiallyUnpack<6, std::tuple_size_v - 6> (item);
+
+ if (std::exchange (lastLine, line) != line)
+ anchor = lineAnchor;
+
+ const auto glyphs = [this, r = range, dt = drawType]() -> Span
+ {
+ if (dt == DrawType::ellipsis)
+ return ellipsis->getGlyphs();
+
+ return shapedText.getGlyphs (r);
+ }();
+
+ std::vector> positions (glyphs.size());
+
+ std::transform (glyphs.begin(),
+ glyphs.end(),
+ positions.begin(),
+ [&anchor, &s = stretch] (auto& glyph)
+ {
+ auto result = anchor + glyph.offset;
+
+ anchor += glyph.advance;
+
+ if (glyph.whitespace)
+ anchor.addXY (s, 0.0f);
+
+ return result;
+ });
+
+ const auto callbackFont =
+ drawType == DrawType::ellipsis ? ellipsis->getResolvedFonts().front().value : font;
+ const auto callbackParameters =
+ std::tuple_cat (std::tie (glyphs, positions, callbackFont, range, line), rest);
+
+ const auto invokeNullChecked = [&] (auto&... params)
+ { NullCheckedInvocation::invoke (callback, params...); };
+
+ std::apply (invokeNullChecked, callbackParameters);
+ }
+ }
+
+ /* The callback receives (Span glyphs,
+ Span> positions,
+ Font font,
+ Range glyphRange,
+ int64 lineNumber) // So far this has been indexed from 0 per SimpleShapedText
+ // object, but maybe we'll find we want global text level
+ // line numbers, so only assume they are increasing by one
+ */
+ template
+ void access (Callable&& callback) const;
+
+ /* This is how much cumulative widths glyphs take up in each line. Whether the trailing
+ whitespace is included depends on the ShapedTextOptions::getWhitespaceShouldFitInLine()
+ setting.
+ */
+ auto& getMinimumRequiredWidthForLines() const { return minimumRequiredWidthsForLine; }
+
+private:
+ const SimpleShapedText& shapedText;
+ detail::RangedValues> lineAnchors;
+ std::optional ellipsis;
+ detail::RangedValues rangesToDraw;
+ detail::RangedValues whitespaceStretch;
+ std::vector minimumRequiredWidthsForLine;
+};
+
+} // namespace juce::detail
diff --git a/modules/juce_graphics/fonts/juce_ShapedText.cpp b/modules/juce_graphics/detail/juce_ShapedText.cpp
similarity index 60%
rename from modules/juce_graphics/fonts/juce_ShapedText.cpp
rename to modules/juce_graphics/detail/juce_ShapedText.cpp
index 4405c71e81..69b4fc5e26 100644
--- a/modules/juce_graphics/fonts/juce_ShapedText.cpp
+++ b/modules/juce_graphics/detail/juce_ShapedText.cpp
@@ -32,75 +32,9 @@
==============================================================================
*/
-namespace juce
+namespace juce::detail
{
-/** Class that can visually shape a Unicode string provided a list of Fonts corresponding to
- sub-ranges of the string.
-*/
-class JUCE_API ShapedText
-{
-public:
- using Options = ShapedTextOptions;
-
- ShapedText();
-
- explicit ShapedText (String text);
-
- ShapedText (String text, Options options);
-
- /** Returns the text which was used to construct this object. */
- const String& getText() const;
-
- /** Returns the text's codepoint range, to which the glyph under the provided index belongs.
-
- This range will have a length of at least one, and potentially more than one if ligatures
- are enabled.
- */
- Range getTextRange (int64 glyphIndex) const;
-
- /** Returns the widths for each line, that the glyphs would require to be rendered without being
- truncated. This will or will not include the space required by trailing whitespaces in the
- line based on the ShapedTextOptions::withTrailingWhitespacesShouldFit() value.
-
- This value isn't affected by the Justification parameter, it just reports the amount of
- width that would be required to avoid truncation.
- */
- Span getMinimumRequiredWidthForLines() const;
-
- /** Provides access to the data stored in the ShapedText.
-
- The provided function callback will be called multiple times for "uniform glyph runs", for which all
- callback parameters are the same.
-
- Between each subsequent callback at least one of the provided parameters will be different.
-
- The callbacks happen in visual order i.e. left to right, which is irrespective of the
- underlying text's writing direction.
-
- The callback parameters in order are:
- - the glyphs
- - the positions for each glyph in the previous parameter
- - the Font with which these glyphs should be rendered
- - the range in all glyphs this ShapedText object holds, that correspond to the current glyphs
- - a line number which increases by one for each new line
- */
- void access (const std::function, Span>, Font, Range, int64)>&) const;
-
- /** Draws the text. */
- void draw (const Graphics& g, AffineTransform transform) const;
-
- /** @internal */
- class Detail;
-
- /** @internal */
- Detail getDetail() const;
-
-private:
- class Impl;
- std::shared_ptr impl;
-};
-
class ShapedText::Impl
{
public:
@@ -205,4 +139,4 @@ ShapedText::Detail ShapedText::getDetail() const
return Detail { this };
}
-} // namespace juce
+} // namespace juce::detail
diff --git a/modules/juce_graphics/detail/juce_ShapedText.h b/modules/juce_graphics/detail/juce_ShapedText.h
new file mode 100644
index 0000000000..1ae07de763
--- /dev/null
+++ b/modules/juce_graphics/detail/juce_ShapedText.h
@@ -0,0 +1,104 @@
+/*
+ ==============================================================================
+
+ This file is part of the JUCE framework.
+ Copyright (c) Raw Material Software Limited
+
+ JUCE is an open source framework subject to commercial or open source
+ licensing.
+
+ By downloading, installing, or using the JUCE framework, or combining the
+ JUCE framework with any other source code, object code, content or any other
+ copyrightable work, you agree to the terms of the JUCE End User Licence
+ Agreement, and all incorporated terms including the JUCE Privacy Policy and
+ the JUCE Website Terms of Service, as applicable, which will bind you. If you
+ do not agree to the terms of these agreements, we will not license the JUCE
+ framework to you, and you must discontinue the installation or download
+ process and cease use of the JUCE framework.
+
+ JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/
+ JUCE Privacy Policy: https://juce.com/juce-privacy-policy
+ JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/
+
+ Or:
+
+ You may also use this code under the terms of the AGPLv3:
+ https://www.gnu.org/licenses/agpl-3.0.en.html
+
+ THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL
+ WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
+
+ ==============================================================================
+*/
+
+namespace juce::detail
+{
+
+/** Class that can visually shape a Unicode string provided a list of Fonts corresponding to
+ sub-ranges of the string.
+*/
+class JUCE_API ShapedText
+{
+public:
+ using Options = ShapedTextOptions;
+
+ ShapedText();
+
+ explicit ShapedText (String text);
+
+ ShapedText (String text, Options options);
+
+ /** Returns the text which was used to construct this object. */
+ const String& getText() const;
+
+ /** Returns the text's codepoint range, to which the glyph under the provided index belongs.
+
+ This range will have a length of at least one, and potentially more than one if ligatures
+ are enabled.
+ */
+ Range getTextRange (int64 glyphIndex) const;
+
+ /** Returns the widths for each line, that the glyphs would require to be rendered without being
+ truncated. This will or will not include the space required by trailing whitespaces in the
+ line based on the ShapedTextOptions::withTrailingWhitespacesShouldFit() value.
+
+ This value isn't affected by the Justification parameter, it just reports the amount of
+ width that would be required to avoid truncation.
+ */
+ Span getMinimumRequiredWidthForLines() const;
+
+ /** Provides access to the data stored in the ShapedText.
+
+ The provided function callback will be called multiple times for "uniform glyph runs", for which all
+ callback parameters are the same.
+
+ Between each subsequent callback at least one of the provided parameters will be different.
+
+ The callbacks happen in visual order i.e. left to right, which is irrespective of the
+ underlying text's writing direction.
+
+ The callback parameters in order are:
+ - the glyphs
+ - the positions for each glyph in the previous parameter
+ - the Font with which these glyphs should be rendered
+ - the range in all glyphs this ShapedText object holds, that correspond to the current glyphs
+ - a line number which increases by one for each new line
+ */
+ void access (const std::function, Span>, Font, Range, int64)>&) const;
+
+ /** Draws the text. */
+ void draw (const Graphics& g, AffineTransform transform) const;
+
+ /** @internal */
+ class Detail;
+
+ /** @internal */
+ Detail getDetail() const;
+
+private:
+ class Impl;
+ std::shared_ptr impl;
+};
+
+} // namespace juce::detail
diff --git a/modules/juce_graphics/fonts/juce_SimpleShapedText.cpp b/modules/juce_graphics/detail/juce_SimpleShapedText.cpp
similarity index 85%
rename from modules/juce_graphics/fonts/juce_SimpleShapedText.cpp
rename to modules/juce_graphics/detail/juce_SimpleShapedText.cpp
index 8206d11ea9..cdc626ac31 100644
--- a/modules/juce_graphics/fonts/juce_SimpleShapedText.cpp
+++ b/modules/juce_graphics/detail/juce_SimpleShapedText.cpp
@@ -32,190 +32,10 @@
==============================================================================
*/
-namespace juce
+namespace juce::detail
{
-using FontForRange = std::pair, Font>;
-
-class ShapedTextOptions
-{
-public:
- [[nodiscard]] ShapedTextOptions withJustification (Justification x) const
- {
- return withMember (*this, &ShapedTextOptions::justification, x);
- }
-
- [[nodiscard]] ShapedTextOptions withMaxWidth (float x) const
- {
- return withMember (*this, &ShapedTextOptions::maxWidth, x);
- }
-
- [[nodiscard]] ShapedTextOptions withHeight (float x) const
- {
- return withMember (*this, &ShapedTextOptions::height, x);
- }
-
- [[nodiscard]] ShapedTextOptions withFont (Font x) const
- {
- return withMember (*this, &ShapedTextOptions::fontsForRange,
- std::vector { { { 0, std::numeric_limits::max() },
- x } });
- }
-
- [[nodiscard]] ShapedTextOptions withFontsForRange (const std::vector& x) const
- {
- return withMember (*this, &ShapedTextOptions::fontsForRange, x);
- }
-
- [[nodiscard]] ShapedTextOptions withLanguage (StringRef x) const
- {
- return withMember (*this, &ShapedTextOptions::language, x);
- }
-
- [[nodiscard]] ShapedTextOptions withFirstLineIndent (float x) const
- {
- return withMember (*this, &ShapedTextOptions::firstLineIndent, x);
- }
-
- /* This controls the space between lines using a proportional value, with a default of 1.0,
- meaning single line spacing i.e. the descender of the current line + ascender of the next
- line. This value is multiplied by the leading provided here.
- */
- [[nodiscard]] ShapedTextOptions withLeading (float x) const
- {
- return withMember (*this, &ShapedTextOptions::leading, x);
- }
-
- /* This controls the space between lines using an additive absolute value, with a default of 0.0.
- This value is added to the spacing between each two lines.
- */
- [[nodiscard]] ShapedTextOptions withAdditiveLineSpacing (float x) const
- {
- return withMember (*this, &ShapedTextOptions::additiveLineSpacing, x);
- }
-
- [[nodiscard]] ShapedTextOptions withBaselineAtZero (bool x = true) const
- {
- return withMember (*this, &ShapedTextOptions::baselineAtZero, x);
- }
-
- [[nodiscard]] ShapedTextOptions withTrailingWhitespacesShouldFit (bool x = true) const
- {
- return withMember (*this, &ShapedTextOptions::trailingWhitespacesShouldFit, x);
- }
-
- [[nodiscard]] ShapedTextOptions withMaxNumLines (int64 x) const
- {
- return withMember (*this, &ShapedTextOptions::maxNumLines, x);
- }
-
- [[nodiscard]] ShapedTextOptions withEllipsis (String x = String::charToString ((juce_wchar) 0x2026)) const
- {
- return withMember (*this, &ShapedTextOptions::ellipsis, std::move (x));
- }
-
- [[nodiscard]] ShapedTextOptions withReadingDirection (std::optional x) const
- {
- return withMember (*this, &ShapedTextOptions::readingDir, x);
- }
-
- [[nodiscard]] ShapedTextOptions withAllowBreakingInsideWord (bool x = true) const
- {
- return withMember (*this, &ShapedTextOptions::allowBreakingInsideWord, x);
- }
-
- const auto& getReadingDirection() const { return readingDir; }
- const auto& getJustification() const { return justification; }
- const auto& getMaxWidth() const { return maxWidth; }
- const auto& getHeight() const { return height; }
- const auto& getFontsForRange() const { return fontsForRange; }
- const auto& getLanguage() const { return language; }
- const auto& getFirstLineIndent() const { return firstLineIndent; }
- const auto& getLeading() const { return leading; }
- const auto& getAdditiveLineSpacing() const { return additiveLineSpacing; }
- const auto& isBaselineAtZero() const { return baselineAtZero; }
- const auto& getTrailingWhitespacesShouldFit() const { return trailingWhitespacesShouldFit; }
- const auto& getMaxNumLines() const { return maxNumLines; }
- const auto& getEllipsis() const { return ellipsis; }
- const auto& getAllowBreakingInsideWord() const { return allowBreakingInsideWord; }
-
-private:
- Justification justification { Justification::topLeft };
- std::optional readingDir;
- std::optional maxWidth;
- std::optional height;
- std::vector fontsForRange { { { 0, std::numeric_limits::max() },
- FontOptions { 15.0f } } };
- String language = SystemStats::getDisplayLanguage();
- float firstLineIndent = 0.0f;
- float leading = 1.0f;
- float additiveLineSpacing = 0.0f;
- bool baselineAtZero = false;
- bool allowBreakingInsideWord = false;
- bool trailingWhitespacesShouldFit;
- int64 maxNumLines = std::numeric_limits::max();
- String ellipsis;
-};
-
-struct ShapedGlyph
-{
- uint32_t glyphId;
- int64 cluster;
- bool unsafeToBreak;
- bool whitespace;
- Point advance;
- Point offset;
-};
-
-struct GlyphLookupEntry
-{
- Range glyphRange;
- bool ltr = true;
-};
-
-class SimpleShapedText
-{
-public:
- /* Shapes and lays out the first contiguous sequence of ranges specified in the fonts
- parameter.
- */
- SimpleShapedText (const String* data,
- const ShapedTextOptions& options);
-
- /* The returned container associates line numbers with the range of glyphs (not input codepoints)
- that make up the line.
- */
- const auto& getLineNumbers() const { return lineNumbers; }
-
- const auto& getResolvedFonts() const { return resolvedFonts; }
-
- Range getTextRange (int64 glyphIndex) const;
-
- int64 getNumLines() const { return (int64) lineNumbers.getRanges().size(); }
- int64 getNumGlyphs() const { return (int64) glyphsInVisualOrder.size(); }
-
- juce_wchar getCodepoint (int64 glyphIndex) const;
-
- Span getGlyphs (Range glyphRange) const;
-
- Span getGlyphs() const;
-
-private:
- void shape (const String& data,
- const ShapedTextOptions& options);
-
- const String& string;
- std::vector glyphsInVisualOrder;
- detail::RangedValues lineNumbers;
- detail::RangedValues resolvedFonts;
- detail::RangedValues glyphLookup;
-
- JUCE_LEAK_DETECTOR (SimpleShapedText)
-};
-
//==============================================================================
-using namespace detail;
-
constexpr hb_script_t getScriptTag (TextScript type)
{
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wswitch-enum")
@@ -1541,4 +1361,4 @@ static SimpleShapedTextTests simpleShapedTextTests;
#endif
-} // namespace juce
+} // namespace juce::detail
diff --git a/modules/juce_graphics/detail/juce_SimpleShapedText.h b/modules/juce_graphics/detail/juce_SimpleShapedText.h
new file mode 100644
index 0000000000..b2c59446a6
--- /dev/null
+++ b/modules/juce_graphics/detail/juce_SimpleShapedText.h
@@ -0,0 +1,223 @@
+/*
+ ==============================================================================
+
+ This file is part of the JUCE framework.
+ Copyright (c) Raw Material Software Limited
+
+ JUCE is an open source framework subject to commercial or open source
+ licensing.
+
+ By downloading, installing, or using the JUCE framework, or combining the
+ JUCE framework with any other source code, object code, content or any other
+ copyrightable work, you agree to the terms of the JUCE End User Licence
+ Agreement, and all incorporated terms including the JUCE Privacy Policy and
+ the JUCE Website Terms of Service, as applicable, which will bind you. If you
+ do not agree to the terms of these agreements, we will not license the JUCE
+ framework to you, and you must discontinue the installation or download
+ process and cease use of the JUCE framework.
+
+ JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/
+ JUCE Privacy Policy: https://juce.com/juce-privacy-policy
+ JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/
+
+ Or:
+
+ You may also use this code under the terms of the AGPLv3:
+ https://www.gnu.org/licenses/agpl-3.0.en.html
+
+ THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL
+ WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
+
+ ==============================================================================
+*/
+
+namespace juce::detail
+{
+
+using FontForRange = std::pair, Font>;
+
+/** Types of text direction. This may also be applied to characters. */
+enum class TextDirection
+{
+ ltr, // This text reads left to right.
+ rtl // This text reads right to left.
+};
+
+class ShapedTextOptions
+{
+public:
+ [[nodiscard]] ShapedTextOptions withJustification (Justification x) const
+ {
+ return withMember (*this, &ShapedTextOptions::justification, x);
+ }
+
+ [[nodiscard]] ShapedTextOptions withMaxWidth (float x) const
+ {
+ return withMember (*this, &ShapedTextOptions::maxWidth, x);
+ }
+
+ [[nodiscard]] ShapedTextOptions withHeight (float x) const
+ {
+ return withMember (*this, &ShapedTextOptions::height, x);
+ }
+
+ [[nodiscard]] ShapedTextOptions withFont (Font x) const
+ {
+ return withMember (*this, &ShapedTextOptions::fontsForRange,
+ std::vector { { { 0, std::numeric_limits::max() },
+ x } });
+ }
+
+ [[nodiscard]] ShapedTextOptions withFontsForRange (const std::vector& x) const
+ {
+ return withMember (*this, &ShapedTextOptions::fontsForRange, x);
+ }
+
+ [[nodiscard]] ShapedTextOptions withLanguage (StringRef x) const
+ {
+ return withMember (*this, &ShapedTextOptions::language, x);
+ }
+
+ [[nodiscard]] ShapedTextOptions withFirstLineIndent (float x) const
+ {
+ return withMember (*this, &ShapedTextOptions::firstLineIndent, x);
+ }
+
+ /* This controls the space between lines using a proportional value, with a default of 1.0,
+ meaning single line spacing i.e. the descender of the current line + ascender of the next
+ line. This value is multiplied by the leading provided here.
+ */
+ [[nodiscard]] ShapedTextOptions withLeading (float x) const
+ {
+ return withMember (*this, &ShapedTextOptions::leading, x);
+ }
+
+ /* This controls the space between lines using an additive absolute value, with a default of 0.0.
+ This value is added to the spacing between each two lines.
+ */
+ [[nodiscard]] ShapedTextOptions withAdditiveLineSpacing (float x) const
+ {
+ return withMember (*this, &ShapedTextOptions::additiveLineSpacing, x);
+ }
+
+ [[nodiscard]] ShapedTextOptions withBaselineAtZero (bool x = true) const
+ {
+ return withMember (*this, &ShapedTextOptions::baselineAtZero, x);
+ }
+
+ [[nodiscard]] ShapedTextOptions withTrailingWhitespacesShouldFit (bool x = true) const
+ {
+ return withMember (*this, &ShapedTextOptions::trailingWhitespacesShouldFit, x);
+ }
+
+ [[nodiscard]] ShapedTextOptions withMaxNumLines (int64 x) const
+ {
+ return withMember (*this, &ShapedTextOptions::maxNumLines, x);
+ }
+
+ [[nodiscard]] ShapedTextOptions withEllipsis (String x = String::charToString ((juce_wchar) 0x2026)) const
+ {
+ return withMember (*this, &ShapedTextOptions::ellipsis, std::move (x));
+ }
+
+ [[nodiscard]] ShapedTextOptions withReadingDirection (std::optional x) const
+ {
+ return withMember (*this, &ShapedTextOptions::readingDir, x);
+ }
+
+ [[nodiscard]] ShapedTextOptions withAllowBreakingInsideWord (bool x = true) const
+ {
+ return withMember (*this, &ShapedTextOptions::allowBreakingInsideWord, x);
+ }
+
+ const auto& getReadingDirection() const { return readingDir; }
+ const auto& getJustification() const { return justification; }
+ const auto& getMaxWidth() const { return maxWidth; }
+ const auto& getHeight() const { return height; }
+ const auto& getFontsForRange() const { return fontsForRange; }
+ const auto& getLanguage() const { return language; }
+ const auto& getFirstLineIndent() const { return firstLineIndent; }
+ const auto& getLeading() const { return leading; }
+ const auto& getAdditiveLineSpacing() const { return additiveLineSpacing; }
+ const auto& isBaselineAtZero() const { return baselineAtZero; }
+ const auto& getTrailingWhitespacesShouldFit() const { return trailingWhitespacesShouldFit; }
+ const auto& getMaxNumLines() const { return maxNumLines; }
+ const auto& getEllipsis() const { return ellipsis; }
+ const auto& getAllowBreakingInsideWord() const { return allowBreakingInsideWord; }
+
+private:
+ Justification justification { Justification::topLeft };
+ std::optional readingDir;
+ std::optional maxWidth;
+ std::optional height;
+ std::vector fontsForRange { { { 0, std::numeric_limits::max() },
+ FontOptions { 15.0f } } };
+ String language = SystemStats::getDisplayLanguage();
+ float firstLineIndent = 0.0f;
+ float leading = 1.0f;
+ float additiveLineSpacing = 0.0f;
+ bool baselineAtZero = false;
+ bool allowBreakingInsideWord = false;
+ bool trailingWhitespacesShouldFit;
+ int64 maxNumLines = std::numeric_limits::max();
+ String ellipsis;
+};
+
+struct ShapedGlyph
+{
+ uint32_t glyphId;
+ int64 cluster;
+ bool unsafeToBreak;
+ bool whitespace;
+ Point advance;
+ Point offset;
+};
+
+struct GlyphLookupEntry
+{
+ Range glyphRange;
+ bool ltr = true;
+};
+
+class SimpleShapedText
+{
+public:
+ /* Shapes and lays out the first contiguous sequence of ranges specified in the fonts
+ parameter.
+ */
+ SimpleShapedText (const String* data,
+ const ShapedTextOptions& options);
+
+ /* The returned container associates line numbers with the range of glyphs (not input codepoints)
+ that make up the line.
+ */
+ const auto& getLineNumbers() const { return lineNumbers; }
+
+ const auto& getResolvedFonts() const { return resolvedFonts; }
+
+ Range getTextRange (int64 glyphIndex) const;
+
+ int64 getNumLines() const { return (int64) lineNumbers.getRanges().size(); }
+ int64 getNumGlyphs() const { return (int64) glyphsInVisualOrder.size(); }
+
+ juce_wchar getCodepoint (int64 glyphIndex) const;
+
+ Span getGlyphs (Range glyphRange) const;
+
+ Span getGlyphs() const;
+
+private:
+ void shape (const String& data,
+ const ShapedTextOptions& options);
+
+ const String& string;
+ std::vector glyphsInVisualOrder;
+ detail::RangedValues lineNumbers;
+ detail::RangedValues resolvedFonts;
+ detail::RangedValues glyphLookup;
+
+ JUCE_LEAK_DETECTOR (SimpleShapedText)
+};
+
+} // namespace juce::detail
diff --git a/modules/juce_graphics/fonts/juce_GlyphArrangement.cpp b/modules/juce_graphics/fonts/juce_GlyphArrangement.cpp
index 43c54f6c50..0060393c3c 100644
--- a/modules/juce_graphics/fonts/juce_GlyphArrangement.cpp
+++ b/modules/juce_graphics/fonts/juce_GlyphArrangement.cpp
@@ -43,7 +43,7 @@ static constexpr bool isNonBreakingSpace (const juce_wchar c)
|| c == 0x2060;
}
-static bool areAllRequiredWidthsSmallerThanMax (const ShapedText& shapedText, float width)
+static bool areAllRequiredWidthsSmallerThanMax (const detail::ShapedText& shapedText, float width)
{
const auto lineWidths = shapedText.getMinimumRequiredWidthForLines();
return std::all_of (lineWidths.begin(), lineWidths.end(), [width] (auto& w) { return w <= width; });
@@ -51,7 +51,7 @@ static bool areAllRequiredWidthsSmallerThanMax (const ShapedText& shapedText, fl
// ShapedText truncates the last line by default, even if it requires larger width than the maximum
// allowed.
-static bool areAllRequiredWidthsExceptTheLastSmallerThanMax (const ShapedText& shapedText, float width)
+static bool areAllRequiredWidthsExceptTheLastSmallerThanMax (const detail::ShapedText& shapedText, float width)
{
const auto lineWidths = shapedText.getMinimumRequiredWidthForLines();
@@ -171,7 +171,7 @@ void GlyphArrangement::addLineOfText (const Font& font, const String& text, floa
addCurtailedLineOfText (font, text, xOffset, yOffset, 1.0e10f, false);
}
-static void addGlyphsFromShapedText (GlyphArrangement& ga, const ShapedText& st, float x, float y)
+static void addGlyphsFromShapedText (GlyphArrangement& ga, const detail::ShapedText& st, float x, float y)
{
st.access ([&] (auto shapedGlyphs, auto positions, auto font, auto glyphRange, auto)
{
@@ -199,6 +199,8 @@ void GlyphArrangement::addCurtailedLineOfText (const Font& font, const String& t
float xOffset, float yOffset,
float maxWidthPixels, bool useEllipsis)
{
+ using namespace detail;
+
auto options = ShapedText::Options{}.withMaxNumLines (1)
.withMaxWidth (maxWidthPixels)
.withFont (font)
@@ -218,6 +220,8 @@ void GlyphArrangement::addJustifiedText (const Font& font, const String& text,
Justification horizontalLayout,
float leading)
{
+ using namespace detail;
+
ShapedText st { text, ShapedText::Options{}.withMaxWidth (maxLineWidth)
.withJustification (horizontalLayout)
.withFont (font)
@@ -235,8 +239,10 @@ static auto createFittedText (const Font& f,
Justification layout,
int maximumLines,
float minimumRelativeHorizontalScale,
- ShapedText::Options baseOptions = {})
+ detail::ShapedText::Options baseOptions = {})
{
+ using namespace detail;
+
if (! layout.testFlags (Justification::bottom | Justification::top))
layout = layout.getOnlyHorizontalFlags() | Justification::verticallyCentred;
@@ -472,7 +478,7 @@ void GlyphArrangement::addFittedText (const Font& f,
layout,
maximumLines,
minimumHorizontalScale,
- ShapedText::Options{}.withAllowBreakingInsideWord());
+ detail::ShapedText::Options{}.withAllowBreakingInsideWord());
addGlyphsFromShapedText (*this, stWithWordBreaks, x, y);
}
diff --git a/modules/juce_graphics/fonts/juce_TextLayout.cpp b/modules/juce_graphics/fonts/juce_TextLayout.cpp
index 245e2e9bf7..16a8fdcac8 100644
--- a/modules/juce_graphics/fonts/juce_TextLayout.cpp
+++ b/modules/juce_graphics/fonts/juce_TextLayout.cpp
@@ -327,6 +327,8 @@ static auto castTo (const Range& r)
static auto getFontsForRange (const detail::RangedValues& fonts)
{
+ using namespace detail;
+
std::vector result;
result.reserve (fonts.size());
@@ -340,7 +342,7 @@ static auto getFontsForRange (const detail::RangedValues& fonts)
return result;
}
-static Range getInputRange (const ShapedText& st, Range glyphRange)
+static Range getInputRange (const detail::ShapedText& st, Range glyphRange)
{
if (glyphRange.isEmpty())
{
@@ -356,8 +358,10 @@ static Range getInputRange (const ShapedText& st, Range glyphRange
std::max (startInputRange.getEnd(), endInputRange.getEnd()) };
}
-static Range getLineInputRange (const ShapedText& st, int64 lineNumber)
+static Range getLineInputRange (const detail::ShapedText& st, int64 lineNumber)
{
+ using namespace detail;
+
return getInputRange (st, ShapedText::Detail { &st }.getSimpleShapedText()
.getLineNumbers()
.getItem ((size_t) lineNumber).range);
@@ -368,10 +372,10 @@ struct MaxFontAscentAndDescent
float ascent{}, descent{};
};
-static MaxFontAscentAndDescent getMaxFontAscentAndDescentInEnclosingLine (const ShapedText& st,
+static MaxFontAscentAndDescent getMaxFontAscentAndDescentInEnclosingLine (const detail::ShapedText& st,
Range lineChunkRange)
{
- const auto sst = ShapedText::Detail { &st }.getSimpleShapedText();
+ const auto sst = detail::ShapedText::Detail { &st }.getSimpleShapedText();
const auto lineRange = sst.getLineNumbers()
.getItemWithEnclosingRange (lineChunkRange.getStart())->range;
@@ -389,8 +393,10 @@ static MaxFontAscentAndDescent getMaxFontAscentAndDescentInEnclosingLine (const
return result;
}
-static std::optional getTextDirection (const AttributedString& text)
+static std::optional getTextDirection (const AttributedString& text)
{
+ using namespace detail;
+
using ReadingDirection = AttributedString::ReadingDirection;
const auto dir = text.getReadingDirection();
@@ -406,8 +412,10 @@ static std::optional getTextDirection (const AttributedString& te
void TextLayout::createStandardLayout (const AttributedString& text)
{
- detail::RangedValues fonts;
- detail::RangedValues colours;
+ using namespace detail;
+
+ RangedValues fonts;
+ RangedValues colours;
for (auto i = 0, iMax = text.getNumAttributes(); i < iMax; ++i)
{
diff --git a/modules/juce_graphics/juce_graphics.cpp b/modules/juce_graphics/juce_graphics.cpp
index 2d06470bb1..8ca1d2a481 100644
--- a/modules/juce_graphics/juce_graphics.cpp
+++ b/modules/juce_graphics/juce_graphics.cpp
@@ -194,9 +194,9 @@ extern "C"
#include "fonts/juce_FontOptions.cpp"
#include "fonts/juce_Font.cpp"
#include "detail/juce_Ranges.cpp"
-#include "fonts/juce_SimpleShapedText.cpp"
-#include "fonts/juce_JustifiedText.cpp"
-#include "fonts/juce_ShapedText.cpp"
+#include "detail/juce_SimpleShapedText.cpp"
+#include "detail/juce_JustifiedText.cpp"
+#include "detail/juce_ShapedText.cpp"
#include "fonts/juce_GlyphArrangement.cpp"
#include "fonts/juce_TextLayout.cpp"
#include "effects/juce_DropShadowEffect.cpp"
diff --git a/modules/juce_graphics/juce_graphics.h b/modules/juce_graphics/juce_graphics.h
index f403ada15d..195d1ae31e 100644
--- a/modules/juce_graphics/juce_graphics.h
+++ b/modules/juce_graphics/juce_graphics.h
@@ -138,6 +138,9 @@ namespace juce
#include "fonts/juce_FontOptions.h"
#include "fonts/juce_Font.h"
#include "detail/juce_Ranges.h"
+#include "detail/juce_SimpleShapedText.h"
+#include "detail/juce_JustifiedText.h"
+#include "detail/juce_ShapedText.h"
#include "fonts/juce_AttributedString.h"
#include "fonts/juce_GlyphArrangement.h"
#include "fonts/juce_TextLayout.h"
diff --git a/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.mm b/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.mm
index 11b0688e95..f3a6b22322 100644
--- a/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.mm
+++ b/modules/juce_graphics/native/juce_CoreGraphicsContext_mac.mm
@@ -227,7 +227,7 @@ private:
if (filter == nullptr || context == nullptr)
return false;
- const ImagePtr content { CGBitmapContextCreateImage (context.get()) };
+ const detail::ImagePtr content { CGBitmapContextCreateImage (context.get()) };
if (content == nullptr)
return false;
diff --git a/modules/juce_graphics/unicode/juce_UnicodeBidi.cpp b/modules/juce_graphics/unicode/juce_UnicodeBidi.cpp
index bd28dacf53..14c66ceadf 100644
--- a/modules/juce_graphics/unicode/juce_UnicodeBidi.cpp
+++ b/modules/juce_graphics/unicode/juce_UnicodeBidi.cpp
@@ -177,13 +177,13 @@ public:
return text.size();
}
- BidiParagraph createParagraph (size_t offset, std::optional d = {}) const
+ BidiParagraph createParagraph (size_t offset, std::optional d = {}) const
{
BidiParagraph::ParagraphPtr result { SBAlgorithmCreateParagraph (algorithm.get(), offset, text.size() - offset, [&]() -> SBLevel
{
if (! d.has_value())
return SBLevelDefaultLTR;
- return *d == TextDirection::rtl ? 1 : 0;
+ return *d == detail::TextDirection::rtl ? 1 : 0;
}()) };
jassert (result != nullptr);
@@ -192,7 +192,7 @@ public:
}
template
- void forEachParagraph (Fn&& callback, std::optional dir = {}) const
+ void forEachParagraph (Fn&& callback, std::optional dir = {}) const
{
for (size_t i = 0; i < text.size();)
{
diff --git a/modules/juce_graphics/unicode/juce_UnicodeUtils.cpp b/modules/juce_graphics/unicode/juce_UnicodeUtils.cpp
index 8a08882b15..963711c6da 100644
--- a/modules/juce_graphics/unicode/juce_UnicodeUtils.cpp
+++ b/modules/juce_graphics/unicode/juce_UnicodeUtils.cpp
@@ -82,12 +82,4 @@ enum class TextBreakType
hard // The sequence of characters must be broken here.
};
-/** Types of text direction. This may also be applied to characters. */
-enum class TextDirection
-{
- ltr, // This text reads left to right.
-
- rtl // This text reads right to left.
-};
-
} // namespace juce