processing / processing/processing4
Incorrect calculation of the text width in the P2D renderer
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 494
- Forks
- 183
- Avg merge
- 4h 39m
- Merged PRs (30d)
- 3
Description
Most appropriate sub-area of Processing 4?
Core/Environment/Rendering
Processing version
4.3.4
Operating system
Windows 7
Bug description
Significant errors in calculating the width of text using the textWidth(String) method in P2D mode in the Eclipse environment
Steps to reproduce this
To reproduce the error, you need to run the code that I specified here in the Eclipse environment.
void settings() {
size(720,360,P2D);
}
void setup() {
stroke(0);
textSize(24);
final String str = "WWWtttt".repeat(100);
final float textWidth = textWidth(str);
text(str, 100 - textWidth, 200);
stroke(255, 0, 0);
line(100 - textWidth, 200, 100, 200);
noLoop();
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied Processing sketch in P2D mode under the reported environment and compare the textWidth result with the rendered text and reference line. Then trace the P2D renderer's text-width calculation; done means textWidth(String) measures the repeated string accurately and the reproduction no longer shows a significant alignment error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100