Hi,

I'm using DrawtextOnPath. 

My first question is what does hOffset really mean? It says the distance 
along the path to add to the text's starting position. Is this Euclidean 
distance in pixels or what?

There is no Canvas.measurePath() command that I can tell, so I have 
estimated the total length of the path by summing the length of its line 
segments. 

lengthsquared+=(x-lastx)*(x-lastx) + (y-lasty)*(y-lasty);

totallength = Math.sqrt(lengthsquared)

I think, using my excellent math skills, that I should then be able to 
divide totallength by canvas.measureText() to get a number of times I should 
repeat the text along the path, evenly spaced.

But I am find that the totallength in most cases is smaller than it should 
be. So what should the true range of hOffset be?
public void drawTextOnPath 
(String<http://developer.android.com/reference/java/lang/String.html>
 text, Path<http://developer.android.com/reference/android/graphics/Path.html> 
path, 
float hOffset, float vOffset, 
Paint<http://developer.android.com/reference/android/graphics/Paint.html>
 paint)
Since: API Level 
1<http://developer.android.com/guide/appendix/api-levels.html#level1>

Draw the text, with origin at (x,y), using the specified paint, along the 
specified path. The paint's Align setting determins where along the path to 
start the text.
ParameterstextThe text to be drawnpathThe path the text should follow for 
its baselinehOffsetThe distance along the path to add to the text's starting 
positionvOffsetThe distance above(-) or below(+) the path to position the 
textpaintThe paint used for the text (e.g. color, size, style)
Second Question. 
The other problem is that it doesn't look so great. 
It does look okay in APIDemos where you know both the size of the text and 
have control over the path. 
But when you are data driven and you are using the Path to draw a, well, 
path, as in walking path and trying to stretch a label on it, it tends to 
look like graffiti rather easily. When going around a convex curve or 
corner, it stretches letters as if there were an ink spill. When going 
around a concave curve, words overlap like a broken typewriter. 
 
Has anyone done something to make it look better?
I know some of this is art more than science. 

Nathan

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to