| 2447 | } |
| 2448 | |
| 2449 | Ref<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 | |
| 2473 | int Window::get_theme_font_size(const StringName &p_name, const StringName &p_theme_type) const { |
| 2474 | ERR_READ_THREAD_GUARD_V(0); |