hi, i had some issue for render text on the screen #1746
Answered
by
ModNope
ChrisChou-freeman
asked this question in
Q&A
-
Hello, I am a rookie who has only recently used Golang. When I try to render text on the screen using Ebiten, the font position will drift according to different font types instead of the default 0,0 default coordinates. I am very confused. Why is it so. Thank you for reading my question, if you know the answer please let me know. |
Beta Was this translation helpful? Give feedback.
Answered by
ModNope
Aug 8, 2021
Replies: 1 comment 3 replies
-
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
ChrisChou-freeman
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Drawing glyphs of the font starts from the bottom corner. If you do not take into account the size of the glyph, then at coordinates 0,0 the glyph will be off-screen at the top.
After adding a vertical offset, the text will be below the screen border.
To account for the offset, there is a function that reports the length and width of the text with the selected font.
If you need to display texts with different fonts in 1 zone at a fixed size, use 1 font as the standard size.