dir = Win32API.new('kernel32','GetSystemDirectory','p,l','l')
dir_str = " " * 256
dir.call(dir_str,255)
dir_str = dir_str.split('system')[0]
font_name = "方正像素12.ttf"
font_chn_name = "方正像素12"
if FileTest.exist?(font_name)
copy = Win32API.new('kernel32',"CopyFileA",'p,p,l','')
copy.call(font_name, "#{dir_str}Fonts/#{font_name}",0)
font = Win32API.new('gdi32','AddFontResourceA','p','l')
sendmsg = Win32API.new('user32','SendMessageA','l,l,l,l','l')
unless Font.exist?("方正像素12") or Font.exist?(font_chn_name)
font.call(font_name)
sendmsg.call(65535,29,0,0)
#retry
end
end
dir = Win32API.new('kernel32','GetSystemDirectory','p,l','l')
dir_str = " " * 256
dir.call(dir_str,255)
dir_str = dir_str.split('system')[0]
font_name = "方正像素12.ttf"
font_chn_name = "方正像素12"
if FileTest.exist?(font_name)
copy = Win32API.new('kernel32',"CopyFileA",'p,p,l','')
copy.call(font_name, "#{dir_str}Fonts/#{font_name}",0)
font = Win32API.new('gdi32','AddFontResourceA','p','l')
sendmsg = Win32API.new('user32','SendMessageA','l,l,l,l','l')
unless Font.exist?("方正像素12") or Font.exist?(font_chn_name)
font.call(font_name)
sendmsg.call(65535,29,0,0)
#retry
end
end