fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
25.06k stars 1.39k forks source link

Add support for building without bundled fonts #2637

Open Jacalz opened 2 years ago

Jacalz commented 2 years ago

Is your feature request related to a problem? Please describe:

Similar to https://github.com/fyne-io/fyne/issues/2636 but for systems like Linux or BSD when you don't wan to bundle fonts because you wan to specify different fonts at runtime. This could be useful for package managers and Linux/BSD distros where they want to globaly define one font instead of bundling it into every binary.

As an example, let's say that we are building FyshOS and each system applications is a Fyne application. We thus have FyneDesk, a clock app, a calculator, a calendar, a contacts app, a weather app and a software center, to name a few. We might want to then set the FYNE_FONT= environment variables globally and avoid many unnecessary megabytes of duplicated fonts.

It could also be useful for people using other languages which simply use different fonts in the first place and thus don't need or care about the bundled fonts.

Is it possible to construct a solution with the existing API?

Might be possible to add build tags.

Describe the solution you'd like to see:

A build tag to build without bundled fonts.

andydotxyz commented 2 years ago

In theory yes, but I don't think we should support this with only a FYNE_FONT environment fallback. Then applications launched without the env will be unusuable. So I think we may need to solve the issue of looking up fonts before this makes sense