wilkelab / ggtext

Improved text rendering support for ggplot2
https://wilkelab.org/ggtext/
GNU General Public License v2.0
651 stars 37 forks source link

feature request: scale font to fit text into single line #64

Open Mashin6 opened 3 years ago

Mashin6 commented 3 years ago

Maybe this is already supported, but I couldn't find it. Sometimes I don't want to wrap the text just because it is 1 or 2 characters too long and more aesthetically pleasing is to make the font a little smaller, but all text stays in one line.

Currently element_textbox() support wrapping of long text into multiple lines, but a nice feature would be to automatically adjust font size so the whole text still fits into single line. So something what ggfittext is doing in geom_fit_text(), but this would be for element_textbox().

I feel like this should be possible since ggtext already knows how many characters of a given font size fit into a line before new line break is needed.