MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _update_font_ligatures

Method _update_font_ligatures

editor/gui/code_editor.cpp:1610–1641  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1608}
1609
1610void CodeTextEditor::_update_font_ligatures() {
1611 int ot_mode = EDITOR_GET("interface/editor/code_font_contextual_ligatures");
1612
1613 Ref<FontVariation> fc = text_editor->get_theme_font(SceneStringName(font));
1614 if (fc.is_valid()) {
1615 switch (ot_mode) {
1616 case 1: { // Disable ligatures.
1617 Dictionary ftrs;
1618 ftrs[TS->name_to_tag("calt")] = 0;
1619 fc->set_opentype_features(ftrs);
1620 } break;
1621 case 2: { // Custom.
1622 Vector<String> subtag = String(EDITOR_GET("interface/editor/code_font_custom_opentype_features")).split(",");
1623 Dictionary ftrs;
1624 for (int i = 0; i < subtag.size(); i++) {
1625 Vector<String> subtag_a = subtag[i].split("=");
1626 if (subtag_a.size() == 2) {
1627 ftrs[TS->name_to_tag(subtag_a[0])] = subtag_a[1].to_int();
1628 } else if (subtag_a.size() == 1) {
1629 ftrs[TS->name_to_tag(subtag_a[0])] = 1;
1630 }
1631 }
1632 fc->set_opentype_features(ftrs);
1633 } break;
1634 default: { // Enabled.
1635 Dictionary ftrs;
1636 ftrs[TS->name_to_tag("calt")] = 1;
1637 fc->set_opentype_features(ftrs);
1638 } break;
1639 }
1640 }
1641}
1642
1643void CodeTextEditor::_text_changed_idle_timeout() {
1644 _validate_script();

Callers

nothing calls this directly

Calls 8

set_opentype_featuresMethod · 0.80
splitMethod · 0.80
to_intMethod · 0.80
sizeMethod · 0.65
StringClass · 0.50
get_theme_fontMethod · 0.45
is_validMethod · 0.45
name_to_tagMethod · 0.45

Tested by

no test coverage detected