JUCE methods for fitting text along a Path?


I’m looking through the docs and wondering if there are methods that would enable fitting labels along a path, e.g. within a circle? So that the text bends around the path.


There may be other methods… but I’d try putting the text onto an Image… then applying an AffineTransform on the Image

Also check out Graphics::addTransform()



Thanks I’ll check that out.


Interesting… I wonder if you could do something using a PathFlatteningIterator positioning and transforming the glyphs along the path using PositionedGlyph, adding them to a GlyphArrangement


That sounds more like a proper plan, the Image transform suggestions won’t get you a nice result because of the Image resampling, you’d really want to render each glyph with it’s correct transform to get the best results. Would like to see the result. Adamski, i would like to see what you come up with.


The points in PathFlatteningIterator look quite closely spaced (in units of 0.6) so I guess you could calculate the mean normal vector across the width of the glyph for a given section and calculate the rotation. If the path curves are relatively gentle this shouldn’t be too hard, but if there are tight complex curves it could get a bit trickier.


Yes, you’d need to iterate along the path, figuring out the angle as you go… You could probably do something with getPointAlongPath (and in fact may want to look inside that method at how it’s done for some tips on iterating)


Thanks all, its actually going to be following a circle, so I should be able to use just the one angle…