minor changes

This commit is contained in:
ohyzha
2025-01-20 17:04:07 +02:00
parent 22b0db9657
commit f55fb37730
2 changed files with 3 additions and 10 deletions

View File

@@ -39,8 +39,8 @@ namespace OpenVulkano
{ {
FcPattern* font = fs->fonts[i]; FcPattern* font = fs->fonts[i];
FcChar8* file; FcChar8* file;
FcChar8 *style; FcChar8* style;
FcChar8 *family; FcChar8* family;
if (FcPatternGetString(font, FC_FILE, 0, &file) == FcResultMatch && if (FcPatternGetString(font, FC_FILE, 0, &file) == FcResultMatch &&
FcPatternGetString(font, FC_FAMILY, 0, &family) == FcResultMatch && FcPatternGetString(font, FC_FAMILY, 0, &family) == FcResultMatch &&
FcPatternGetString(font, FC_STYLE, 0, &style) == FcResultMatch) FcPatternGetString(font, FC_STYLE, 0, &style) == FcResultMatch)

View File

@@ -49,14 +49,7 @@ namespace OpenVulkano
{ {
// remove null-terminated characters since size is always bigger than needed // remove null-terminated characters since size is always bigger than needed
std::string fontNameCropped(fontName.begin(), fontName.end()); std::string fontNameCropped(fontName.begin(), fontName.end());
size_t realSize = 0; size_t realSize = strlen(fontNameCropped.data());
for (; realSize < fontNameCropped.size(); realSize++)
{
if (fontNameCropped[realSize] == '\0')
{
break;
}
}
fontNameCropped.resize(realSize); fontNameCropped.resize(realSize);
Utils::ToLower(fontNameCropped); Utils::ToLower(fontNameCropped);
fontFileMapping[std::move(fontNameCropped)] = fontFilename.path().string(); fontFileMapping[std::move(fontNameCropped)] = fontFilename.path().string();