diff --git a/examples/DemoRunner/Builds/Android/app/CMakeLists.txt b/examples/DemoRunner/Builds/Android/app/CMakeLists.txt
index 65fa2fec31..c6e45fc783 100644
--- a/examples/DemoRunner/Builds/Android/app/CMakeLists.txt
+++ b/examples/DemoRunner/Builds/Android/app/CMakeLists.txt
@@ -1816,6 +1816,8 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/fonts/juce_AttributedString.h"
"../../../../../modules/juce_graphics/fonts/juce_Font.cpp"
"../../../../../modules/juce_graphics/fonts/juce_Font.h"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.cpp"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.h"
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
@@ -4279,6 +4281,8 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/fonts/juce_AttributedString.h"
"../../../../../modules/juce_graphics/fonts/juce_Font.cpp"
"../../../../../modules/juce_graphics/fonts/juce_Font.h"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.cpp"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.h"
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
diff --git a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj
index f9a3a9870c..b8de083eaa 100644
--- a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj
+++ b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj
@@ -2099,6 +2099,9 @@
true
+
+ true
+
true
@@ -4129,6 +4132,7 @@
+
diff --git a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters
index 84305e8f7a..f9c307fda5 100644
--- a/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters
+++ b/examples/DemoRunner/Builds/VisualStudio2017/DemoRunner_App.vcxproj.filters
@@ -2842,6 +2842,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -7125,6 +7128,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj
index a4255c00a8..d207bf8faa 100644
--- a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj
+++ b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj
@@ -2099,6 +2099,9 @@
true
+
+ true
+
true
@@ -4129,6 +4132,7 @@
+
diff --git a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters
index 6eeb97b0f2..61cba2da36 100644
--- a/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters
+++ b/examples/DemoRunner/Builds/VisualStudio2019/DemoRunner_App.vcxproj.filters
@@ -2842,6 +2842,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -7125,6 +7128,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj
index d0019a26b5..828aa0a63b 100644
--- a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj
+++ b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj
@@ -2099,6 +2099,9 @@
true
+
+ true
+
true
@@ -4129,6 +4132,7 @@
+
diff --git a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters
index 5b98ab4c6a..baea853b94 100644
--- a/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters
+++ b/examples/DemoRunner/Builds/VisualStudio2022/DemoRunner_App.vcxproj.filters
@@ -2842,6 +2842,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -7125,6 +7128,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt b/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt
index 79455ed2d1..1706b15855 100644
--- a/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt
+++ b/extras/AudioPerformanceTest/Builds/Android/app/CMakeLists.txt
@@ -1578,6 +1578,8 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/fonts/juce_AttributedString.h"
"../../../../../modules/juce_graphics/fonts/juce_Font.cpp"
"../../../../../modules/juce_graphics/fonts/juce_Font.h"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.cpp"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.h"
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
@@ -3723,6 +3725,8 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/fonts/juce_AttributedString.h"
"../../../../../modules/juce_graphics/fonts/juce_Font.cpp"
"../../../../../modules/juce_graphics/fonts/juce_Font.h"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.cpp"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.h"
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
diff --git a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj
index 5424171854..8de28ff544 100644
--- a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj
+++ b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj
@@ -1792,6 +1792,9 @@
true
+
+ true
+
true
@@ -3600,6 +3603,7 @@
+
diff --git a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters
index 2020cd121d..117daacffe 100644
--- a/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters
+++ b/extras/AudioPerformanceTest/Builds/VisualStudio2022/AudioPerformanceTest_App.vcxproj.filters
@@ -2386,6 +2386,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -6180,6 +6183,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt b/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt
index 29f65fbbb5..0f8287fc49 100644
--- a/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt
+++ b/extras/AudioPluginHost/Builds/Android/app/CMakeLists.txt
@@ -1708,6 +1708,8 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/fonts/juce_AttributedString.h"
"../../../../../modules/juce_graphics/fonts/juce_Font.cpp"
"../../../../../modules/juce_graphics/fonts/juce_Font.h"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.cpp"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.h"
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
@@ -4006,6 +4008,8 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/fonts/juce_AttributedString.h"
"../../../../../modules/juce_graphics/fonts/juce_Font.cpp"
"../../../../../modules/juce_graphics/fonts/juce_Font.h"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.cpp"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.h"
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
diff --git a/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj b/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj
index 22528f886d..61fe6a6794 100644
--- a/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj
+++ b/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj
@@ -1926,6 +1926,9 @@
true
+
+ true
+
true
@@ -3833,6 +3836,7 @@
+
diff --git a/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj.filters b/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj.filters
index 121ec973e0..d2b4b10391 100644
--- a/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj.filters
+++ b/extras/AudioPluginHost/Builds/VisualStudio2017/AudioPluginHost_App.vcxproj.filters
@@ -2593,6 +2593,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -6615,6 +6618,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj
index 0f33de5c25..73644dde1e 100644
--- a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj
+++ b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj
@@ -1926,6 +1926,9 @@
true
+
+ true
+
true
@@ -3833,6 +3836,7 @@
+
diff --git a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters
index 051045c79b..2a47b5ca5a 100644
--- a/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters
+++ b/extras/AudioPluginHost/Builds/VisualStudio2019/AudioPluginHost_App.vcxproj.filters
@@ -2593,6 +2593,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -6615,6 +6618,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj
index 0f7e15c5c7..c15e7d054d 100644
--- a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj
+++ b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj
@@ -1926,6 +1926,9 @@
true
+
+ true
+
true
@@ -3833,6 +3836,7 @@
+
diff --git a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters
index ee8e10c962..7fb8c1db63 100644
--- a/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters
+++ b/extras/AudioPluginHost/Builds/VisualStudio2022/AudioPluginHost_App.vcxproj.filters
@@ -2593,6 +2593,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -6615,6 +6618,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt b/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt
index 5a95129c4d..bd2c40150c 100644
--- a/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt
+++ b/extras/NetworkGraphicsDemo/Builds/Android/app/CMakeLists.txt
@@ -1597,6 +1597,8 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/fonts/juce_AttributedString.h"
"../../../../../modules/juce_graphics/fonts/juce_Font.cpp"
"../../../../../modules/juce_graphics/fonts/juce_Font.h"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.cpp"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.h"
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
@@ -3822,6 +3824,8 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/fonts/juce_AttributedString.h"
"../../../../../modules/juce_graphics/fonts/juce_Font.cpp"
"../../../../../modules/juce_graphics/fonts/juce_Font.h"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.cpp"
+ "../../../../../modules/juce_graphics/fonts/juce_FontOptions.h"
"../../../../../modules/juce_graphics/fonts/juce_FunctionPointerDestructor.h"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.cpp"
"../../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"
diff --git a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj
index db213f6e58..e9a28335de 100644
--- a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj
+++ b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj
@@ -1813,6 +1813,9 @@
true
+
+ true
+
true
@@ -3698,6 +3701,7 @@
+
diff --git a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters
index 36248579ea..ba8d0c9238 100644
--- a/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters
+++ b/extras/NetworkGraphicsDemo/Builds/VisualStudio2022/NetworkGraphicsDemo_App.vcxproj.filters
@@ -2440,6 +2440,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -6342,6 +6345,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj
index 424647afa0..e95b2691a4 100644
--- a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj
+++ b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj
@@ -995,6 +995,9 @@
true
+
+ true
+
true
@@ -2515,6 +2518,7 @@
+
diff --git a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters
index 519d64ada2..20fd36b78e 100644
--- a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters
+++ b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters
@@ -1384,6 +1384,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -4320,6 +4323,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj
index 2e168a0f2e..d87438d34f 100644
--- a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj
+++ b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj
@@ -995,6 +995,9 @@
true
+
+ true
+
true
@@ -2515,6 +2518,7 @@
+
diff --git a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters
index 005aeba715..e1dbaedfd8 100644
--- a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters
+++ b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters
@@ -1384,6 +1384,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -4320,6 +4323,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj
index f2b3c79bbe..eaedbc99e6 100644
--- a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj
+++ b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj
@@ -995,6 +995,9 @@
true
+
+ true
+
true
@@ -2515,6 +2518,7 @@
+
diff --git a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters
index a6209cb05f..3dccdef069 100644
--- a/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters
+++ b/extras/Projucer/Builds/VisualStudio2022/Projucer_App.vcxproj.filters
@@ -1384,6 +1384,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -4320,6 +4323,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj
index 19240d440c..aabfed027d 100644
--- a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj
+++ b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj
@@ -1934,6 +1934,9 @@
true
+
+ true
+
true
@@ -3929,6 +3932,7 @@
+
diff --git a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters
index 7d5fcf5886..c73acc02a1 100644
--- a/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters
+++ b/extras/UnitTestRunner/Builds/VisualStudio2017/UnitTestRunner_ConsoleApp.vcxproj.filters
@@ -2614,6 +2614,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -6729,6 +6732,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj
index 010f8378f6..4f7d46d0b1 100644
--- a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj
+++ b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj
@@ -1934,6 +1934,9 @@
true
+
+ true
+
true
@@ -3929,6 +3932,7 @@
+
diff --git a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters
index afaaf988e3..acfc3f64a6 100644
--- a/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters
+++ b/extras/UnitTestRunner/Builds/VisualStudio2019/UnitTestRunner_ConsoleApp.vcxproj.filters
@@ -2614,6 +2614,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -6729,6 +6732,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj
index 3bbdb0d372..467bcde3e2 100644
--- a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj
+++ b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj
@@ -1934,6 +1934,9 @@
true
+
+ true
+
true
@@ -3929,6 +3932,7 @@
+
diff --git a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters
index cab8e35a72..1eafbe3025 100644
--- a/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters
+++ b/extras/UnitTestRunner/Builds/VisualStudio2022/UnitTestRunner_ConsoleApp.vcxproj.filters
@@ -2614,6 +2614,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -6729,6 +6732,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj
index c1cfdd0030..f0d9cc2549 100644
--- a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj
+++ b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj
@@ -1812,6 +1812,9 @@
true
+
+ true
+
true
@@ -3674,6 +3677,7 @@
+
diff --git a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj.filters b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj.filters
index 6d3e0d1dad..439a969381 100644
--- a/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj.filters
+++ b/extras/WindowsDLL/Builds/VisualStudio2022/WindowsDLL_StaticLibrary.vcxproj.filters
@@ -2437,6 +2437,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
@@ -6309,6 +6312,9 @@
JUCE Modules\juce_graphics\fonts
+
+ JUCE Modules\juce_graphics\fonts
+
JUCE Modules\juce_graphics\fonts
diff --git a/modules/juce_graphics/fonts/juce_Font.cpp b/modules/juce_graphics/fonts/juce_Font.cpp
index 371e350c0f..93fa398a81 100644
--- a/modules/juce_graphics/fonts/juce_Font.cpp
+++ b/modules/juce_graphics/fonts/juce_Font.cpp
@@ -41,17 +41,6 @@ public:
HbFont font{};
};
-namespace FontValues
-{
- static float limitFontHeight (const float height) noexcept
- {
- return jlimit (0.1f, 10000.0f, height);
- }
-
- const float defaultFontHeight = 14.0f;
- float minimumHorizontalScale = 0.7f;
-}
-
using GetTypefaceForFont = Typeface::Ptr (*)(const Font&);
GetTypefaceForFont juce_getTypefaceForFont = nullptr;
@@ -201,93 +190,24 @@ void Typeface::clearTypefaceCache()
class Font::SharedFontInternal : public ReferenceCountedObject
{
public:
- SharedFontInternal() noexcept
- : typeface (TypefaceCache::getInstance()->getDefaultFace()),
- typefaceName (Font::getDefaultSansSerifFontName()),
- typefaceStyle (Font::getDefaultStyle()),
- height (FontValues::defaultFontHeight)
+ explicit SharedFontInternal (FontOptions x)
+ : options (std::move (x))
{
}
- SharedFontInternal (int styleFlags, float fontHeight) noexcept
- : typefaceName (Font::getDefaultSansSerifFontName()),
- typefaceStyle (FontStyleHelpers::getStyleName (styleFlags)),
- height (fontHeight),
- underline ((styleFlags & underlined) != 0)
+ ReferenceCountedObjectPtr copy() const
{
- if (styleFlags == plain)
- typeface = TypefaceCache::getInstance()->getDefaultFace();
+ const ScopedLock lock (mutex);
+ return new SharedFontInternal (typeface, options);
}
- SharedFontInternal (const String& name, int styleFlags, float fontHeight) noexcept
- : typefaceName (name),
- typefaceStyle (FontStyleHelpers::getStyleName (styleFlags)),
- height (fontHeight),
- underline ((styleFlags & underlined) != 0)
- {
- if (styleFlags == plain && typefaceName.isEmpty())
- typeface = TypefaceCache::getInstance()->getDefaultFace();
- }
-
- SharedFontInternal (const String& name, const String& style, float fontHeight) noexcept
- : typefaceName (name), typefaceStyle (style), height (fontHeight)
- {
- if (typefaceName.isEmpty())
- typefaceName = Font::getDefaultSansSerifFontName();
- }
-
- explicit SharedFontInternal (const Typeface::Ptr& face) noexcept
- : typeface (face),
- typefaceName (face->getName()),
- typefaceStyle (face->getStyle()),
- height (FontValues::defaultFontHeight)
- {
- jassert (typefaceName.isNotEmpty());
- }
-
- SharedFontInternal (const SharedFontInternal& other) noexcept
- : ReferenceCountedObject(),
- typeface (other.typeface),
- typefaceName (other.typefaceName),
- typefaceStyle (other.typefaceStyle),
- height (other.height),
- horizontalScale (other.horizontalScale),
- kerning (other.kerning),
- ascent (other.ascent),
- underline (other.underline)
- {
- }
-
- auto tie() const
- {
- return std::tie (height, underline, horizontalScale, kerning, typefaceName, typefaceStyle);
- }
-
- bool operator== (const SharedFontInternal& other) const noexcept
- {
- return tie() == other.tie();
- }
-
- bool operator< (const SharedFontInternal& other) const noexcept
- {
- return tie() < other.tie();
- }
-
- /* The typeface and ascent data members may be read/set from multiple threads
- simultaneously, e.g. in the case that two Font instances reference the same
- SharedFontInternal and call getTypefacePtr() simultaneously.
-
- We lock in functions that modify the typeface or ascent in order to
- ensure thread safety.
- */
-
Typeface::Ptr getTypefacePtr (const Font& f)
{
const ScopedLock lock (mutex);
if (typeface == nullptr)
{
- typeface = TypefaceCache::getInstance()->findTypefaceFor (f);
+ typeface = options.getTypeface() != nullptr ? options.getTypeface() : TypefaceCache::getInstance()->findTypefaceFor (f);
jassert (typeface != nullptr);
}
@@ -315,7 +235,7 @@ public:
if (approximatelyEqual (ascent, 0.0f))
ascent = getTypefacePtr (f)->getAscent();
- return height * ascent;
+ return getHeight() * ascent;
}
/* We do not need to lock in these functions, as it's guaranteed
@@ -323,14 +243,19 @@ public:
instance referencing the shared state.
*/
- StringArray getFallbackFamilies() const { return fallbacks; }
- String getTypefaceName() const { return typefaceName; }
- String getTypefaceStyle() const { return typefaceStyle; }
- float getHeight() const { return height; }
- float getHorizontalScale() const { return horizontalScale; }
- float getKerning() const { return kerning; }
- bool getUnderline() const { return underline; }
- bool getFallbackEnabled() const { return fallback; }
+ StringArray getFallbackFamilies() const
+ {
+ const auto fallbacks = options.getFallbacks();
+ return StringArray (fallbacks.data(), (int) fallbacks.size());
+ }
+
+ String getTypefaceName() const { return options.getName(); }
+ String getTypefaceStyle() const { return options.getStyle(); }
+ float getHeight() const { return options.getHeight(); }
+ float getHorizontalScale() const { return options.getHorizontalScale(); }
+ float getKerning() const { return options.getKerningFactor(); }
+ bool getUnderline() const { return options.getUnderline(); }
+ bool getFallbackEnabled() const { return options.getFallbackEnabled(); }
/* This shared state may be shared between two or more Font instances that are being
read/modified from multiple threads.
@@ -344,41 +269,42 @@ public:
jassert (getReferenceCount() == 1);
typeface = newTypeface;
- if (newTypeface != nullptr)
+ if (typeface != nullptr)
{
- typefaceName = typeface->getName();
- typefaceStyle = typeface->getStyle();
+ options = options.withTypeface (typeface)
+ .withName (typeface->getName())
+ .withStyle (typeface->getStyle());
}
}
void setTypefaceName (String x)
{
jassert (getReferenceCount() == 1);
- typefaceName = std::move (x);
+ options = options.withName (x);
}
void setTypefaceStyle (String x)
{
jassert (getReferenceCount() == 1);
- typefaceStyle = std::move (x);
+ options = options.withStyle (x);
}
void setHeight (float x)
{
jassert (getReferenceCount() == 1);
- height = x;
+ options = options.withHeight (x);
}
void setHorizontalScale (float x)
{
jassert (getReferenceCount() == 1);
- horizontalScale = x;
+ options = options.withHorizontalScale (x);
}
void setKerning (float x)
{
jassert (getReferenceCount() == 1);
- kerning = x;
+ options = options.withKerningFactor (x);
}
void setAscent (float x)
@@ -390,71 +316,79 @@ public:
void setUnderline (bool x)
{
jassert (getReferenceCount() == 1);
- underline = x;
+ options = options.withUnderline (x);
}
void setFallbackFamilies (const StringArray& x)
{
jassert (getReferenceCount() == 1);
- fallbacks = x;
+ options = options.withFallbacks ({ x.begin(), x.end() });
}
void setFallback (bool x)
{
jassert (getReferenceCount() == 1);
- fallback = x;
+ options = options.withFallbackEnabled (x);
+ }
+
+ bool operator== (const SharedFontInternal& other) const
+ {
+ return options == other.options;
+ }
+
+ bool operator< (const SharedFontInternal& other) const
+ {
+ return options < other.options;
}
private:
- static float legacyHeightToPoints (Typeface::Ptr p, float h)
+ SharedFontInternal (Typeface::Ptr t, FontOptions o)
+ : typeface (t), options (std::move (o))
{
- return h * p->getNativeDetails().getLegacyMetrics().getHeightToPointsFactor();
}
Typeface::Ptr typeface;
- StringArray fallbacks;
- String typefaceName, typefaceStyle;
- float height = 0.0f, horizontalScale = 1.0f, kerning = 0.0f, ascent = 0.0f;
- bool underline = false;
- bool fallback = true;
-
+ float ascent{};
+ FontOptions options;
CriticalSection mutex;
};
//==============================================================================
-Font::Font() : font (new SharedFontInternal()) {}
-Font::Font (const Typeface::Ptr& typeface) : font (new SharedFontInternal (typeface)) {}
+Font::Font() : font (new SharedFontInternal (FontOptions{})) {}
+Font::Font (const Typeface::Ptr& typeface) : font (new SharedFontInternal (FontOptions { typeface })) {}
Font::Font (const Font& other) noexcept : font (other.font) {}
Font::Font (float fontHeight, int styleFlags)
- : font (new SharedFontInternal (styleFlags, FontValues::limitFontHeight (fontHeight)))
+ : font (new SharedFontInternal (FontOptions { fontHeight, styleFlags }))
{
}
Font::Font (const String& typefaceName, float fontHeight, int styleFlags)
- : font (new SharedFontInternal (typefaceName, styleFlags, FontValues::limitFontHeight (fontHeight)))
+ : font (new SharedFontInternal (FontOptions { typefaceName, fontHeight, styleFlags }))
{
}
Font::Font (const String& typefaceName, const String& typefaceStyle, float fontHeight)
- : font (new SharedFontInternal (typefaceName, typefaceStyle, FontValues::limitFontHeight (fontHeight)))
+ : font (new SharedFontInternal (FontOptions { typefaceName, typefaceStyle, fontHeight }))
{
}
Font& Font::operator= (const Font& other) noexcept
{
- font = other.font;
+ Font copy { other };
+ std::swap (copy.font, font);
return *this;
}
Font::Font (Font&& other) noexcept
- : font (std::move (other.font))
+ : font (std::exchange (other.font, {}))
{
}
Font& Font::operator= (Font&& other) noexcept
{
- font = std::move (other.font);
+ Font copy { std::move (other) };
+ std::swap (copy.font, font);
return *this;
}
@@ -479,7 +413,7 @@ bool Font::compare (const Font& a, const Font& b) noexcept
void Font::dupeInternalIfShared()
{
if (font->getReferenceCount() > 1)
- font = *new SharedFontInternal (*font);
+ font = font->copy();
}
//==============================================================================
diff --git a/modules/juce_graphics/fonts/juce_Font.h b/modules/juce_graphics/fonts/juce_Font.h
index d2033c6ef8..2b2114265f 100644
--- a/modules/juce_graphics/fonts/juce_Font.h
+++ b/modules/juce_graphics/fonts/juce_Font.h
@@ -35,7 +35,6 @@
namespace juce
{
-//==============================================================================
/**
Represents a particular font, including its size, style, etc.
diff --git a/modules/juce_graphics/fonts/juce_FontOptions.cpp b/modules/juce_graphics/fonts/juce_FontOptions.cpp
new file mode 100644
index 0000000000..387eb389ba
--- /dev/null
+++ b/modules/juce_graphics/fonts/juce_FontOptions.cpp
@@ -0,0 +1,109 @@
+/*
+ ==============================================================================
+
+ 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
+{
+
+struct FontValues
+{
+ static float limitFontHeight (const float height) noexcept
+ {
+ return jlimit (0.1f, 10000.0f, height);
+ }
+
+ inline static constexpr float defaultFontHeight = 14.0f;
+ static float minimumHorizontalScale;
+
+ FontValues() = delete;
+};
+
+float FontValues::minimumHorizontalScale = 0.7f;
+
+FontOptions::FontOptions()
+ : FontOptions (FontValues::defaultFontHeight, Font::plain)
+{
+}
+
+FontOptions::FontOptions (float fontHeight)
+ : FontOptions (fontHeight, Font::plain)
+{
+}
+
+FontOptions::FontOptions (float fontHeight, int styleFlags)
+ : FontOptions ({}, fontHeight, styleFlags)
+{
+}
+
+FontOptions::FontOptions (const String& typefaceName, float fontHeight, int styleFlags)
+ : FontOptions (typefaceName, FontStyleHelpers::getStyleName (styleFlags), fontHeight)
+{
+ underlined = (styleFlags & Font::FontStyleFlags::underlined) != 0;
+}
+
+FontOptions::FontOptions (const String& typefaceName, const String& typefaceStyle, float fontHeight)
+ : name (typefaceName.isEmpty() ? Font::getDefaultSansSerifFontName() : typefaceName),
+ style (typefaceStyle),
+ height (FontValues::limitFontHeight (fontHeight))
+{
+}
+
+FontOptions::FontOptions (const Typeface::Ptr& ptr)
+ : name (ptr->getName()),
+ style (ptr->getStyle()),
+ typeface (ptr),
+ height (FontValues::defaultFontHeight)
+{
+}
+
+auto FontOptions::tie() const
+{
+ return std::tuple (name,
+ style,
+ typeface.get(),
+ fallbacks,
+ height,
+ tracking,
+ horizontalScale,
+ fallbackEnabled,
+ underlined);
+}
+
+bool FontOptions::operator== (const FontOptions& other) const { return tie() == other.tie(); }
+bool FontOptions::operator!= (const FontOptions& other) const { return tie() != other.tie(); }
+bool FontOptions::operator< (const FontOptions& other) const { return tie() < other.tie(); }
+bool FontOptions::operator<= (const FontOptions& other) const { return tie() <= other.tie(); }
+bool FontOptions::operator> (const FontOptions& other) const { return tie() > other.tie(); }
+bool FontOptions::operator>= (const FontOptions& other) const { return tie() >= other.tie(); }
+
+} // namespace juce
diff --git a/modules/juce_graphics/fonts/juce_FontOptions.h b/modules/juce_graphics/fonts/juce_FontOptions.h
new file mode 100644
index 0000000000..87fe5a65b4
--- /dev/null
+++ b/modules/juce_graphics/fonts/juce_FontOptions.h
@@ -0,0 +1,169 @@
+/*
+ ==============================================================================
+
+ 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
+{
+
+/**
+ Options that describe a particular font.
+
+ Used to construct Font instances in a fluent style.
+
+ @see Typeface, Font
+
+ @tags{Graphics}
+*/
+class JUCE_API FontOptions final
+{
+public:
+ /** Constructs the default set of options. */
+ FontOptions();
+
+ /** Constructs the default set of options with a custom height. */
+ explicit FontOptions (float fontHeight);
+
+ /** Constructs the default set of options with a custom height and style.
+
+ @param fontHeight the height in pixels (can be fractional)
+ @param styleFlags the style to use - this can be a combination of the
+ Font::bold, Font::italic and Font::underlined, or
+ just Font::plain for the normal style.
+
+ @see Font::FontStyleFlags, Font::getDefaultSansSerifFontName
+ */
+ FontOptions (float fontHeight, int styleFlags);
+
+ /** Constructs the default set of options with a given typeface and parameters.
+
+ @param typefaceName the font family of the typeface to use
+ @param fontHeight the height in pixels (can be fractional)
+ @param styleFlags the style to use - this can be a combination of the
+ Font::bold, Font::italic and Font::underlined, or
+ just Font::plain for the normal style.
+ @see Font::FontStyleFlags, Font::getDefaultSansSerifFontName
+ */
+ FontOptions (const String& typefaceName, float fontHeight, int styleFlags);
+
+ /** Constructs the default set of options with a given typeface and parameters.
+
+ @param typefaceName the font family of the typeface to use
+ @param typefaceStyle the font style of the typeface to use
+ @param fontHeight the height in pixels (can be fractional)
+ */
+ FontOptions (const String& typefaceName, const String& typefaceStyle, float fontHeight);
+
+ /** Constructs the default set of options with a given typeface. */
+ FontOptions (const Typeface::Ptr& typeface);
+
+ /** Returns a copy of these options with a new typeface name.
+ If the options include a non-null Typeface::Ptr, this will be ignored.
+ Otherwise, a suitable typeface will be located based on the typeface name and style strings.
+ */
+ [[nodiscard]] FontOptions withName (String x) const { return withMember (*this, &FontOptions::name, x); }
+
+ /** Returns a copy of these options with a new typeface style.
+ If the options include a non-null Typeface::Ptr, this will be ignored.
+ Otherwise, a suitable typeface will be located based on the typeface name and style strings.
+ */
+ [[nodiscard]] FontOptions withStyle (String x) const { return withMember (*this, &FontOptions::style, x); }
+
+ /** Returns a copy of these options with a new typeface.
+ If the typeface is non-null, it takes precedence over the name and style strings.
+ */
+ [[nodiscard]] FontOptions withTypeface (Typeface::Ptr x) const { return withMember (*this, &FontOptions::typeface, x); }
+
+ /** Returns a copy of these options with a new set of preferred fallback family names. */
+ [[nodiscard]] FontOptions withFallbacks (std::vector x) const { return withMember (*this, &FontOptions::fallbacks, std::move (x)); }
+
+ /** Returns a copy of these options with font fallback enabled or disabled. */
+ [[nodiscard]] FontOptions withFallbackEnabled (bool x = true) const { return withMember (*this, &FontOptions::fallbackEnabled, x); }
+
+ /** Returns a copy of these options with the specified height in pixels (can be fractional). */
+ [[nodiscard]] FontOptions withHeight (float x) const { return withMember (*this, &FontOptions::height, x); }
+
+ /** Returns a copy of these options with the specified extra kerning factor (also called "tracking"). */
+ [[nodiscard]] FontOptions withKerningFactor (float x) const { return withMember (*this, &FontOptions::tracking, x); }
+
+ /** Returns a copy of these options with the specified horizontal scale factor, defaults to 1.0. */
+ [[nodiscard]] FontOptions withHorizontalScale (float x) const { return withMember (*this, &FontOptions::horizontalScale, x); }
+
+ /** Returns a copy of these options with underline enabled or disabled, defaults to disabled. */
+ [[nodiscard]] FontOptions withUnderline (bool x = true) const { return withMember (*this, &FontOptions::underlined, x); }
+
+ /** @see withName() */
+ [[nodiscard]] auto getName() const { return name; }
+ /** @see withStyle() */
+ [[nodiscard]] auto getStyle() const { return style; }
+ /** @see withTypeface() */
+ [[nodiscard]] auto getTypeface() const { return typeface; }
+ /** @see withFallbacks() */
+ [[nodiscard]] auto getFallbacks() const { return fallbacks; }
+ /** @see withHeight() */
+ [[nodiscard]] auto getHeight() const { return height; }
+ /** @see withKerningFactor() */
+ [[nodiscard]] auto getKerningFactor() const { return tracking; }
+ /** @see withHorizontalScale() */
+ [[nodiscard]] auto getHorizontalScale() const { return horizontalScale; }
+ /** @see withFallbackEnabled() */
+ [[nodiscard]] auto getFallbackEnabled() const { return fallbackEnabled; }
+ /** @see withUnderline() */
+ [[nodiscard]] auto getUnderline() const { return underlined; }
+
+ /** Equality operator. */
+ [[nodiscard]] bool operator== (const FontOptions& other) const;
+ /** Inequality operator. */
+ [[nodiscard]] bool operator!= (const FontOptions& other) const;
+ /** Less-than operator. Allows FontOptions to be used as keys in a map. */
+ [[nodiscard]] bool operator< (const FontOptions& other) const;
+ /** Less-than-or-equal operator. */
+ [[nodiscard]] bool operator<= (const FontOptions& other) const;
+ /** Greater-than operator. */
+ [[nodiscard]] bool operator> (const FontOptions& other) const;
+ /** Greater-than-or-equal operator. */
+ [[nodiscard]] bool operator>= (const FontOptions& other) const;
+
+private:
+ auto tie() const;
+
+ String name, style;
+ Typeface::Ptr typeface;
+ std::vector fallbacks;
+ float height{};
+ float tracking{};
+ float horizontalScale = 1.0f;
+ bool fallbackEnabled = true;
+ bool underlined{};
+};
+
+} // namespace juce
diff --git a/modules/juce_graphics/juce_graphics.cpp b/modules/juce_graphics/juce_graphics.cpp
index 87b661a3dc..85f4f3c931 100644
--- a/modules/juce_graphics/juce_graphics.cpp
+++ b/modules/juce_graphics/juce_graphics.cpp
@@ -143,6 +143,7 @@
#include "image_formats/juce_PNGLoader.cpp"
#include "fonts/juce_AttributedString.cpp"
#include "fonts/juce_Typeface.cpp"
+#include "fonts/juce_FontOptions.cpp"
#include "fonts/juce_Font.cpp"
#include "fonts/juce_GlyphArrangement.cpp"
#include "fonts/juce_TextLayout.cpp"
diff --git a/modules/juce_graphics/juce_graphics.h b/modules/juce_graphics/juce_graphics.h
index 3054e337eb..683f98cef9 100644
--- a/modules/juce_graphics/juce_graphics.h
+++ b/modules/juce_graphics/juce_graphics.h
@@ -144,6 +144,7 @@ namespace juce
#include "images/juce_Image.h"
#include "colour/juce_FillType.h"
#include "fonts/juce_Typeface.h"
+#include "fonts/juce_FontOptions.h"
#include "fonts/juce_Font.h"
#include "fonts/juce_AttributedString.h"
#include "fonts/juce_GlyphArrangement.h"