diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
commit | c04dcc2e7d834218ef2d4194331e383402495ae1 (patch) | |
tree | 7333e38d10d75386e60f336b80c2443c1166031d /xbmc/utils/FontUtils.h | |
parent | Initial commit. (diff) | |
download | kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip |
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | xbmc/utils/FontUtils.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/xbmc/utils/FontUtils.h b/xbmc/utils/FontUtils.h new file mode 100644 index 0000000..d4b92dd --- /dev/null +++ b/xbmc/utils/FontUtils.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2022 Team Kodi + * This file is part of Kodi - https://kodi.tv + * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. + */ + +#pragma once + +#include <stdint.h> +#include <string> +#include <vector> + +namespace UTILS +{ +namespace FONT +{ +constexpr const char* SUPPORTED_EXTENSIONS_MASK = ".ttf|.otf"; + +// The default application font +constexpr const char* FONT_DEFAULT_FILENAME = "arial.ttf"; + +namespace FONTPATH +{ +// Directory where Kodi bundled fonts files are located +constexpr const char* SYSTEM = "special://xbmc/media/Fonts/"; +// Directory where user defined fonts are located +constexpr const char* USER = "special://home/media/Fonts/"; +// Temporary font path (where MKV fonts are extracted and temporarily stored) +constexpr const char* TEMP = "special://temp/fonts/"; + +/*! + * \brief Provided a font filename returns the complete path for the font in + * the system font folder (if it exists) or an empty string otherwise + * \param filename The font file name + * \return The path for the font or an empty string if the path does not exist + */ +std::string GetSystemFontPath(const std::string& filename); +}; // namespace FONTPATH + +/*! + * \brief Get the font family name from a font file + * \param buffer The font data + * \return The font family name, otherwise empty if fails + */ +std::string GetFontFamily(std::vector<uint8_t>& buffer); + +/*! + * \brief Get the font family name from a font file + * \param filepath The path where read the font data + * \return The font family name, otherwise empty if fails + */ +std::string GetFontFamily(const std::string& filepath); + +/*! + * \brief Check if a filename have a supported font extension. + * \param filepath The font file path + * \return True if it has a supported extension, otherwise false + */ +bool IsSupportedFontExtension(const std::string& filepath); + +/*! + * \brief Removes all temporary fonts, e.g.those extract from MKV containers + * that are only available during playback + */ +void ClearTemporaryFonts(); + +} // namespace FONT +} // namespace UTILS |