Closed hajimehoshi closed 3 months ago
Adjusting the glyph image so that (0, 0) matches the origin position
When a glyph image is shifted by some subpixels, (0, 0) doesn't represent the exact origin position. Then, probably adding new members to Glyph would be the only way to go.
In etxt (0, 0) is always the origin position of the glyph. This is why I was requesting custom bounds in images in the past, so you can keep the side bearings there and draw directly at the expected position. So, that's doable, and I actually thought you were doing the same in text/v2?
Also, I don't know what you mean by "When a glyph image is shifted by some subpixels, (0, 0) doesn't represent the exact origin position". Subpixels should only be used on subpixel antialiasing, which we are not doing, and position quantization, which we are doing, but results in different glyph masks and images.
Also, I don't know what you mean by "When a glyph image is shifted by some subpixels, (0, 0) doesn't represent the exact origin position". Subpixels should only be used on subpixel antialiasing, which we are not doing, and position quantization, which we are doing, but results in different glyph masks and images.
With the nearest filter, we cannot use the float rendering position (though GeoM takes float64 values). (0, 0) can never represent the exact origin position when the glyph was shifted by (0.5, 0) for example.
Subpixels should only be used on subpixel antialiasing, which we are not doing
Glyphs are shifted by subpixels by default. So we are doing it.
@setanarut I've added OriginX
and OriginY
to Glyph
. Please try
go get github.com/hajimehoshi/ebiten/v2@a3d084e2de1cb619b2636dad3b1c82573e4f1034
Here are the examples to render origin positions:
thanks i will try
Operating System
What feature would you like to be added?
Now there is no way to get the origin position of the glyph. For example, it is impossible to layout glyphs along with a curved line as if the baseline is bended. (This was what @setanarut was trying to do)
Possible solusions are:
Why is this needed?
No response