Skip to content
New issue

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

RichTextLabel's [url] bounding box is incorrect if bbcode updates the [font_size] #92437

Closed
mthwJsmith opened this issue May 27, 2024 · 5 comments · Fixed by #92461
Closed

RichTextLabel's [url] bounding box is incorrect if bbcode updates the [font_size] #92437

mthwJsmith opened this issue May 27, 2024 · 5 comments · Fixed by #92461
Assignees
Milestone

Comments

@mthwJsmith
Copy link

mthwJsmith commented May 27, 2024

Tested versions

Reproducible in 4.3 dev, 4.2.2, and 3.5.

System information

Windows 11

Issue description

Setting the font_size in a tag for a part of the url, makes the entire line follow that bounding box.

image

The clickbox for the whole line is at the height of the largest piece of text, in this case the one word set at font_size=80

Steps to reproduce

extends RichTextLabel
func _ready():
	bbcode_enabled = true
	text = "[url]Url bounding box is [font_size=80]broken[/font_size][/url][url]it also affects other url on the same line[/url]"

The click of the url is at the height of the biggest font size.

Minimal reproduction project (MRP)

URL-Hitbox.zip

@AThousandShips
Copy link
Member

Does it work if you close the url tag properly? Like so:

extends RichTextLabel
func _ready():
	bbcode_enabled = true
	text = "[url]Url bounding box is [font_size=80]broken[/font_size][/url][url]it also affects other url on the same line[/url]"

@mthwJsmith
Copy link
Author

mthwJsmith commented May 27, 2024

Does it work if you close the url tag properly? Like so:

extends RichTextLabel
func _ready():
	bbcode_enabled = true
	text = "[url]Url bounding box is [font_size=80]broken[/font_size][/url][url]it also affects other url on the same line[/url]"

Yes sorry this was just a typo on the github post. My project does close the url properly and the bug remains.

Recording.2024-05-27.180959.mp4

@AThousandShips
Copy link
Member

Yes sorry this was just a typo on the github post. My project does close the url properly.

The screenshot originally posted did also have the same error, see the closing bracket at the end, hence why I asked

@mthwJsmith
Copy link
Author

mthwJsmith commented May 27, 2024

Yes sorry this was just a typo on the github post. My project does close the url properly.

The screenshot originally posted did also have the same error, see the closing bracket at the end, hence why I asked

Yes, my bad thanks for mentioning it. I've fixed it in the original post now.

I noticed this issue in my main project where I want to use multiple url's in the same line which often have different sizing which is done via bbcode.

So I assume that the engine is not accounting for bbcode tag changes to the appearance of text when calculating the shaped_text_hit_test_grapheme that was coded in #64767

@Calinou
Copy link
Member

Calinou commented May 27, 2024

For context, this is how it works in Firefox with the following page:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Test</title>
  <style>
    a:hover {
      color: green;
    }
  </style>
</head>
<body>
  <a href="">Url bounding box is <span style="font-size: 72px">broken</span> it also affects url on the same line</span>
</body>
</html>
simplescreenrecorder-2024-05-27_19.21.11.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants