How to use a custom font in my add-on?

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
User avatar
ZombieKnight
Posts: 154
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

How to use a custom font in my add-on?

Post by ZombieKnight »

Hi,
I've got a .ttf and .otf font files, but I don't know how to use them in my messages(and story).
I haven't found any examples...
Any ideas?
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Pentarctagon
Project Manager
Posts: 5566
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: How to use a custom font in my add-on?

Post by Pentarctagon »

It is not currently possible.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
ZombieKnight
Posts: 154
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to use a custom font in my add-on?

Post by ZombieKnight »

Oh hell, why???
Is it becouse of the security or lack of people to do so?
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
ZombieKnight
Posts: 154
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to use a custom font in my add-on?

Post by ZombieKnight »

Can I workaround it? (make .png from the characters and then put pngs there instead of characters or smt)?
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Pentarctagon
Project Manager
Posts: 5566
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: How to use a custom font in my add-on?

Post by Pentarctagon »

Mostly it just hasn't been implemented yet - the github issue for it is https://github.com/wesnoth/wesnoth/issues/1386
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
ZombieKnight
Posts: 154
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to use a custom font in my add-on?

Post by ZombieKnight »

10 Years?!!!
Idk the Wesnoth code and I'm not really used for c++ but when there are basic fonts, why can't I use custom?
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Pentarctagon
Project Manager
Posts: 5566
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: How to use a custom font in my add-on?

Post by Pentarctagon »

Because either the fonts need to be installed on your system or Wesnoth needs to load them, and letting Wesnoth load custom fonts hasn't been a priority.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
ZombieKnight
Posts: 154
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to use a custom font in my add-on?

Post by ZombieKnight »

Oh, poor.
So whats the best way to workaround that?
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Pentarctagon
Project Manager
Posts: 5566
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: How to use a custom font in my add-on?

Post by Pentarctagon »

As far as I know, there isn't one.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
ZombieKnight
Posts: 154
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to use a custom font in my add-on?

Post by ZombieKnight »

Aaand do you thing someone is going to add [fonts] into working add-on tags? (It looks like not, since its 10 years...)
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Pentarctagon
Project Manager
Posts: 5566
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: How to use a custom font in my add-on?

Post by Pentarctagon »

I don't know of anyone planning to work on it currently. Commenting there as someone who would use the feature would increase the likelihood though.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Heindal
Posts: 1360
Joined: August 11th, 2011, 9:25 pm
Location: Germany, Karlsruhe
Contact:

Re: How to use a custom font in my add-on?

Post by Heindal »

This is really a problem. While it would be easy to implant several free fonts (and really have to be free to be used for commercial purpose) and make the player select a font, it is another caliber of allowing player to upload a custom font. You can never control if there is a copyright issue and if the player just found a font somewhere. And this is just one aspect.

Another aspect is that it has to support all kind of different signs and is truly an open type font. Utopia, even so you buy a new font now, for example doesn't contain any signs that are used in eastern Europe, maybe because it was designed in the Eighties. Many other open fonts don't support signs, left alone that some signs that exist can't be interpreted by an output unit.


Of course I have no idea about that matter, I've just been admin for several publishers and was in charge for the fonts, so I'm just a random voice from the internet.
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
User avatar
ZombieKnight
Posts: 154
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to use a custom font in my add-on?

Post by ZombieKnight »

Just to put it on the right note... I have full compatibility, all weird characters, and license.

You think license is such a problem? Can't just remove it from add-on server if it violates rules and tell the creator to rework the font thing... same like with images?
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
lhybrideur
Posts: 369
Joined: July 9th, 2019, 1:46 pm

Re: How to use a custom font in my add-on?

Post by lhybrideur »

I was going to say the same thing as ZombieKnight.
It is not a bigger problem than the rest of the stuff that are in add-on.
BfW neither checks for licensing of art nor if the add-on works, so it would be the problem of the one publishing the add-on adding the new font to check for the license and the completeness of the font..
User avatar
Celtic_Minstrel
Developer
Posts: 2233
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: How to use a custom font in my add-on?

Post by Celtic_Minstrel »

I don't think there is anything technically difficult about supporting custom fonts – we already let translators add arbitrary fonts suitable to their language, if necessary. It's mostly just that no-one ever found the time and motivation to do it. A pull request would very likely be accepted, if there were someone technically-inclined willing to implement it.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply