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

Method get_theme_font

scene/main/window.cpp:2449–2471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2447}
2448
2449Ref<Font> Window::get_theme_font(const StringName &p_name, const StringName &p_theme_type) const {
2450 ERR_READ_THREAD_GUARD_V(Ref<Font>());
2451 if (!initialized) {
2452 WARN_PRINT_ONCE(vformat("Attempting to access theme items too early in %s; prefer NOTIFICATION_POSTINITIALIZE and NOTIFICATION_THEME_CHANGED", get_description()));
2453 }
2454
2455 if (p_theme_type == StringName() || p_theme_type == get_class_name() || p_theme_type == theme_type_variation) {
2456 const Ref<Font> *font = theme_font_override.getptr(p_name);
2457 if (font) {
2458 return *font;
2459 }
2460 }
2461
2462 if (theme_font_cache.has(p_theme_type) && theme_font_cache[p_theme_type].has(p_name)) {
2463 return theme_font_cache[p_theme_type][p_name];
2464 }
2465
2466 Vector<StringName> theme_types;
2467 theme_owner->get_theme_type_dependencies(this, p_theme_type, theme_types);
2468 Ref<Font> font = theme_owner->get_theme_item_in_types(Theme::DATA_TYPE_FONT, p_name, theme_types);
2469 theme_font_cache[p_theme_type][p_name] = font;
2470 return font;
2471}
2472
2473int Window::get_theme_font_size(const StringName &p_name, const StringName &p_theme_type) const {
2474 ERR_READ_THREAD_GUARD_V(0);

Callers 10

draw_over_tileMethod · 0.45
draw_result_textMethod · 0.45
add_nodeMethod · 0.45
_add_text_to_rtFunction · 0.45

Calls 6

vformatFunction · 0.85
StringNameClass · 0.50
getptrMethod · 0.45
hasMethod · 0.45

Tested by 2