Skip to content

Incorrect calculation of the text width in the P2D renderer #1328

@OneMaxApps

Description

@OneMaxApps

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();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions