-
Notifications
You must be signed in to change notification settings - Fork 25
/
GabeMZ_CustomFontLoader.js
74 lines (64 loc) · 2.34 KB
/
GabeMZ_CustomFontLoader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//============================================================================
// Gabe MZ - Custom Font Loader
//----------------------------------------------------------------------------
// 22/09/21 | Version: 1.0.1 | Optimized resources
// 09/08/21 | Version: 1.0.0 | Released
//----------------------------------------------------------------------------
// This software is released under the zlib License.
//============================================================================
/*:
* @target MZ
* @plugindesc [v1.0.1] Allows to import custom fonts into the project.
* @author Gabe (Gabriel Nascimento)
* @url http://patreon.com/gabeplugins
*
* @help Gabe MZ - Custom Font Loader
* - This plugin is released under the zlib License.
*
* This plugin allows you to import custom fonts into the project. The custom
* fonts can be used within the project in a number of ways, such as in
* PIXI.Text. The custom fonts will be recognized by the name defined in the
* parameters of this plugin.
*
* For support and new plugins join our Discord server:
* https://discord.gg/GG85QRz
*
* @param fonts
* @text Fonts
* @desc Custom Font List
* @type struct<Font>[]
* @default []
*/
/*~struct~Font:
* @param name
* @text Name
* @desc The name that'll be used to recognize the font.
* @type text
*
* @param filename
* @text Filename
* @desc The font filename in the fonts/ folder.
* @type text
*/
var Imported = Imported || {};
Imported.GMZ_CustomFontLoader = true;
var GabeMZ = GabeMZ || {};
GabeMZ.CustomFontLoader = GabeMZ.CustomFontLoader || {};
GabeMZ.CustomFontLoader.VERSION = [1, 0, 1];
(() => {
const pluginName = "GabeMZ_CustomFontLoader";
const params = PluginManager.parameters(pluginName);
GabeMZ.CustomFontLoader.fonts = JSON.parse(params.fonts).map((e) => {return JSON.parse(e)});
//-----------------------------------------------------------------------------
// Scene_Boot
//
// The scene class for initializing the entire game.
const _Scene_Boot_loadGameFonts = Scene_Boot.prototype.loadGameFonts;
Scene_Boot.prototype.loadGameFonts = function() {
_Scene_Boot_loadGameFonts.call(this);
const fonts = GabeMZ.CustomFontLoader.fonts;
for (const font of fonts) {
FontManager.load(font.name, font.filename);
};
};
})();