Skip to content

Commit 895fddc

Browse files
committed
Shorten PyFT2Font.get_charmap a bit
1 parent 35e7f34 commit 895fddc

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
@@ -403,12 +403,12 @@ PyFT2Font_get_fontmap(PyFT2Font *self, std::u32string text)
403403
{
404404
std::set<FT_ULong> codepoints;
405405

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

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

0 commit comments

Comments
 (0)