Anyone know how to display text-on-a-curve, such as around a badge or logo?
i would use textshape class it can rotate
Rotate I can do.
However, that gets me a straight line of words at an angle.
you can rotate each char, means one char one TextShape object.
TextShape rotation use radian.
a curve is simple
x = sin(angle) * distance
y = cos(angle) * distance
angle will be from to, where your curve starts and ends.
you can also change the algebraic sign or exchange the sin/cos.
for me is angle 0 at 12 o’clock.
in graphics, in picture, in PDF?
In an image, which I could save or iterate over the pixels of.
If I can get ‘something’ in a picture object then I can take it from there.
using the textshape , if I try to break the text up into characters, and then try to work out where they live along a circumference, then apply individual rotations…
I know its possible, but the maths scares me.
I had hoped that ImageMagik might have a function for it, but I havent found one yet.
you can also use the .Graphics from an Picture and paint into.
this is an example that paint in a canvas.
[code]Sub Paint(g As Graphics, areas() As REALbasic.Rect) Handles Paint
Const DegreeToRadian As Double = 0.0174533 'Pi / 180.0
var tx as String = “Hello Curve”
Var angle As Double = -45.0
Var distance As Double = 128.0
Var mx As Double = g.Width / 2.0
Var my As Double = g.Height / 2.0
Var x,y As Double
For c As Integer = 0 To tx.Length-1
Var char As String = tx.Middle(c,1)
x = mx + Sin(angle * DegreeToRadian) * distance
y = my + -Cos(angle * DegreeToRadian) * distance
Var t As New TextShape
t.Bold = True
t.FontSize = 24
t.x = x
t.y = y
t.Rotation = angle * DegreeToRadian
t.Value = char
t.HorizontalAlignment = TextShape.Alignment.Center
t.VerticalAlignment = TextShape.Alignment.Center
g.DrawObject t
angle = angle + (90.0 / CType(tx.Length-1, Double))
Next
End Sub
[/code]
Thank you! I’ll have a play with that.