Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
danielhowe
danielhowe's Profile
1
Posts
3
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
textWidth in processing.js
[5 Replies]
23-Jan-2012 07:26 AM
Forum:
Processing with Other Languages
Does anyone have a working example of the textWidth() function. It seems to return 0 for me in all my tests. An example below...
cheers, -DH
/*
@pjs
font="Batang.ttf"; */
void setup(
)
{
size(200,200);
noLoop();
textFont(createFont(
"Batang"
,32));
}
void draw(
)
{
background(255);
String t =
"test"
;
float tw = textWidth(t);
fill(0);
text(t, 50, 50);
text(
"tw="
+tw, 50, 90);
}
«Prev
Next »
Moderate user : danielhowe
Forum