174 lines
No EOL
5.2 KiB
JavaScript
174 lines
No EOL
5.2 KiB
JavaScript
//=============================================================================
|
||
// LB_Font.js
|
||
//=============================================================================
|
||
|
||
/**
|
||
* Copyright (c) 2021 lunabunn
|
||
*
|
||
* This software is provided 'as-is', without any express or implied
|
||
* warranty. In no event will the authors be held liable for any damages
|
||
* arising from the use of this software.
|
||
*
|
||
* Permission is granted to anyone to use this software for any purpose,
|
||
* including commercial applications, and to alter it and redistribute it
|
||
* freely, subject to the following restrictions:
|
||
*
|
||
* 1. The origin of this software must not be misrepresented; you must not
|
||
* claim that you wrote the original software. If you use this software
|
||
* in a product, an acknowledgment in the product documentation would be
|
||
* appreciated but is not required.
|
||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||
* misrepresented as being the original software.
|
||
* 3. This notice may not be removed or altered from any source distribution.
|
||
*/
|
||
|
||
/*:
|
||
* @plugindesc A dead-simple font changer plugin.
|
||
* @author Lunabunn
|
||
*
|
||
* @help Add any custom fonts you want to use to the font faces list and then
|
||
* set the font options below to see them in-game with no additional setup.
|
||
*
|
||
* @param fontFaces
|
||
* @text Font Faces
|
||
* @desc The list of font faces to use.
|
||
* @type struct<FontFace>[]
|
||
*
|
||
* @param chineseFonts
|
||
* @text Chinese Font Faces
|
||
* @desc The list of font faces to use for Chinese (comma-separated, highest to lowest priority).
|
||
* @type text
|
||
* @default SimHei, Heiti TC, sans-serif
|
||
*
|
||
* @param koreanFonts
|
||
* @text Korean Font Faces
|
||
* @desc The list of font faces to use for Korean (comma-separated, highest to lowest priority).
|
||
* @type text
|
||
* @default Dotum, AppleGothic, sans-serif
|
||
*
|
||
* @param defaultFonts
|
||
* @text Default Font Faces
|
||
* @desc The list of font faces to use (comma-separated, highest to lowest priority).
|
||
* @type text
|
||
* @default GameFont
|
||
*
|
||
* @param defaultFontSize
|
||
* @text Default Font Size
|
||
* @desc The default font size to use.
|
||
* @type number
|
||
* @default 28
|
||
*
|
||
* @param lineHeight
|
||
* @text Line Height
|
||
* @desc The line height to use.
|
||
* @type number
|
||
* @default 36
|
||
*
|
||
* @param textPadding
|
||
* @text Text Padding
|
||
* @desc The text padding to use.
|
||
* @type number
|
||
* @default 6
|
||
*/
|
||
|
||
/*:ko
|
||
* @plugindesc 간단??글<>?변<>??<3F>러그인?<3F>니??
|
||
*
|
||
* @help 글<>?목록???<3F>용?<3F>시<EFBFBD>??<3F><>? 글꼴들??추<>??<3F>신 ???<3F>단??
|
||
* 글<>??<3F>션??변경함?<3F>로??추<>? ?<3F>정 ?<3F>이 게임?<3F>서 ?<3F>용??가?<3F>합?<3F>다.
|
||
*
|
||
* @param fontFaces
|
||
* @text 글<>?
|
||
* @desc ?<3F>용??글<>?목록
|
||
* @type struct<FontFace>[]
|
||
*
|
||
* @param chineseFonts
|
||
* @text 중국??글<>?
|
||
* @desc 중국?<3F><>? ?<3F>시?<3F>기 ?<3F>해 ?<3F>용??글꼴들 (콤마<ECBDA4>?구분, ?<3F>선?<3F>위 ?<3F>림차순 ?<3F>렬)
|
||
* @type text
|
||
* @default SimHei, Heiti TC, sans-serif
|
||
*
|
||
* @param koreanFonts
|
||
* @text ?<3F>국??글<>?
|
||
* @desc ?<3F>국?<3F><>? ?<3F>시?<3F>기 ?<3F>해 ?<3F>용??글꼴들 (콤마<ECBDA4>?구분, ?<3F>선?<3F>위 ?<3F>림차순 ?<3F>렬)
|
||
* @type text
|
||
* @default Dotum, AppleGothic, sans-serif
|
||
*
|
||
* @param defaultFonts
|
||
* @text 기본 글<>?
|
||
* @desc 기본 글꼴들 (콤마<ECBDA4>?구분, ?<3F>선?<3F>위 ?<3F>림차순 ?<3F>렬)
|
||
* @type text
|
||
* @default GameFont
|
||
*
|
||
* @param defaultFontSize
|
||
* @text 기본 글???<3F>기
|
||
* @desc 기본 글???<3F>기
|
||
* @type number
|
||
* @default 28
|
||
*
|
||
* @param lineHeight
|
||
* @text <20>?간격
|
||
* @desc <20>?간격
|
||
* @type number
|
||
* @default 36
|
||
*
|
||
* @param textPadding
|
||
* @text 글???<3F>딩
|
||
* @desc 글???<3F>딩
|
||
* @type number
|
||
* @default 6
|
||
*/
|
||
|
||
/*~struct~FontFace:ko
|
||
* @param name
|
||
* @text 글<>??<3F>름
|
||
* @desc 글꼴의 ?<3F>름
|
||
* @type text
|
||
*
|
||
* @param file
|
||
* @text 글<>??<3F>일
|
||
* @desc 글꼴의 ?<3F>일 경로 (fonts/ 기<>?).
|
||
* @type text
|
||
*/
|
||
|
||
{
|
||
const fontFaces = JSON.parse(PluginManager.parameters("LB_Font")["fontFaces"] || "[]");
|
||
const chineseFonts = PluginManager.parameters("LB_Font")["chineseFonts"];
|
||
const koreanFonts = PluginManager.parameters("LB_Font")["koreanFonts"];
|
||
const defaultFonts = PluginManager.parameters("LB_Font")["defaultFonts"];
|
||
const defaultFontSize = parseInt(PluginManager.parameters("LB_Font")["defaultFontSize"]);
|
||
const lineHeight = parseInt(PluginManager.parameters("LB_Font")["lineHeight"]);
|
||
const textPadding = parseInt(PluginManager.parameters("LB_Font")["textPadding"]);
|
||
|
||
let style = document.createElement("style");
|
||
for (e of fontFaces) {
|
||
const fontFace = JSON.parse(e);
|
||
style.innerHTML += `@font-face {
|
||
font-family: ${fontFace.name};
|
||
src: url("PixelMplus10-Regular.ttf");
|
||
}`;
|
||
}
|
||
document.head.appendChild(style);
|
||
|
||
Window_Base.prototype.standardFontFace = function () {
|
||
if ($gameSystem.isChinese()) {
|
||
return chineseFonts;
|
||
} else if ($gameSystem.isKorean()) {
|
||
return koreanFonts;
|
||
} else {
|
||
return defaultFonts;
|
||
}
|
||
};
|
||
|
||
Window_Base.prototype.standardFontSize = function () {
|
||
return defaultFontSize;
|
||
};
|
||
|
||
Window_Base.prototype.lineHeight = function () {
|
||
return lineHeight;
|
||
};
|
||
|
||
Window_Base.prototype.textPadding = function () {
|
||
return textPadding;
|
||
};
|
||
} |