MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
FontDiscovery.hpp
Go to the documentation of this file.
1#pragma once
2
4
5/**
6 * @brief Locate a system font file by family name and optional style.
7 *
8 * Queries the platform font subsystem without requiring any bundled assets.
9 * On Linux: links against fontconfig and calls FcFontMatch.
10 * On macOS: shells out to fc-match if fontconfig is available, otherwise
11 * walks ~/Library/Fonts and /System/Library/Fonts.
12 * On Windows: walks %WINDIR%\Fonts for a filename containing @p family.
13 *
14 * The result is an absolute path suitable for passing directly to
15 * Portal::Text::set_default_font() or FontFace::load().
16 *
17 * @param family Font family name, e.g. "JetBrains Mono", "DejaVu Sans".
18 * @param style Optional style hint, e.g. "Medium", "Bold", "Italic".
19 * Passed to fontconfig on Linux; ignored on other platforms.
20 * @return Absolute path to a matching font file, or std::nullopt
21 * if no match could be found.
22 */
23[[nodiscard]] MAYAFLUX_API std::optional<std::string> find_font(
24 std::string_view family,
25 std::string_view style = {});
26
27} // namespace MayaFlux::Portal::Text
MAYAFLUX_API std::optional< std::string > find_font(std::string_view family, std::string_view style={})
Locate a system font file by family name and optional style.