Skip to content

Centering text vertically does not work correctly #739

@processing-bot

Description

@processing-bot

In GitLab by @ThexXTURBOXx on Jul 5, 2023, 20:24

Description

textAlign(CENTER, CENTER) does not center text vertically correctly

Expected Behavior

After textAlign(CENTER, CENTER), text should be aligned in the center.

Current Behavior

The text is not centered vertically:

grafik

Steps to Reproduce

  1. Run the following sketch:
    void setup() {
      size(100,100);
    }
    
    void draw() {
      background(0);
      textAlign(CENTER,CENTER);
      textSize(100);
      text("Ap", width/2, height/2);
    }

Your Environment

  • Processing version: 4.2
  • Operating System and OS version: Windows 11 22621.1928

Possible Causes / Solutions

The issue lies most likely somewhere within these lines: https://github.com/processing/processing4/blob/main/core/src/processing/core/PGraphics.java#L4920-L4926
But I am not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions