查看: 10396|回复: 6

[已经解决] 怎么更改游戏字体

[复制链接]

【欧皇】

梦石
3
星屑
2055
在线时间
1004 小时
注册时间
2013-8-19
回帖
3040

开拓者

发表于 2015-10-25 16:12:39 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
默认的字体写中文偶尔会出现一些日本字
QQ:2223942063
Q群:365819625
贪吃方1.4
梦石
0
星屑
80
在线时间
386 小时
注册时间
2007-7-27
回帖
4075

开拓者

发表于 2015-10-25 16:21:43 | 显示全部楼层
最简单的办法就是用CJK字体噜
比如开源的思源黑体
唯一的缺点就是太大了,做在线游戏不好做

把字体放到font文件夹里面,改里面的css文件的文件名

如果要实时切换字体 那就要改脚本了
吸吸
回复

使用道具 举报

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2015-10-25 16:35:42 | 显示全部楼层
改css。详见F1

点评

f1看不懂,汉化的?在哪个章节?我是半伸手党  发表于 2015-10-25 17:21
回复

使用道具 举报

路人党员

梦石
0
星屑
52
在线时间
2276 小时
注册时间
2010-12-30
回帖
3011
发表于 2015-10-25 18:12:16 | 显示全部楼层
在gamefont.css里定义font-face后用我的插件
  1. //=============================================================================
  2. // Fonts.js
  3. //=============================================================================

  4. /*:
  5. * @plugindesc Manage Game Fonts
  6. * @author 0nepeop1e
  7. *
  8. * @param Bitmap Font
  9. * @desc Default font face used for bitmap in game.
  10. * @default GameFont
  11. *
  12. * @param Window Font
  13. * @desc Default font face used for window in game.
  14. * @default GameFont
  15. *
  16. * @param Fonts
  17. * @desc List of font face definded in gamefont.css, seperate with ';'
  18. * @default GameFont
  19. */

  20. Function.prototype.clone = function() {
  21.     var that = this;
  22.     var temp = function () { return that.apply(this, arguments); };
  23.     for(var key in this) {
  24.         if (this.hasOwnProperty(key)) {
  25.             temp[key] = this[key];
  26.         }
  27.     }
  28.     return temp;
  29. };

  30. (function(pm){
  31.         ft = {};
  32.        
  33.         ft.bitmapFont = pm.parameters('Fonts')["Bitmap Font"] || "GameFont";
  34.         ft.windowFont = pm.parameters('Fonts')["Window Font"] || "GameFont";
  35.         ft.fontsList = (pm.parameters('Fonts')["Fonts"] || "GameFont").split(";");
  36.        
  37.         Scene_Boot.prototype.isGameFontLoaded = function() {
  38.                 var loaded = Graphics.isFontLoaded(ft.fontsList[0]);
  39.                 for(var i = 1; i < ft.fontsList.length; i++)
  40.                         loaded = loaded && Graphics.isFontLoaded(ft.fontsList[i]);
  41.                 if (loaded) {
  42.                         return true;
  43.                 } else {
  44.                         var elapsed = Date.now() - this._startDate;
  45.                         if (elapsed >= (20000 * ft.fontsList.length)) {
  46.                                 throw new Error('Failed to load Fonts');
  47.                         }
  48.                 }
  49.         };
  50.        
  51.         ft._initBitmap = Bitmap.prototype.initialize.clone();
  52.        
  53.         Bitmap.prototype.initialize = function(){
  54.                 ft._initBitmap.apply(this, arguments);
  55.                 this.fontFace = ft.bitmapFont;
  56.         };
  57.        
  58.         Window_Base.prototype.standardFontFace = function() {
  59.                 return ft.windowFont;
  60.         };
  61.        
  62. })(PluginManager);
复制代码

点评

然而那一段好像有用啊.....  发表于 2015-10-27 19:56
那段请无视,我新发布的已经去除那段了  发表于 2015-10-27 13:09
Function.prototype.clone = function() { var that = this;Function.prototype.clone = function() { var that = this;………… 大神,这一部分是什么意思? var that = this;  发表于 2015-10-27 10:13
论坛给了MV地址?我只知道我用的是Steam上的英文版,没什么问题。  发表于 2015-10-25 22:17
不是日本符号,是日本汉字  发表于 2015-10-25 22:02

评分

参与人数 1梦石 +1 收起 理由
余烬之中 + 1 我很赞同

查看全部评分

本人擅长XP,如果有脚本或者Ruby方面的问题欢迎发电邮到engshun@1ppl.me咨询,本人很少检查电邮所以不一定会及时回复,本人不会直接出手解决问题只会提供一个方向,所以谢绝伸手党
回复

使用道具 举报

梦石
0
星屑
50
在线时间
108 小时
注册时间
2012-7-3
回帖
44
发表于 2015-10-25 20:25:16 | 显示全部楼层
system.json 有个隐藏参数 locale,改成 zh* 可以加载操作系统自带的字体,具体设置在 Window_Base.prototype.standardFontFace 里面

点评

用了我的插件过后这设定就没用了 AvA  发表于 2015-10-25 21:56
回复

使用道具 举报

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2015-10-27 20:01:11 | 显示全部楼层
本帖最后由 汪汪 于 2015-10-27 20:04 编辑
英顺的马甲 发表于 2015-10-25 18:12
在gamefont.css里定义font-face后用我的插件

这是使用那段后的..
BaiduShurufa_2015-10-27_20-1-29.png

这是未使用的......和没使用这个插件一样的效果.
BaiduShurufa_2015-10-27_20-2-24.png


难道是我哪里设置错了吗?{:2_276:}

点评

额,我也不知道怎么搞得...然后还是想问一下那一段是什么意思?  发表于 2015-10-28 15:26
等下,明显第二张图是宋体吧==  发表于 2015-10-28 14:15
好的.我慢慢学习..  发表于 2015-10-28 12:59
都有说明啊  发表于 2015-10-28 12:50
下面那个更看不懂了  ̄□ ̄||  发表于 2015-10-28 11:36
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2015-10-27 20:57:09 | 显示全部楼层
[fold=FontEditor][pre lang="ruby"]//=============================================================================
// FontEditor.js
//=============================================================================

/*:
* This plugin overwrites the default behaviour of Window_Base.
* Use more than one font name separated by a comma to auto search for the
* next font if preceding cannot be found.
* Window_Base functions overwritten:     standardFontFace
*                                        standardFontSize
*                                        resetFontSettings
* Bitmap functions redefined:            drawText                           
*
* @plugindesc Alter the default font settings used by Window_Base and its inheritors... and load custom fonts.
* @author Traverse (27/10/2015)
*
* @param Load Custom Fonts
* @desc Add custom fonts to LOAD (not USE) here. Check Help for instructions.
* @default
*
* @param Font Name (English)
* @desc Change the default English font used by Window_Base.
* @default GameFont
*
* @param Font Size
* @desc Change the default font used by Window_Base. Default = 28.
* @default 28
*
* @param Outline Width
* @desc Change the width of the font outline. Default = 4.
* @default 4
*
* @param Outline Color
* @desc Change the color of the font outline. Default = rgba(0, 0, 0, 0.5).
* @default rgba(0, 0, 0, 0.5)
*
* @param Font Name (Japanese)
* @desc Change the default Japanese font used by Window_Base.
* @default GameFont
*
* @param Font Name (Chinese)
* @desc Change the default Chinese font used by Window_Base.
* @default SimHei, Heiti TC, sans-serif
*
* @param Font Name (Korean)
* @desc Change the default Korean font used by Window_Base.
* @default Dotum, AppleGothic, sans-serif
*
* @param Font Name (Russian)
* @desc Change the default Russian font used by Window_Base.
* @default GameFont
*
* @param Text X-Offset
* @desc Add a custom x-coordinate pixel offset to all drawn text. Use for fonts chopped off from the left. Default = 0
* @default 0
*
* @help In order to use a custom font, it must first be placed in the fonts folder.
Then it must be LOADED by the game. After loading, it must be SET to be used,
either with this plugin, or another one, or by modifying the core code directly.
The format for LOADING (not SETTING) custom fonts with this plugin is:
   
    refname,fontname/refname2,fontname2/refname3,fontname3/ect.
Example: Arial,Arial.ttf/Courier New,Courier New.ttf/ComSns,Comic Sans.ttf
   
Each 'refname' is a unique identifier. This is what you put in when SETTING
the font for use in the Font Name boxes of this plugin and what you will call
(as a string) if you want to set the font in a script/plugin/modification to
the core code.

Each fontname is the filename of the font you are using as it appears in the
fonts folder, and COMPLETE WITH FILE EXTENSION.

Due to how this plugin parses the strings, there must NOT be any spaces between
the commas and slashes that do not exist in the original filename.
E.g. Arial, Arial.ttf/... will NOT be loaded (unless the filename is " Arial.ttf").
*/

(function() {
    var parameters = PluginManager.parameters('FontEditor');
    var eng_font_name = String(parameters['Font Name (English)'] || 'GameFont');
    var jap_font_name = String(parameters['Font Name (Japanese)'] || 'GameFont');
    var cn_font_name = String(parameters['Font Name (Chinese)'] || 'SimHei, Heiti TC, sans-serif');
    var kr_font_name = String(parameters['Font Name (Korean)'] || 'Dotum, AppleGothic, sans-serif');
    var rus_font_name = String(parameters['Font Name (Russian)'] || 'GameFont');
    var font_size =  Number(parameters['Font Size'] || 28);
    var font_outline_width = Number(parameters['Outline Width'] || 4);
    var font_outline_color = String(parameters['Outline Color'] || 'rgba(0, 0, 0, 0.5)');
    var draw_text_offset = Number(parameters['Text X-Offset'] || 0);
   
    var directory = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'));
    var font_array_string = String(parameters['Load Custom Fonts']);
    var split_strings = (font_array_string.split('/'));
    var cust_font_hash = {};
    split_strings.forEach(function(x) {
        Object.defineProperty(cust_font_hash,
                                x.split(',')[0], {
                                value : x.split(',')[1],
                                enumerable : true})
    });
    Object.keys(cust_font_hash).forEach(function(refname) {
        var fontname = cust_font_hash[refname];
        var font_dir = directory + '/fonts/' + fontname;
        console.log(refname);
        console.log(font_dir);
        Graphics.loadFont(refname, font_dir);
    });
   
    Window_Base.prototype.standardFontFace = function() {
        if ($gameSystem.isJapanese()) {
            return jap_font_name }
        else if ($gameSystem.isChinese()) {
            return cn_font_name }
        else if ($gameSystem.isKorean()) {
            return kr_font_name }
        else if ($gameSystem.isRussian()) {
            return rus_font_name }
        else {
            return eng_font_name }
    };
   
    Window_Base.prototype.standardFontSize = function() {
        return font_size;
    };
   
    Window_Base.prototype.resetFontSettings = function() {
        this.contents.fontFace = this.standardFontFace();
        this.contents.fontSize = this.standardFontSize();
        this.resetTextColor();
        this.contents.outlineWidth = font_outline_width;
        this.contents.outlineColor = font_outline_color;
    };
   
    var _bitmap_drawtext_trav_fontedit_271015 = Bitmap.prototype.drawText;
    Bitmap.prototype.drawText = function(text, x_base, y, maxWidth, lineHeight, align) {
        var x = Number(x_base + draw_text_offset);
        _bitmap_drawtext_trav_fontedit_271015.call(this, text, x, y, maxWidth, lineHeight, align);
    };   
   
}) ();[/pre][/fold]

评分

参与人数 1梦石 +1 收起 理由
余烬之中 + 1 我很赞同

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部