Open EVAST9919 opened 3 years ago
Maybe what is really needed here is a way to achieve the same visual effect (so e.g. vertical gradient & shadow on text) without resorting to using bitmaps raw. It might even be possible to set gradient colour on text already? Not sure.
Gradient is possible, yes. For this particular example the main problem is outline. Though it can be recreated using BufferedContainer
, however there's a big performance hit once this container is being scaled (I mean transforms). Yes, you can use RedrawOnScale = false
, but then visuals will suffer.
Ah right, I missed the outline due to dark theme. That does seem to be a bit of a problem...
Maybe this should exist alongside SpriteText
as a RawSpriteText
or similar and make that use source colour? Not sure.
Can you please tell what should I change (if it's a simple one) so at very least I can use local framework? I can't really find the point where the colour is specified.
You have two options:
RawCachingGlyphStore
to save and read RGBA instead of Aand
TimedExpiryGlyphStore
Fonts.AddStore(new TimedExpiryGlyphStore(Resources, "font"));
Note that the second will take a touch longer to load (and will have a temporarily higher memory footprint) as it is no longer benefitting from caching the PNG content to disk. You'd probably want to only use this for the fonts you need to. But you can also use it without a local framework fork.
If you want to fix it, you have to know that RawCachingGlyphStore
caches the glyph pages as alpha maps.
The createCachedPageInfo()
method creates the alpha map, specifically through the following code:
https://github.com/ppy/osu-framework/blob/eca80e83b118de60b745300791ce3b448ab7985c/osu.Framework/IO/Stores/RawCachingGlyphStore.cs#L71-L95
The createTextureUpload()
method reads the alpha map, and creates the resulting per-character texture upload.
Thanks!
Currently any colour in font atlas will become white. Atlas example:
Result:
![Аннотация 2021-04-17 153423](https://user-images.githubusercontent.com/22874522/115113429-f63a7580-9f92-11eb-9640-ba479286ad10.png)