diff --git a/docs/configuration/profiles.md b/docs/configuration/profiles.md
index 579e03cb02..92efda719d 100644
--- a/docs/configuration/profiles.md
+++ b/docs/configuration/profiles.md
@@ -292,7 +292,7 @@ profiles:
```
:octicons-horizontal-rule-16: ==size== Specifies the initial font size in pixels. The default value is 12.
:octicons-horizontal-rule-16: ==dpi_scale== Allows applying a DPI scaling factor on top of the system's configured DPI. The default value is 1.0.
-:octicons-horizontal-rule-16: ==locator== Determines the font locator engine to use for locating font files and font fallback. Possible values are native, fontconfig, CoreText, and DirectWrite.
+:octicons-horizontal-rule-16: ==locator== Determines the font locator engine to use for locating font files and font fallback. Possible values are `native` and `mock`.
`native` will use the operating-system native font location service (e.g. CoreText on macOS and DirectWrite on Windows), whereas `mock` is solely used for testing the software (not recommended by end-users)
:octicons-horizontal-rule-16: ==text_shaping.engine== Selects the text shaping and font rendering engine. Supported values are native, DirectWrite, CoreText, and OpenShaper.
:octicons-horizontal-rule-16: ==builtin_box_drawing== Specifies whether to use built-in textures for pixel-perfect box drawing. If disabled, the font's provided box drawing characters will be used. The default value is true.
:octicons-horizontal-rule-16: ==render_mode== Specifies the font render mode, which tells the font rasterizer engine what rendering technique to use. Available modes are lcd, light, gray, and monochrome.
@@ -434,8 +434,8 @@ profiles:
With this, the terminal will use the color scheme as specified in `dark` when OS dark mode is on,
and `light`'s color scheme otherwise.
-
-
+
+
### `hyperlink_decoration:`
section in the configuration file allows you to configure the styling and colorization of hyperlinks when they are displayed in the terminal and when they are hovered over by the cursor.
@@ -446,7 +446,7 @@ profiles:
profile_name:
hyperlink_decoration:
normal: dotted
- hover: underline
+ hover: underline
```
diff --git a/metainfo.xml b/metainfo.xml
index 8847bf17c4..97d4fa6bff 100644
--- a/metainfo.xml
+++ b/metainfo.xml
@@ -122,6 +122,7 @@
Add config entry to configure behaviour on exit from search mode
Add handling of different input commands (#629)
Update of contour.desktop file (#1423)
+ Changed configuration entry values for `font_locator` down to `native` and `mock` only (#1538).
Fixes forwarding of input while in normal mode (#1468)
Fixes OSC-8 link id collision (#1499)
Fixed overlap of glyphs for long codepoints (#1349)
diff --git a/src/contour/Config.cpp b/src/contour/Config.cpp
index 511543fef2..1d6e1cc9c2 100644
--- a/src/contour/Config.cpp
+++ b/src/contour/Config.cpp
@@ -1072,23 +1072,18 @@ void YAMLConfigReader::loadFromEntry(YAML::Node const& node,
std::string const& entry,
vtrasterizer::FontLocatorEngine& where)
{
- auto constexpr NativeFontLocator =
-#if defined(_WIN32)
- vtrasterizer::FontLocatorEngine::DWrite;
-#elif defined(__APPLE__)
- vtrasterizer::FontLocatorEngine::CoreText;
-#else
- vtrasterizer::FontLocatorEngine::FontConfig;
-#endif
+ auto constexpr NativeFontLocator = vtrasterizer::FontLocatorEngine::Native;
auto parseModifierKey = [&](std::string const& key) -> std::optional {
auto const literal = crispy::toLower(key);
logger()("Loading entry: {}, value {}", entry, literal);
- if (literal == "fontconfig")
- return vtrasterizer::FontLocatorEngine::FontConfig;
- if (literal == "coretext")
- return vtrasterizer::FontLocatorEngine::CoreText;
- if (literal == "dwrite" || literal == "directwrite")
- return vtrasterizer::FontLocatorEngine::DWrite;
+ for (auto const& deprecated: { "fontconfig", "coretext", "dwrite", "directwrite" })
+ {
+ if (literal == deprecated)
+ {
+ errorLog()("Setting font locator to \"{}\" is deprecated. Use \"native\".", literal);
+ return NativeFontLocator;
+ }
+ }
if (literal == "native")
return NativeFontLocator;
if (literal == "mock")
diff --git a/src/contour/Config.h b/src/contour/Config.h
index 8f66b4c787..f54197dca3 100644
--- a/src/contour/Config.h
+++ b/src/contour/Config.h
@@ -286,7 +286,7 @@ const inline vtrasterizer::FontDescriptions defaultFont = vtrasterizer::FontDesc
.emoji = text::font_description { .familyName = { "emoji" } },
.renderMode = text::render_mode::gray,
.textShapingEngine = vtrasterizer::TextShapingEngine::OpenShaper,
- .fontLocator = vtrasterizer::FontLocatorEngine::FontConfig,
+ .fontLocator = vtrasterizer::FontLocatorEngine::Native,
.builtinBoxDrawing = true,
};
diff --git a/src/contour/ConfigDocumentation.h b/src/contour/ConfigDocumentation.h
index d5f5652d07..e1357161ff 100644
--- a/src/contour/ConfigDocumentation.h
+++ b/src/contour/ConfigDocumentation.h
@@ -228,9 +228,7 @@ constexpr StringLiteral Fonts {
" {comment} This is implicitly also responsible for font fallback\n"
" {comment} Possible values are:\n"
" {comment} - native : automatically choose the best available on the current platform\n"
- " {comment} - fontconfig : uses fontconfig to select fonts\n"
- " {comment} - CoreText : uses OS/X CoreText to select fonts.\n"
- " {comment} - DirectWrite : selects DirectWrite engine (Windows only)\n"
+ " {comment} - mock : mock font locator engine (not recommended for general use)\n"
" locator: {}\n"
"\n"
" {comment} Text shaping related settings\n"
diff --git a/src/contour/contour.yml b/src/contour/contour.yml
index 2597e483fd..2fc2e6e422 100644
--- a/src/contour/contour.yml
+++ b/src/contour/contour.yml
@@ -370,9 +370,7 @@ profiles:
# This is implicitly also responsible for font fallback
# Possible values are:
# - native : automatically choose the best available on the current platform
- # - fontconfig : uses fontconfig to select fonts
- # - CoreText : uses macOS CoreText to select fonts.
- # - DirectWrite : selects DirectWrite engine (Windows only)
+ # - mock : a mock locator that does not actually locate any fonts (for development testing)
locator: native
# Text shaping related settings
diff --git a/src/text_shaper/CMakeLists.txt b/src/text_shaper/CMakeLists.txt
index 341e84305d..9d04001e91 100644
--- a/src/text_shaper/CMakeLists.txt
+++ b/src/text_shaper/CMakeLists.txt
@@ -2,7 +2,6 @@ set(text_shaper_SRC
font.cpp font.h
font_locator.h
font_locator_provider.cpp font_locator_provider.h
- fontconfig_locator.cpp fontconfig_locator.h
mock_font_locator.cpp mock_font_locator.h
open_shaper.cpp open_shaper.h
shaper.cpp shaper.h
@@ -16,6 +15,9 @@ endif()
if(APPLE)
list(APPEND text_shaper_SRC coretext_locator.h coretext_locator.mm)
endif()
+if("${CMAKE_SYSTEM}" MATCHES "Linux" OR "${CMAKE_SYSTEM}" MATCHES "FreeBSD")
+ list(APPEND text_shaper_SRC fontconfig_locator.cpp fontconfig_locator.h)
+endif()
# TODO: coretext_shaper.cpp coretext_shaper.h
add_library(text_shaper STATIC ${text_shaper_SRC})
@@ -52,12 +54,10 @@ elseif("${CMAKE_SYSTEM}" MATCHES "Linux" OR "${CMAKE_SYSTEM}" MATCHES "FreeBSD")
list(APPEND TEXT_SHAPER_LIBS Fontconfig::Fontconfig)
elseif("${CMAKE_SYSTEM}" MATCHES "Windows")
# installed via vcpkg
- find_package(Fontconfig REQUIRED)
find_package(harfbuzz CONFIG REQUIRED)
find_package(Freetype REQUIRED)
list(APPEND TEXT_SHAPER_LIBS harfbuzz harfbuzz::harfbuzz)
list(APPEND TEXT_SHAPER_LIBS Freetype::Freetype)
- list(APPEND TEXT_SHAPER_LIBS Fontconfig::Fontconfig)
list(APPEND TEXT_SHAPER_LIBS dwrite)
endif()
diff --git a/src/text_shaper/font_locator_provider.cpp b/src/text_shaper/font_locator_provider.cpp
index dc347a9572..4b1a6884e5 100644
--- a/src/text_shaper/font_locator_provider.cpp
+++ b/src/text_shaper/font_locator_provider.cpp
@@ -18,32 +18,20 @@ font_locator_provider& font_locator_provider::get()
return instance;
}
-#if defined(__APPLE__)
-font_locator& font_locator_provider::coretext()
-{
- if (!_coretext)
- _coretext = make_unique();
-
- return *_coretext;
-}
-#endif
-
-#if defined(_WIN32)
-font_locator& font_locator_provider::directwrite()
+font_locator& font_locator_provider::native()
{
- if (!_directwrite)
- _directwrite = make_unique();
-
- return *_directwrite;
-}
+ if (!_native)
+ {
+#if defined(__APPLE__)
+ _native = make_unique();
+#elif defined(_WIN32)
+ _native = make_unique();
+#else
+ _native = make_unique();
#endif
+ }
-font_locator& font_locator_provider::fontconfig()
-{
- if (!_fontconfig)
- _fontconfig = make_unique();
-
- return *_fontconfig;
+ return *_native;
}
font_locator& font_locator_provider::mock()
diff --git a/src/text_shaper/font_locator_provider.h b/src/text_shaper/font_locator_provider.h
index 5f9120fd02..5ad35a20bc 100644
--- a/src/text_shaper/font_locator_provider.h
+++ b/src/text_shaper/font_locator_provider.h
@@ -13,27 +13,12 @@ class font_locator_provider
public:
static font_locator_provider& get();
-#if defined(__APPLE__)
- font_locator& coretext();
-#endif
+ font_locator& native();
-#if defined(_WIN32)
- font_locator& directwrite();
-#endif
-
- font_locator& fontconfig();
font_locator& mock();
private:
-#if defined(__APPLE__)
- std::unique_ptr _coretext {};
-#endif
-
-#if defined(_WIN32)
- std::unique_ptr _directwrite {};
-#endif
-
- std::unique_ptr _fontconfig {};
+ std::unique_ptr _native {};
std::unique_ptr _mock {};
};
diff --git a/src/text_shaper/open_shaper.cpp b/src/text_shaper/open_shaper.cpp
index 654c8e8401..8a3e467ae1 100644
--- a/src/text_shaper/open_shaper.cpp
+++ b/src/text_shaper/open_shaper.cpp
@@ -26,7 +26,9 @@
#include FT_LCD_FILTER_H
// clang-format on
-#include
+#if __has_include()
+ #include
+#endif
#include
#include
diff --git a/src/vtrasterizer/FontDescriptions.h b/src/vtrasterizer/FontDescriptions.h
index 4ac8f3a378..3702249964 100644
--- a/src/vtrasterizer/FontDescriptions.h
+++ b/src/vtrasterizer/FontDescriptions.h
@@ -16,10 +16,8 @@ enum class TextShapingEngine : uint8_t
enum class FontLocatorEngine : uint8_t
{
- Mock, //!< mock font locator API
- FontConfig, //!< platform independant font locator API
- DWrite, //!< native platform support: Windows
- CoreText, //!< native font locator on macOS
+ Mock, //!< mock font locator API
+ Native, //!< native platform support
};
using DPI = text::DPI;
@@ -36,7 +34,7 @@ struct FontDescriptions
text::font_description emoji;
text::render_mode renderMode;
TextShapingEngine textShapingEngine = TextShapingEngine::OpenShaper;
- FontLocatorEngine fontLocator = FontLocatorEngine::FontConfig;
+ FontLocatorEngine fontLocator = FontLocatorEngine::Native;
bool builtinBoxDrawing = true;
};
@@ -106,9 +104,7 @@ struct fmt::formatter: fmt::formatter::format(name, ctx);
diff --git a/src/vtrasterizer/TextRenderer.cpp b/src/vtrasterizer/TextRenderer.cpp
index 51a562e4a0..9e67f0ea94 100644
--- a/src/vtrasterizer/TextRenderer.cpp
+++ b/src/vtrasterizer/TextRenderer.cpp
@@ -258,28 +258,10 @@ text::font_locator& createFontLocator(FontLocatorEngine engine)
switch (engine)
{
case FontLocatorEngine::Mock: return text::font_locator_provider::get().mock();
- case FontLocatorEngine::DWrite:
-#if defined(_WIN32)
- return text::font_locator_provider::get().directwrite();
-#else
- locatorLog()("Font locator DirectWrite not supported on this platform.");
-#endif
- break;
- case FontLocatorEngine::CoreText:
-#if defined(__APPLE__)
- return text::font_locator_provider::get().coretext();
-#else
- locatorLog()("Font locator CoreText not supported on this platform.");
-#endif
- break;
-
- case FontLocatorEngine::FontConfig:
- // default case below
- break;
+ default: return text::font_locator_provider::get().native();
}
- locatorLog()("Using font locator: fontconfig.");
- return text::font_locator_provider::get().fontconfig();
+ crispy::unreachable();
}
// TODO: What's a good value here? Or do we want to make that configurable,
diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json
new file mode 100644
index 0000000000..c540ec736f
--- /dev/null
+++ b/vcpkg-configuration.json
@@ -0,0 +1,14 @@
+{
+ "default-registry": {
+ "kind": "git",
+ "baseline": "000d1bda1ffa95a73e0b40334fa4103d6f4d3d48",
+ "repository": "https://github.com/microsoft/vcpkg"
+ },
+ "registries": [
+ {
+ "kind": "artifact",
+ "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
+ "name": "microsoft"
+ }
+ ]
+}
diff --git a/vcpkg.json b/vcpkg.json
index 7be7e17c22..61b306e329 100644
--- a/vcpkg.json
+++ b/vcpkg.json
@@ -8,7 +8,6 @@
{ "name": "ms-gsl"},
{ "name": "range-v3", "version>=": "0.12.0" },
{ "name": "yaml-cpp" },
- "fontconfig",
"freetype",
"harfbuzz"
]