Proper Minetest font and display API

Post Reply
yw05
Member
Posts: 368
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Proper Minetest font and display API

by yw05 » Post

I have been playing Minetest for some time, and I soon realized that Minetest needs a proper font and a display API.
There are many different sign mods, and many use different fonts, even when Display Modpack already has a reusable API.
Also, many display/sign mods out there only support as much as Latin characters, but we do know that there are also users who write in another writing system (Cyrillic, Greek, ...). Most fonts do support them. Therefore, there should be a library that allows mods to load text based on existing fonts on the server or the client.
Then we would need a unified font (maybe more?) like Minecraft. The font can be designed based on existing font(s) or mod(pack)s. This would also solve the problem that some text may appear to be blank on some clients because of font support.

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

Re: Proper Minetest font and display API

by gpcf » Post

This would solve a lot of headaches, however, I have given up hope that we will see this anytime soon.

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Proper Minetest font and display API

by Linuxdirk » Post

gpcf wrote:This would solve a lot of headaches, however, I have given up hope that we will see this anytime soon.
This applies to most of the issues in Minetest and MTG :)

But for a display API: This would be really convenient if it was integrated into the engine. Something so fundamental like text being shown on signs should not require mods.

yw05
Member
Posts: 368
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: Proper Minetest font and display API

by yw05 » Post

Here are some facts/interesting cases:
1. I play on LinuxWorks Server (as ywang) and I made a joke on a user by giving him access to a construction area and naming it "临时施工区域" (temporary construction site). Then he and a moderator came only to tell me that they only "see spaces", but I do see the area name.
2. Such display APIs can be based on existing fonts, and we don't need to design different fonts for all the scripts, esp. for CJK. With CJK as an example: we can simply scale the texture to 32px (or even less) so that they appear to be (almost) the same for every font. Then we only need to use that specific texture for all the fonts. Also, Latin, Cyrillic, and Greek can share the same texture if they look *that* similar. Therefore, creating fonts for MT based on existing fonts isn't that hard.
3. If we every have such an API, it would be muh easier to add text to things like trains and chests.
4. A lot of things related to Minetest can be found on Baidu (a Chinese search engine), but I haven't (yet) seen anything related to how to write CJK text on signs.
gpcf: IMHO I wouldn't expect this feature to come out soon either. There are other more important things to do than this.

User avatar
Hume2
Member
Posts: 710
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

Re: Proper Minetest font and display API

by Hume2 » Post

I suggest, the texture modifiers should contain something like ^[text(...) which would put the given text onto the texture.
If you lack the reality, go on a trip or find a job.

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Proper Minetest font and display API

by Linuxdirk » Post

Hume2 wrote:I suggest, the texture modifiers should contain something like ^[text(...) which would put the given text onto the texture.
This does not cover dynamic texts like on signs or for example labelled chests.

yw05
Member
Posts: 368
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: Proper Minetest font and display API

by yw05 » Post

Ehlphabet has a script that generates textures for letter blocks. This probably helps.

User avatar
Pyrollo
Developer
Posts: 385
Joined: Mon Jan 08, 2018 15:14
GitHub: pyrollo
In-game: Naj
Location: Paris

Re: Proper Minetest font and display API

by Pyrollo » Post

Have a look at Display API, Font API and Font Metro. Together they provide all you need:

Display API provides a way to stick dynamic textures on any node, with any size and orientation.

Font API provides anything to render fonts to textures. It can handle various fonts and alignments. It also provides a tool (under linux) for creating texture (and whole font mod) from a TTF font.

Font Metro, relying on Christian Munk "Metro" font provides font including Latin, accentuated, Cyrillic and Greek letters.

This set of mods have been developed to be flexible, adaptable and reusable as much as possible. API are well documented, Maybe it's still missing something but I'm sure it could be a good basis for a standard API.
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

User avatar
Pyrollo
Developer
Posts: 385
Joined: Mon Jan 08, 2018 15:14
GitHub: pyrollo
In-game: Naj
Location: Paris

Re: Proper Minetest font and display API

by Pyrollo » Post

Hume2 wrote:I suggest, the texture modifiers should contain something like ^[text(...) which would put the given text onto the texture.
This is a bit simplistic. Rendering text involves many parameters: font, size, how to handle multi-line text (horizontal align, line height), character spacing and so on.

I guess such way to draw text will result in either very frustrating too simple stuff or over complicated syntax.
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

Re: Proper Minetest font and display API

by gpcf » Post

Display and Font API are nice, but still hacky unlike an API directly integrated into the engine.

yw05
Member
Posts: 368
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: Proper Minetest font and display API

by yw05 » Post

Pyrollo wrote:Have a look at Display API, Font API and Font Metro. Together they provide all you need:

Display API provides a way to stick dynamic textures on any node, with any size and orientation.

Font API provides anything to render fonts to textures. It can handle various fonts and alignments. It also provides a tool (under linux) for creating texture (and whole font mod) from a TTF font.

Font Metro, relying on Christian Munk "Metro" font provides font including Latin, accentuated, Cyrillic and Greek letters.

This set of mods have been developed to be flexible, adaptable and reusable as much as possible. API are well documented, Maybe it's still missing something but I'm sure it could be a good basis for a standard API.
1. When I wrote this, I have made it clear that I want this to be part of the engine, not as a mod. I know display_modpack and these mods.
2. I don't see how your mods can "solve the problem that some text may appear to be blank on some clients because of font support" as I wrote in the first post.

User avatar
Hume2
Member
Posts: 710
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

Re: Proper Minetest font and display API

by Hume2 » Post

Linuxdirk wrote: This does not cover dynamic texts like on signs or for example labelled chests.
Well, I looked into a few mods which display text and they use an entity which has a texture composed using such modifiers. So instead of composing the text from single character, there would be a single modifier for putting whole strings.
Pyrollo wrote: This is a bit simplistic. Rendering text involves many parameters: font, size, how to handle multi-line text (horizontal align, line height), character spacing and so on.

I guess such way to draw text will result in either very frustrating too simple stuff or over complicated syntax.
Well, some of the parameters might be optional. Also keep in mind that currently the text must be composed by putting each character extra, which is even more complicated.
If you lack the reality, go on a trip or find a job.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest