じ☆ve冰风 发表于 3 天前

Easy optimization for the fonts of your project

Brief description​

Taking advantage of new web technologies we can optimize the fonts of our game (or, at least, in most of them, the main font) so that it takes up less space (> 1MB to 0.016M
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 and loads much faster , showing exactly the same quality. The woff2 font format is wide supported in all browsers (https://caniuse.com/#search=woff2).

Legal requirement​

The license of the font must allow you to do this modification to the font. In the case of default game font I believe that this is the license, so we can do it.

                        These fonts are free software.
Unlimited permission is granted to use, copy, and distribute them, with or without modification, either commercially or noncommercially.
THESE FONTS ARE PROVIDED "AS IS" WITHOUT WARRANTY.
http://mplus-fonts.osdn.jp/about-en.html#license
Click to expand...


Tutorial
For the default game font.​

You can change the default font TTF (1Mb ) to their WOFF2 western-optimized version (16Kb ).

[*]Put the attached file (woff2 extension) in the font directory
[*]Remove the previous font that has ttf extension.
[*]Change the gamefont.css first-part to (changes in bold).
                CSS:       
@font-face {    font-family: GameFont;    src: url("mplus-1m-regular.woff2") format('woff2');}



You can do it yourselft with your own fonts custom game fonts using https://www.fontsquirrel.com/tools/webfont-generator to generate the woff2 files.

Extra​

For advanced stuff please refer to the Google deep explanation: https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/webfont-optimization?hl=en


本贴来自国际rpgmaker官方论坛作者:ScSWinter处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/easy-optimization-for-the-fonts-of-your-project.120106/
页: [1]
查看完整版本: Easy optimization for the fonts of your project