hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
10.74k stars 649 forks source link

text/v2: proposal: `NotoFace` using Noto font faces automatically #2851

Open hajimehoshi opened 9 months ago

hajimehoshi commented 9 months ago

Operating System

What feature would you like to be added?

I propose a new Face implementation NotoFace, which downloads necessary Noto font files on the fly. A user would be able to render any glyphs in any environments in theory.

I think we can get a necessary face file names from the tool https://github.com/notofonts/nototools, but I am not 100% sure.

Why is this needed?

NotoFace should be very useful for tests. This might be risky to use for productions.

Zyko0 commented 9 months ago

If this is downloading, I think it might be better in an utils package

hajimehoshi commented 9 months ago

Makes sense

tinne26 commented 9 months ago

Just in case, but did you consider a separate repository that contains Noto fonts for easy use with ebiten/text/v2? Something along the lines of what I did with https://github.com/tinne26/fonts for etxt. In this case, you would do something like:

import "github.com/ebitengine/fonts/noto/xyz"
// ...
var face text.Face = xyz.StdFace(params) // and/or xyz.GoTextFace(params)
// ...

You wouldn't be able to cover "all languages", but it seems much safer. No runtime downloads, no risk of unnecessary redownloads, we are reusing the same types, etc. It seems to preserve most of the benefits without too many downsides? Unless you are thinking of dynamically handling any possible input language, of course. But even then, a notoface repository that downloads dynamically and can return the GoTextFace seems more convenient to avoid creating new types.

hajimehoshi commented 9 months ago

I didn't intend this feature for serious usages, so I didn't consider this idea. Let me think