Bug 972 : calculating font width for vector fonts does not work starting with processing 0150
Last modified: 2008-10-21 06:10




Status:
ASSIGNED
Resolution:
-
Priority:
P4
Severity:
normal

 

Reporter:
Ilu
Assigned To:
fry

Attachment Type Created Size Actions
screenshot image/png 2008-10-21 05:56 6.05 KB

Description:   Opened: 2008-10-21 02:49
same example as for bug 920, this time on screen rendering calculates wrong:

String TEST = "This is a test of the emergency broadcast system";

PFont f;

void setup() {
size(640, 480);

f = createFont("Monaco",9);
}

void draw() {
background(0);
fill(255);

textFont(f);
int w = (int) textWidth(TEST);
text(TEST, 50, 50);
rect(50, 50, w, 10);

noLoop();
}
Additional Comment #1 From fry 2008-10-21 05:35
that works fine on my machine, what's it doing on yours?
Additional Comment #2 From Ilu 2008-10-21 05:56
edit]
screenshot
Additional Comment #3 From Ilu 2008-10-21 05:57
the bar is shorter than the text, pls see attachment
Additional Comment #4 From fry 2008-10-21 05:58
Awesome, so it's different between different versions of Java.

I assume you're on OS X 10.5?
Additional Comment #5 From Ilu 2008-10-21 06:00
right, OS X 10.5 leopard, right. all macos patches applied...
Additional Comment #6 From fry 2008-10-21 06:02
k, i'll have to dig through apple's release notes for information on why
the text width calculation changed in 10.5.
Additional Comment #7 From fry 2008-10-21 06:04
also in the meantime, you may find that it works properly with a font
that's not monospaced, or at least just not monaco (courier or andale mono
might be better, for instance).
Additional Comment #8 From Ilu 2008-10-21 06:10
thanks, i need a monospaced font, but I'll use Courier for now...
This bug is now being tracked here.