We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I'm drawing some text on an image and color its background with ClearRect()
I noticed that when italics is set, the background and the image are incorrectly offset
see the picture, the string has some space before the text starts, and a section of the 't' is drawn outside the background
for both italics and normal style, GetStringBounds reports l:3.703125, t:-29.546875, r:204.656250, b:0.468750
l:3.703125, t:-29.546875, r:204.656250, b:0.468750
here is the relevant portions of my code
l, t, r, b := gc.GetStringBounds(str) strWidth := int(math.Ceil(r)) - int(math.Ceil(l)) strHeight := int(math.Ceil(t)) - int(math.Ceil(b)) pointX := (input.Bounds().Dx() - strWidth) / 2 pointY := (input.Bounds().Dy() - strHeight) / 2 gc.SetFillColor(color.RGBA{255,255,255,255}) gc.ClearRect(pointX, pointY, pointX + strWidth, pointY + strHeight) gc.SetFillColor(color.RGBA{0,0,0,255}) gc.FillStringAt(str, float64(pointX), float64(pointY))
The text was updated successfully, but these errors were encountered:
We need to use the new freetype API to draw and compute string length. It may correct this issue.
Sorry, something went wrong.
llgcode
No branches or pull requests
Hi, I'm drawing some text on an image and color its background with ClearRect()
I noticed that when italics is set, the background and the image are incorrectly offset
see the picture, the string has some space before the text starts, and a section of the 't' is drawn outside the background
for both italics and normal style, GetStringBounds reports
l:3.703125, t:-29.546875, r:204.656250, b:0.468750
here is the relevant portions of my code
The text was updated successfully, but these errors were encountered: