@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user