processing / processing/processing4

Text mis-aligned when scaling and using `textSize()` with `P2D`

Aperta
#425 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

help wanted opengl
Lingua principale
Java
Stelle
494
Fork
183
Merge medio
4h 39m
PR unite (30g)
3

Descrizione

Created by: Santarii

Expected Behavior

If I use the scale function and then use the textSize function to reverse that scaling, I expect to get the same result as just rendering the text without any scaling.

Current Behavior

In the default renderer the text is lower than it should be when scaled up then sized back down. In P2D the space between characters also changes.

Steps to Reproduce

float scale = 1;

void setup() {
  size(1920, 1080, P2D);
  textFont(createFont("Consolas", 256));
}

void draw() {
  scale += 1;
  scale(scale);
  background(0);
  textAlign(LEFT, TOP);
  textSize(256f/scale);
  text("Wow", 0, 0);
}

This code renders text, and each frame increases the scale, but the scale is exactly reversed with the textSize function. If the bug didn't exist, this would look like stationary unchanging text, however this is not the case.

Your Environment

  • Processing version: 4.0b6
  • Operating System and OS version: Windows 10 Home 64-bit. 10.0.19043 Build 19043.

Possible Causes / Solutions

It seems to not just be small values in textSize, even reasonable values mess with the alignment a bit, though very small values have a more significant effect.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia eseguendo lo sketch Processing fornito con il renderer P2D, quindi confrontalo con il renderer predefinito mentre ridimensioni e applichi la textSize() inversa. Analizza il comportamento dell’allineamento del testo e della spaziatura dei caratteri del renderer; il lavoro è completato quando il testo rimane visivamente fermo e con una spaziatura uniforme al variare della scala.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
computer-graphics
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.