Various things

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2025-10-07 04:32:14 +03:00
parent 278f4c6df3
commit 64979c6e5c
3 changed files with 29 additions and 4 deletions

View File

@@ -13,6 +13,7 @@
#include <unordered_map>
#include <utility>
#include <vector>
#include <limits>
#include <fontconfig/fontconfig.h>
@@ -635,7 +636,8 @@ auto TextRenderer::shape_text(FontHandle const font,
if (codepoints.empty())
return shaped;
std::vector<usize> selections(codepoints.size(), 0);
constexpr usize kNoFont = std::numeric_limits<usize>::max();
std::vector<usize> selections(codepoints.size(), kNoFont);
for (size_t i = 0; i < codepoints.size(); ++i) {
bool matched = false;
for (size_t candidate = 0; candidate < font_set.font_indices.size();
@@ -655,12 +657,16 @@ auto TextRenderer::shape_text(FontHandle const font,
}
}
if (!matched)
selections[i] = 0;
selections[i] = kNoFont;
}
size_t idx = 0;
while (idx < codepoints.size()) {
size_t font_choice = selections[idx];
if (font_choice == kNoFont) {
++idx;
continue;
}
if (font_choice >= font_set.font_indices.size())
font_choice = 0;
usize runtime_index = font_set.font_indices[font_choice];