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

Questionable behavior of draw_string()'s width parameter #88172

Closed
MewPurPur opened this issue Feb 10, 2024 · 0 comments · Fixed by #88185
Closed

Questionable behavior of draw_string()'s width parameter #88172

MewPurPur opened this issue Feb 10, 2024 · 0 comments · Fixed by #88185
Assignees
Milestone

Comments

@MewPurPur
Copy link
Contributor

MewPurPur commented Feb 10, 2024

Tested versions

4.2.1

System information

Godot v4.2.1.stable - Pop!_OS 22.04 LTS - X11 - Vulkan (Forward+) - integrated Intel(R) Graphics (ADL GT2) () - 12th Gen Intel(R) Core(TM) i5-1235U (12 Threads)

Issue description

Sometimes, shrinking the width parameter of CanvasItem.draw_string() by 1 removes 2 characters off the end, which seems like it should never happen.

Steps to reproduce

func _draw() -> void:
	draw_string(load("res://CodeFont.ttf"), Vector2(8, 50), "1234567", HORIZONTAL_ALIGNMENT_LEFT, 68)  # Prints 1234567
	draw_string(load("res://CodeFont.ttf"), Vector2(8, 65), "1234567", HORIZONTAL_ALIGNMENT_LEFT, 67)  # Prints 12345

image

Minimal reproduction project (MRP)

CodeFont.zip

^ The font file, plus the above code on a node like Control, is everything necessary to reproduce this.

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

Successfully merging a pull request may close this issue.

3 participants