Learn R Programming

textshaping

This package is a low level package that provides advanced text shaping capabilities to graphic devices. It is based on the FriBidi and HarfBuzz libraries and provides full support for correctly shaping left-to-right, right-to-left, and bidirectional text with full support for all OpenType features such as ligatures, stylistic glyph substitutions, etc.

For an example of a package that uses textshaping to support advanced text layout see ragg.

A big thanks to Behdad Esfahbod who is the main author of both FriBidi and HarfBuzz and has been very helpful answering questions during the course of development.

Installation

You can install textshaping from CRAN with install.packages("textshaping"). For the development version you can install it from Github with devtools:

devtools::install_github("r-lib/textshaping")

Note that you will need both the development versions of FriBidi and HarfBuzz to successfully compile it.

Code of Conduct

Please note that the textshaping project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Copy Link

Version

Install

install.packages('textshaping')

Monthly Downloads

875,982

Version

1.0.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Thomas Lin Pedersen

Last Published

May 1st, 2025

Functions in textshaping (1.0.1)

text_width

Calculate the width of a string, ignoring new-lines
get_font_features

Get available OpenType features in a font
lorem_text

Get gibberish text in various scripts
textshaping-package

textshaping: Bindings to the 'HarfBuzz' and 'Fribidi' Libraries for Text Shaping
plot_shape

Preview shaped text and the metrics for the text box
shape_text

Calculate glyph positions for strings