Skip to content

Commit b4c9ff6

Browse files
committed
additionally support woff2
1 parent 00eaa39 commit b4c9ff6

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

doc/lua_api.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ Accepted formats are:
278278
images: .png, .jpg, .tga
279279
sounds: .ogg vorbis
280280
models: .x, .b3d, .obj, (since version 5.10:) .gltf, .glb
281-
fonts: .ttf (since version 5.11, see notes below)
281+
fonts: .ttf, .woff2 (since version 5.11, see notes below)
282282

283283
Other formats won't be sent to the client (e.g. you can store .blend files
284284
in a folder for convenience, without the risk that such files are transferred)
@@ -345,18 +345,21 @@ and thus cause your model to render differently there.
345345

346346
#### Custom fonts
347347

348-
You can supply custom fonts in TrueType Font (TTF) format.
348+
You can supply custom fonts in TrueType Font (`.ttf`) or Web Open Font Format 2 (`.woff2`) format.
349+
The former is supported primarily for convenience. The latter is preferred due to its compression.
349350
In the future, having multiple custom fonts and the ability to switch between them is planned,
350351
but for now this feature is limited to the ability to override Luanti's default fonts via mods.
351-
It is recommended that this only be used by game mods. The names are self-explanatory:
352-
353-
* `regular.ttf`
354-
* `bold.ttf`
355-
* `italic.ttf`
356-
* `bold_italic.ttf`
357-
* `mono.ttf`
358-
* `mono_bold.ttf`
359-
* `mono_bold_italic.ttf`
352+
It is recommended that this only be used by game mods to set a look and feel.
353+
354+
The stems (file names without extension) are self-explanatory:
355+
356+
* `regular`
357+
* `bold`
358+
* `italic`
359+
* `bold_italic`
360+
* `mono`
361+
* `mono_bold`
362+
* `mono_bold_italic`
360363

361364
Naming conventions
362365
------------------

src/client/client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ bool Client::loadMedia(const std::string &data, const std::string &filename,
838838
return true;
839839
}
840840

841-
const char *font_ext[] = {".ttf", NULL};
841+
const char *font_ext[] = {".ttf", ".woff2", NULL};
842842
name = removeStringEnd(filename, font_ext);
843843
if (!name.empty()) {
844844
g_fontengine->setMediaFont(name, data);

src/server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2544,7 +2544,7 @@ bool Server::addMediaFile(const std::string &filename,
25442544
// Translation file formats
25452545
".tr", ".po", ".mo",
25462546
// Fonts
2547-
".ttf",
2547+
".ttf", ".woff2",
25482548
NULL
25492549
};
25502550
if (removeStringEnd(filename, supported_ext).empty()) {

0 commit comments

Comments
 (0)