Skip to content
Prev 385745 / 398503 Next

text on curve

Hi Jinsong,
This is similar to the "arctext" function in plotrix. I don't want to
do all the trig right now, but I would suggest placing the characters
on the curve and then offsetting them a constant amount at right
angles to the slope of the curve at each letter. I would first try
having a "minspace" argument to deal with crowding at small radii and
you would probably have to start at the middle and work out to each
end. A tough problem and you have made a good start on it.  Check the
fragment below for a suggestion on how to avoid calling "substr"
repeatedly.

# get a vector of the characters in str
   # rather than call substr all the time
   strbits<-unlist(strsplit(str,""))

   for(i in 1:l) {
      w <- strwidth(strbits[i])
      h <- strheight(strbits[i])

Jim
On Tue, Sep 22, 2020 at 6:11 PM Jinsong Zhao <jszhao at yeah.net> wrote: