Files
LonaRPG-Online-Games/ModScripts/124_MPSafeFontFallback.rb
T

22 lines
755 B
Ruby
Raw Normal View History

2026-10-29 21:59:06 +04:00
# encoding: UTF-8
# Global fallback for hardcoded legacy fonts that are missing in mkxp-z.
# This keeps existing UI logic intact and only swaps the font right before draw.
class Bitmap
unless method_defined?(:mp_safe_font_fallback__orig_draw_text)
alias mp_safe_font_fallback__orig_draw_text draw_text
def draw_text(*args)
begin
if self.font
current_name = self.font.name.to_s
if current_name == "Digital Pixel" && !(defined?(MPSafeFont) && MPSafeFont.respond_to?(:rus2_active?) && MPSafeFont.rus2_active?)
self.font.name = (defined?(MPSafeFont) ? MPSafeFont.name : "VL Gothic")
end
end
rescue
end
mp_safe_font_fallback__orig_draw_text(*args)
end
end
end