#==============================================================================
# ■ Font
#------------------------------------------------------------------------------
# 自动读取游戏字体。
#==============================================================================
font_file = "/Fonts/GameFont.TTF"
font_name = "GameFont"
unless Font.exist?(font_name)
GetCurrentDirectory = Win32API.new('kernel32', 'GetCurrentDirectoryW', 'lp', 'l')
MultiByteToWideChar = Win32API.new('kernel32', 'MultiByteToWideChar', 'llplpl', 'l')
len = GetCurrentDirectory.call(0, "")
buf = "\0" * (len - 1) * 2
GetCurrentDirectory.call(len, buf)
len = MultiByteToWideChar.call(0xFDE9, 0, font_file, -1, 0, 0)
fa = "\0" * len * 2
MultiByteToWideChar.call(0xFDE9, 0, font_file, -1, fa, len)
path = buf + fa
Win32API.new('gdi32', 'AddFontResourceW', 'p', 'l').call(path)
end
Font.default_name = font_name
#==============================================================================
# ■ Font
#------------------------------------------------------------------------------
# 自动读取游戏字体。
#==============================================================================
font_file = "/Fonts/GameFont.TTF"
font_name = "GameFont"
unless Font.exist?(font_name)
GetCurrentDirectory = Win32API.new('kernel32', 'GetCurrentDirectoryW', 'lp', 'l')
MultiByteToWideChar = Win32API.new('kernel32', 'MultiByteToWideChar', 'llplpl', 'l')
len = GetCurrentDirectory.call(0, "")
buf = "\0" * (len - 1) * 2
GetCurrentDirectory.call(len, buf)
len = MultiByteToWideChar.call(0xFDE9, 0, font_file, -1, 0, 0)
fa = "\0" * len * 2
MultiByteToWideChar.call(0xFDE9, 0, font_file, -1, fa, len)
path = buf + fa
Win32API.new('gdi32', 'AddFontResourceW', 'p', 'l').call(path)
end
Font.default_name = font_name