Skip to content

Commit f700f0b

Browse files
QuLogictacaswell
authored andcommitted
Shorten PyFT2Font.get_charmap a bit
1 parent 3196240 commit f700f0b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ft2font_wrapper.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,12 @@ PyFT2Font_get_fontmap(PyFT2Font *self, std::u32string text)
402402
{
403403
std::set<FT_ULong> codepoints;
404404

405+
py::dict char_to_font;
405406
for (auto code : text) {
406-
codepoints.insert(code);
407-
}
407+
if (!codepoints.insert(code).second) {
408+
continue;
409+
}
408410

409-
py::dict char_to_font;
410-
for (auto code : codepoints) {
411411
py::object target_font;
412412
int index;
413413
if (self->x->get_char_fallback_index(code, index)) {

0 commit comments

Comments
 (0)