Rendro.Text.Shaper.Simple (Rendro v1.0.0) (stable)

Copy Markdown View Source

Pure-Elixir text shaper. Uses cmap advance widths only — no NIF compilation required.

This is the default shaper. It supports Latin, Greek, Cyrillic, Armenian, Georgian, Han, Hiragana, Katakana, and precomposed Hangul. For complex scripts (Arabic, Indic, Thai, Hebrew, etc.) configure Rendro.Adapters.HarfBuzz.

Summary

Functions

Shapes text using cmap advance widths only (one glyph per grapheme, cluster: 0).

Functions

shape(font, text, opts \\ [])

@spec shape(Rendro.PDF.Font.t(), String.t(), keyword()) ::
  {:ok, [Rendro.Text.Shaper.glyph()]} | {:error, term()}

Shapes text using cmap advance widths only (one glyph per grapheme, cluster: 0).

Works for both built-in and embedded fonts. Returns {:error, {:shaping_required, script, hint}} when opts[:script] is one of the requires-shaping scripts this engine cannot render correctly (Arabic, Indic, Thai, Hebrew, and the rest of the curated complex-shaping set).