Project1

标题: 如何使用自带字体? [打印本页]

作者: 爆焰    时间: 2013-8-9 09:32
标题: 如何使用自带字体?
在游戏文件夹里创一个Fonts的文件夹,里面放着字体。有谁给个可以让游戏自己选择自己文件夹里的Fonts里面的字体来使用?我搜索得到了一个,不过都没用的。请问有什么办法解决。
作者: end55rpg    时间: 2013-8-9 09:34
main里+上路径
作者: 1095884734    时间: 2013-8-9 10:19
本帖最后由 1095884734 于 2013-8-9 10:24 编辑

在脚本mail第十行里填上字体
RUBY 代码复制
  1. dir = Win32API.new('kernel32','GetSystemDirectory','p,l','l')
  2. dir_str = " " * 256
  3. dir.call(dir_str,255)
  4. dir_str = dir_str.split('system')[0]
  5.  
  6. font_name = "fzcqjw.ttf"  
  7. font_chn_name = "方正粗倩简体"
  8.  
  9. if FileTest.exist?(font_name)
  10. copy = Win32API.new('kernel32',"CopyFileA",'p,p,l','')
  11. copy.call(font_name, "#{dir_str}Fonts/#{font_name}",0)
  12. font = Win32API.new('gdi32','AddFontResourceA','p','l')
  13. sendmsg = Win32API.new('user32','SendMessageA','l,l,l,l','l')
  14. unless Font.exist?(font_chn_name)
  15.    font.call(font_name)
  16.    sendmsg.call(65535,29,0,0)
  17.    retry
  18. end
  19. end

第六行和第七行分别写上字体文件名和字体名称
http://www.66rpg.com/articles/3338

作者: 天地有正气    时间: 2013-8-9 10:21
创建Font文件夹在目录里的功能是vx和va,xp默认不支持。你可以在脚本编辑器里Main中第10行修改。
作者: qq1353826915    时间: 2013-8-9 16:25
只需要在MAIN脚本栏中把“黑体”里面更改成你想要的字体。前提是你的电脑有这个字体哦!
作者: 小学生    时间: 2013-8-9 16:33
RUBY 代码复制
  1. #==============================================================================
  2. # ■ Main
  3. #------------------------------------------------------------------------------
  4. #  各定义结束后、从这里开始实际处理。
  5. #==============================================================================
  6.  
  7. begin
  8.   # 准备过渡
  9.   # 设置系统默认字体
  10.   Font.default_name = (["宋体"])
  11.   Graphics.freeze
  12.   # 生成场景对像 (标题画面)
  13.   $scene = Scene_Title.new
  14.   # $scene 为有效的情况下调用 main 过程
  15.   while $scene != nil
  16.     $scene.main
  17.   end
  18.   # 淡入淡出
  19.   Graphics.transition(20)
  20. rescue Errno::ENOENT
  21.   # 补充 Errno::ENOENT 以外错误
  22.   # 无法打开文件的情况下、显示信息后结束
  23.   filename = $!.message.sub("No such file or directory - ", "")
  24.   print("找不到文件 #{filename}。 ")
  25. end

其中宋体可以改成其他字体。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1