Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow addons to add fonts. (GNA #21948) #1386

Open
wesnoth-bugs opened this issue May 8, 2017 · 20 comments
Open

allow addons to add fonts. (GNA #21948) #1386

wesnoth-bugs opened this issue May 8, 2017 · 20 comments
Labels
Enhancement Issues that are requests for new features or changes to existing ones. UI User interface issues, including both back-end and front-end issues. WML Issues involving the WML engine or WML APIs.

Comments

@wesnoth-bugs
Copy link

Original submission by gfgtdf on 2014-04-21

Ye what i said in the title. I think i'd be nice do allow addon designers to add their own fonts in the game for their scenarios.

When i wrote my last addon i was sad because i wanted to show a letter with a gui2 dialog, but couldn't get a platform independent handwriting font.

(Reproduced on all)
Release: 1.13
Priority: 5 - Normal
Severity: 2 - Minor

@wesnoth-bugs wesnoth-bugs added the Enhancement Issues that are requests for new features or changes to existing ones. label May 8, 2017
@Wedge009 Wedge009 added the Add-ons Issues with the add-ons client and/or server. label Sep 6, 2019
@jostephd jostephd added UI User interface issues, including both back-end and front-end issues. WML Issues involving the WML engine or WML APIs. and removed Add-ons Issues with the add-ons client and/or server. labels Sep 15, 2019
@jostephd
Copy link
Member

@gfgtdf Note that it's already possible to do <span font_family='monospace'>foo</span> ( https://developer.gnome.org/pango/stable/pango-Markup.html )...so I think this is really a feature request for pango, isn't it? For them to add font_family='handwriting', for example?

Alternatively, we could package some handwriting fonts with wesnoth itself; I'm not convinced there's a need to allow addons to package fonts. (This can even lead to security issues, if the font files are malicious)

@Wedge009 I've relabeled this since the Add-ons label is about the addon manager. I've labeled it WML since [message] supports specifying fonts (https://wiki.wesnoth.org/InterfaceActionsWML#Formatting).

@gfgtdf
Copy link
Contributor

gfgtdf commented Sep 15, 2019

so I think this is really a feature request for pango, isn't it?

The idea was that you can add a font in yoru addon and then use < .. font="my_font_name">, and i'm quite sure that we dont need additinal feature for pango for that.

For them to add font_family='handwriting', for example?

One could say that handwriting was just an example say someone wanted a pixelfont, or a an oldgerman font. or maybe ven two differnt handwriting fonts in their addon, then a featurerequest at pango for a new know font_family or a new font added to wesnoth itself would not help.

@GregoryLundberg
Copy link
Contributor

If we're going to allow UMC to select fonts or font families, we probably want to a Preferences to ignore all that so I can force my game to use a nice, bold, erect font so I can see it.

@gfgtdf
Copy link
Contributor

gfgtdf commented Sep 15, 2019

If we're going to allow UMC to select fonts or font families

UMC can alreaqdy do that, you can write suff like < .. font="font_name"> and if the font is installed on your cpmuter pango will use it (only tested on windows 1.14), what i cannot do it shipping its won fonts within the addon.

@GregoryLundberg
Copy link
Contributor

Oh, so the question is to allow the UMC to ADD a new font to the client system?

If Wesnoth maintains its own font folder, where Pango looks prior to checking the system fonts, no problem. Otherwise, I'd just close this Issue as too much trouble.

It'd be far easier to just have the UMC author write a note suggesting a font and telling us how to find it online.

@jostephd
Copy link
Member

The idea was that you can add a font in yoru addon and then use < .. font="my_font_name">, and i'm quite sure that we dont need additinal feature for pango for that.

Yes, I understood what you suggested. I just think "let addons ship fonts" is not the best way to solve the problem of "let addons create GUI2 dialogs that use custom fonts". As I said, simply shipping a handful of fonts with wesnoth itself would solve the problem. I suggest to do that first. If we ship five fonts with wesnoth and we find that many add-ons use them and add-on authors keep asking us to add more fonts, then we can see about letting add-ons ship their own fonts... but we are not there yet.

One could say that handwriting was just an example say someone wanted a pixelfont, or a an oldgerman font. or maybe ven two differnt handwriting fonts in their addon, then a featurerequest at pango for a new know font_family or a new font added to wesnoth itself would not help.

Asking to have both fonts added to wesnoth would help, though. And you don't seem to have considered this option. Again, I suggest that you start by shipping some more fonts with wesnoth itself.

@gfgtdf
Copy link
Contributor

gfgtdf commented Sep 16, 2019

I just think "let addons ship fonts" is not the best way to solve the problem of "let addons create GUI2 dialogs that use custom fonts"

I currently see no advantages of your proposal over letting add-ons ship their own fonts.

@GregoryLundberg
Copy link
Contributor

GregoryLundberg commented Sep 16, 2019

The advantage is that I can replace the fonts with something readable and know it will take care of evereythiung. Otherwise, random UMC will be unplayable because I can't read with it says.

@jostephd
Copy link
Member

I currently see no advantages of your proposal over letting add-ons ship their own fonts.

With respect, @gfgtdf, you sound a little fixated on that particular approach.

For one, my proposal means add-ons that use custom fonts will be smaller, and their authors won't have to hunt around for (suitably licensed) font files they can use.

Moreover, there have been vulnerabilities where malicious fonts could execute arbitrary code, so loading fonts from add-ons can be a security issue.

@gfgtdf
Copy link
Contributor

gfgtdf commented Sep 17, 2019

With respect, @gfgtdf, you sound a little fixated on that particular approach.

Well yes the iusse is called 'allow addons to add fonts', the usecase from my first post is just an example. Moreover i curently don't really work on the the addon where i needed that anymore so it might not be the best one, but iirc i discussed this proposal before i added it to the tracker (not sure where probably irc or the forums), and got positive feedback about this proposal. And if we focus too much on my example i gave in the first post, we might not cover whatever they needed it for

The advantage is that I can replace the fonts with something readable and know it will take care of evereythiung. Otherwise, random UMC will be unplayable because I can't read with it says.

Hmm i don't think this is really a good reason, you kinda sound like you expect only the worst from umc devs and that they'll use it reclessly, i thinks its somehow safe to assume that addons that are already good will not randomly use new fancy fonts everywhere just because they can.

For one, my proposal means add-ons that use custom fonts will be smaller

In my expereince fonts are not that big (filesize) that it'd matter here.

and their authors won't have to hunt around for (suitably licensed) font files they can use.

hmm yes searching for fonts is sometimes not that easy, on the other hand we'd need to do this work ourselfes if we went with the ship-fonts-with-wesnoth approach, and might still not find exactly the font that the umc dev wanted.

Moreover, there have been vulnerabilities where malicious fonts could execute arbitrary code, so loading fonts from add-ons can be a security issue.

Hmm certainly an issue to think of, but browsers can 'safely' load custom fonts already iirc, so i is possible. The quesiton is whether the library we use cares for security or not.

@GregoryLundberg
Copy link
Contributor

I don't see a problem if the font is not installed but used directly from the UMC folder and if I can disable the feature.

My comment earlier was based more on the idea of handwriting fonts. I find many of them quite hard to read. But I'd have no problem with a UMC including a Klingon font, for story purposes because it would be clean we are not intended to read it.

@CelticMinstrel
Copy link
Member

CelticMinstrel commented Feb 24, 2024

I think it's probably a good idea to do what jostephd said (bundle some extra decorative fonts such as "handwriting" etc) but also allow addons to bundle new fonts. The reason for this is translations.

If something like a handwriting font is bundled with the game, it's our responsibility (more specifically, probably the translators' responsibility) to ensure there is a suitable handwritten font for each supported language.

On the other hand, if something like a handwriting font is bundled with an add-on, it's the add-on author's responsibility to ensure that they have support for any language they get a translation for.

But there are also cases where the language is irrelevant, like a Klingon font as previously mentioned, or maybe a symbols font or something. So add-on developers should be able to distribute their own fonts as well.

Side note: I think Wesnoth should also bundle some of these as fonts for add-on authors to use.

I definitely see Gregory Lundberg's point with respect to readability. Allowing custom fonts certainly opens the door to some potentially crazy layouts. But on the other hand, allowing Pango formatting at all has already opened that door, so…

@cooljeanius
Copy link
Contributor

Link to a forum thread requesting this feature: https://forums.wesnoth.org/viewtopic.php?t=57759&sid=42de4ec6fbe3e7e3ce28daa0dc420809

@hladkyjakub
Copy link

Hi,
I'm only a modder, but from my perspective it would be good to let add-ons implement their own fonts...
I think people could put a really good use of runes, elvish texts, set in stone text, handwriting...
Also I like the idea of a different fonts for different characters/races could better reflect their personality or they could change the meaning of what they are saying (for different emotion).

@hladkyjakub
Copy link

Throught I don't know how hard it is to implement them...

@CelticMinstrel
Copy link
Member

Also I like the idea of a different fonts for different characters/races could better reflect their personality

This sounds like a horrible idea to me… it could maybe work if there was like, one character who speaks in a different font, but if each character or each race had its own font I think I'd get annoyed.

@doofus-01
Copy link
Member

It probably depends on the fonts. As long as they are all legible, it could be like having different-sounding voices, as different races probably have greater variety than humans do in reality.

But you probably don't need fonts for that, you can already adjust pango settings to make the text distinct.

@hladkyjakub
Copy link

hladkyjakub commented Mar 9, 2024

What I mainly got on mind was a more curly font (and + size) for the Storyteller

@doofus-01
Copy link
Member

"Curly" might be a stretch, I don't know what all fonts are normally available, but size and distinction is certainly possible without new fonts. Check out https://wiki.wesnoth.org/InterfaceActionsWML#Formatting if you haven't already.

@CelticMinstrel
Copy link
Member

I would note that if we want to add, say, a "handwriting" font, or if we wanted to support using Oldania in add-ons, it would be best to define generic font families so that add-on authors can just write font-family=cursive or font-family=fantasy or or font-family=blackletter or font-family=handwriting or whatever. That supports the idea that other languages may want to use a different font for that generic family. I don't know if this is actually supported in Pango or font-config or whatever. It might be quite a pain to get it to work, and it may be such a pain that it's not worthwhile, but it would, I think, be an ideal state of affairs.

Of course, referencing an actual font name should obviously be fine too. If someone wants font-family=Wesmere-Elvish or font-family=Elensefar-Mermish then it should use that exact font. (Obviously I made up those names; those fonts don't exist, at least by those names. But they could and, in my opinion, should exist, in some form.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Issues that are requests for new features or changes to existing ones. UI User interface issues, including both back-end and front-end issues. WML Issues involving the WML engine or WML APIs.
Projects
None yet
Development

No branches or pull requests

9 participants