Issue with custom font

I had mentioned this in a status update, but I kept getting more reports about the same thing:

For my game, I replaced the default rpg maker font with a custom one. It looked good and worked well for me. When I released the demo version of the project, I started getting reports about the game freezing or running extremely slow ( 0 fps ) everytime there was text on the screen. One player claimed it took them half an hour to go through a 1 minute cutscene.

I instructed some of the players on how to restore the default font and they said the game went back to running normal.

I don't really know much about fonts. I know there are hinting and anti-aliasing options imbued into them that can cause extra processing on some computers, but I have no idea how to disable it, so my first reaction was to replace the font. I spent a few hours trying to find another good font with similar sizes only to find out that the same thing happened with it.

Based on the number of reports, I expect this issue to be affecting at least 15% of my players.

So, my questions are:

1) Does anyone know what can cause this?
2) Has anyone here used a custom font without issue on an MV game? If yes, can you share it so that I can ask one of the players to see if the issue happens with it too?
Oh, it's weird.

I'm using a third party font on Warped
But as no one ever plays it, I dont know if it has such issue.
Maybe it's due to the actual size of the font? Are you using something that uses large fonts and resizes them? If so that may be a problem, i've never heard of that happening before though.
I use very hight size quality font text
And a lot on the same page !.
I am not aware of this problem.
You may be able to try or check this script.


This one is very fast for me, and allow me to use 3 custom font
Code:
//=============================================================================
// FontLoad.js
// ----------------------------------------------------------------------------
// Copyright (c) 2015 Triacontane
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
// ----------------------------------------------------------------------------
// Version
// 1.0.0 2016/06/02 初版
// ----------------------------------------------------------------------------
// [Blog]   : http://triacontane.blogspot.jp/
// [Twitter]: https://twitter.com/triacontane/
// [GitHub] : https://github.com/triacontane/
//=============================================================================

/*:
 * @plugindesc Font Load
 * @author triacontane
 *
 * @param FontName1
 * @desc Font name
 * @default
 *
 * @param FontUrl1
 * @desc Font file path. ex:fonts/XXX.ttf
 * @default
 *
 * @param FontName2
 * @desc Font name
 * @default
 *
 * @param FontUrl2
 * @desc Font file path. ex:fonts/XXX.ttf
 * @default
 *
 * @param FontName3
 * @desc Font name
 * @default
 *
 * @param FontUrl3
 * @desc Font file path. ex:fonts/XXX.ttf
 * @default
 *
 * @param WaitLoadComplete
 * @desc Wait until load complete
 * @default OFF
 *
 * @help Loading font file at the start of the game.
 *
 * This plugin is released under the MIT License.
 */
/*:ja
 * @plugindesc フォントロードプラグイン
 * @author トリアコンタン
 *
 * @param フォント名1
 * @desc 任意のフォント名
 * @default
 *
 * @param フォントURL1
 * @desc フォントファイルパスです。例:fonts/XXX.ttf
 * @default
 *
 * @param フォント名2
 * @desc 任意のフォント名
 * @default
 *
 * @param フォントURL2
 * @desc フォントファイルパスです。例:fonts/XXX.ttf
 * @default
 *
 * @param フォント名3
 * @desc 任意のフォント名
 * @default
 *
 * @param フォントURL3
 * @desc フォントファイルパスです。例:fonts/XXX.ttf
 * @default
 *
 * @param ロード完了まで待機
 * @desc フォントのロードが完了してからゲームを開始します。
 * @default OFF
 *
 * @help 指定したURLのフォントを指定した名前でロードします。
 * ロードするだけなので、基本的には他のプラグインやスクリプトと
 * 組み合わせて使用します。
 *
 * このプラグインにはプラグインコマンドはありません。
 *
 * 利用規約:
 *  作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等)
 *  についても制限はありません。
 *  このプラグインはもうあなたのものです。
 */

(function() {
    'use strict';
    var pluginName    = 'FontLoad';

    var getParamOther = function(paramNames) {
        if (!Array.isArray(paramNames)) paramNames = [paramNames];
        for (var i = 0; i < paramNames.length; i++) {
            var name = PluginManager.parameters(pluginName)[paramNames[i]];
            if (name) return name;
        }
        return null;
    };

    var getParamString = function(paramNames) {
        var value = getParamOther(paramNames);
        return value === null ? '' : value;
    };

    var getParamBoolean = function(paramNames) {
        var value = getParamOther(paramNames);
        return (value || '').toUpperCase() === 'ON';
    };

    //=============================================================================
    // パラメータの取得と整形
    //=============================================================================
    var paramFonts = [], idString;
    for (var i = 1; i <= 3; i++) {
        idString = String(i);
        paramFonts[i] = {};
        paramFonts[i].url = getParamString(['FontUrl' + idString, 'フォントURL' + idString]);
        paramFonts[i].name = getParamString(['FontName' + idString, 'フォント名' + idString]);
    }
    var paramWaitLoadComplete = getParamBoolean(['WaitLoadComplete', 'ロード完了まで待機']);

    //=============================================================================
    // Scene_Boot
    //  必要なフォントをロードします。
    //=============================================================================
    var _Scene_Boot_create = Scene_Boot.prototype.create;
    Scene_Boot.prototype.create = function() {
        _Scene_Boot_create.apply(this, arguments);
        paramFonts.forEach(function(fontInfo) {
            if (fontInfo.name && fontInfo.url) {
                Graphics.loadFont(fontInfo.name, fontInfo.url);
            }
        }.bind(this));
    };

    var _Scene_Boot_isGameFontLoaded = Scene_Boot.prototype.isGameFontLoaded;
    Scene_Boot.prototype.isGameFontLoaded = function() {
        if (!_Scene_Boot_isGameFontLoaded.apply(this)) {
            return false;
        }
        var result = !paramWaitLoadComplete || paramFonts.every(function(fontInfo) {
            return Graphics.isFontLoaded(fontInfo.name) || !fontInfo.name || !fontInfo.url;
        }.bind(this));
        if (result) {
            return true;
        } else {
            var elapsed = Date.now() - this._startDate;
            if (elapsed >= 20000) {
                throw new Error('Failed to load custom font');
            }
            return false;
        }
    };
})();
Oh, it's weird.

I'm using a third party font on Warped
But as no one ever plays it, I dont know if it has such issue.

Thank you. I asked a friend to play your game and he said there was no lag. Then he used your font in my game and the lag showed up again. So it's definitely something wrong with my game only. That at least give me some leads.
Are you using a different function (one that has been changed) to draw the font/text?
Edit: like Bitmap._drawTextBody or Bitmap._drawTextOutline?
Are you using a different function (one that has been changed) to draw the font/text?
Edit: like Bitmap._drawTextBody or Bitmap._drawTextOutline?
Nope. just regular text.
Maybe it's due to the actual size of the font? Are you using something that uses large fonts and resizes them? If so that may be a problem, i've never heard of that happening before though.
I use very hight size quality font text
And a lot on the same page !.
I am not aware of this problem.
You may be able to try or check this script.


This one is very fast for me, and allow me to use 3 custom font
Code:
//=============================================================================
// FontLoad.js
// ----------------------------------------------------------------------------
// Copyright (c) 2015 Triacontane
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
// ----------------------------------------------------------------------------
// Version
// 1.0.0 2016/06/02 初版
// ----------------------------------------------------------------------------
// [Blog]   : http://triacontane.blogspot.jp/
// [Twitter]: https://twitter.com/triacontane/
// [GitHub] : https://github.com/triacontane/
//=============================================================================

/*:
 * @plugindesc Font Load
 * @author triacontane
 *
 * @param FontName1
 * @desc Font name
 * @default
 *
 * @param FontUrl1
 * @desc Font file path. ex:fonts/XXX.ttf
 * @default
 *
 * @param FontName2
 * @desc Font name
 * @default
 *
 * @param FontUrl2
 * @desc Font file path. ex:fonts/XXX.ttf
 * @default
 *
 * @param FontName3
 * @desc Font name
 * @default
 *
 * @param FontUrl3
 * @desc Font file path. ex:fonts/XXX.ttf
 * @default
 *
 * @param WaitLoadComplete
 * @desc Wait until load complete
 * @default OFF
 *
 * @help Loading font file at the start of the game.
 *
 * This plugin is released under the MIT License.
 */
/*:ja
 * @plugindesc フォントロードプラグイン
 * @author トリアコンタン
 *
 * @param フォント名1
 * @desc 任意のフォント名
 * @default
 *
 * @param フォントURL1
 * @desc フォントファイルパスです。例:fonts/XXX.ttf
 * @default
 *
 * @param フォント名2
 * @desc 任意のフォント名
 * @default
 *
 * @param フォントURL2
 * @desc フォントファイルパスです。例:fonts/XXX.ttf
 * @default
 *
 * @param フォント名3
 * @desc 任意のフォント名
 * @default
 *
 * @param フォントURL3
 * @desc フォントファイルパスです。例:fonts/XXX.ttf
 * @default
 *
 * @param ロード完了まで待機
 * @desc フォントのロードが完了してからゲームを開始します。
 * @default OFF
 *
 * @help 指定したURLのフォントを指定した名前でロードします。
 * ロードするだけなので、基本的には他のプラグインやスクリプトと
 * 組み合わせて使用します。
 *
 * このプラグインにはプラグインコマンドはありません。
 *
 * 利用規約:
 *  作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等)
 *  についても制限はありません。
 *  このプラグインはもうあなたのものです。
 */

(function() {
    'use strict';
    var pluginName    = 'FontLoad';

    var getParamOther = function(paramNames) {
        if (!Array.isArray(paramNames)) paramNames = [paramNames];
        for (var i = 0; i < paramNames.length; i++) {
            var name = PluginManager.parameters(pluginName)[paramNames[i]];
            if (name) return name;
        }
        return null;
    };

    var getParamString = function(paramNames) {
        var value = getParamOther(paramNames);
        return value === null ? '' : value;
    };

    var getParamBoolean = function(paramNames) {
        var value = getParamOther(paramNames);
        return (value || '').toUpperCase() === 'ON';
    };

    //=============================================================================
    // パラメータの取得と整形
    //=============================================================================
    var paramFonts = [], idString;
    for (var i = 1; i <= 3; i++) {
        idString = String(i);
        paramFonts[i] = {};
        paramFonts[i].url = getParamString(['FontUrl' + idString, 'フォントURL' + idString]);
        paramFonts[i].name = getParamString(['FontName' + idString, 'フォント名' + idString]);
    }
    var paramWaitLoadComplete = getParamBoolean(['WaitLoadComplete', 'ロード完了まで待機']);

    //=============================================================================
    // Scene_Boot
    //  必要なフォントをロードします。
    //=============================================================================
    var _Scene_Boot_create = Scene_Boot.prototype.create;
    Scene_Boot.prototype.create = function() {
        _Scene_Boot_create.apply(this, arguments);
        paramFonts.forEach(function(fontInfo) {
            if (fontInfo.name && fontInfo.url) {
                Graphics.loadFont(fontInfo.name, fontInfo.url);
            }
        }.bind(this));
    };

    var _Scene_Boot_isGameFontLoaded = Scene_Boot.prototype.isGameFontLoaded;
    Scene_Boot.prototype.isGameFontLoaded = function() {
        if (!_Scene_Boot_isGameFontLoaded.apply(this)) {
            return false;
        }
        var result = !paramWaitLoadComplete || paramFonts.every(function(fontInfo) {
            return Graphics.isFontLoaded(fontInfo.name) || !fontInfo.name || !fontInfo.url;
        }.bind(this));
        if (result) {
            return true;
        } else {
            var elapsed = Date.now() - this._startDate;
            if (elapsed >= 20000) {
                throw new Error('Failed to load custom font');
            }
            return false;
        }
    };
})();
How do I remove the square on my custom font?
How do I remove the square on my custom font?
The square is a placeholder for letters that are missing in your font.
So you have only three options here:
1) find a version of your font that is complete and contains all letters and symbols (or make it complete by adding the missing symbols with a font design program
2) use a different font that has a complete fontfile
3) find every place in the original engine where that missing symbol or letter is used, and then have it replaced with a similiar letter that is available in your font. Preferably by using a plugin instead of editing the default files.

the start would be to identify which symbols or letters are missing by telling us where the square appears in your game.
The square is a placeholder for letters that are missing in your font.
So you have only three options here:
1) find a version of your font that is complete and contains all letters and symbols (or make it complete by adding the missing symbols with a font design program
2) use a different font that has a complete fontfile
3) find every place in the original engine where that missing symbol or letter is used, and then have it replaced with a similiar letter that is available in your font. Preferably by using a plugin instead of editing the default files.

the start would be to identify which symbols or letters are missing by telling us where the square appears in your game.
okay thanks I'll do that now

Original thread: https://forums.rpgmakerweb.com/threads/issue-with-custom-font.77330/