processing/processing

incorrect textWidth() with pixelDensity(2) when textFont() not used

Geschlossen

#5.768 geöffnet am 23.01.2019

 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (1.540 Forks)batch import
help wanted

Repository-Metriken

Stars
 (6.431 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Processing 3.4 / 3.5.2 OSX 10.12.6

println(textWidth("A")); gives me 8.279297. When I used pixelDensity(2); it will gives 16.558594.

But there is more! Having the following sketch:


void setup() {
  size(200, 200);  
  pixelDensity(2);
}

void draw() {
  background(30);
  rectMode(CORNERS);
  fill(255);
  rect(65, 80, 190, 110);
  fill(0);
  text("A B C D E F G H I J K", 65, 80, 190, 110);
}

pixelDensity(1)

pixelDensity(2)

and in P2D (pixelDensity(2)):

Note that FX2D works fine with pixelDensity(1) and pixelDensity(2) (also the textWidth returned is consistent, so I guess fixing that will fix the whole issue). (I thought I posted something related regarding the size of a tab but I can't find it).

Contributor Guide