Technical guide

How our Arabic text shaper works

Arabic letters change form based on context. Harakat attach to base glyphs, mixed text follows the Unicode Bidirectional Algorithm, and each font has its own outlines. A text shaper resolves those relationships before anything is drawn.

  1. 01

    Source text

    The Studio keeps the Unicode source string intact. It never reverses Arabic text to fake RTL.

  2. 02

    Visual runs

    bidi-js separates Arabic, Latin, numbers, punctuation, and URLs into the correct visual runs.

  3. 03

    Glyph shaping

    HarfBuzz applies script, direction, language, ligatures, joining forms, marks, and positioning.

  4. 04

    Outline lookup

    opentype.js reads each shaped glyph ID from the selected TTF and produces an explicit path.

  5. 05

    Scene composition

    The scene applies alignment, position, scale, rotation, fill, stroke, shadow, and canvas settings.

  6. 06

    Shared export

    The preview, PNG, SVG, and PDF all consume those same scene paths.

Why browser text is not enough

A browser text node, a canvas fillText call, and a PDF text layer can choose different shaping engines or font fallbacks. The Studio instead shapes once and passes explicit glyph paths to every output. That makes visual differences testable and keeps SVG independent from installed fonts.

Source text vs. displayed glyphs

Unicode stores the characters you typed; it does not require you to replace every Arabic letter with a visual presentation-form character. The shaping engine reads the text, direction, font tables and nearby characters, then selects and positions the correct glyphs. Keeping the source text intact preserves copying and editing.

Why vector export needs shaping

A browser can shape live text for the screen, but an SVG or PDF made from outlines needs exact glyph IDs, positions and advances. HarfBuzz supplies that layout data before the exporter converts each glyph to a path. This keeps joins, ligatures and Harakat consistent in a file that no longer depends on installed fonts.

Try the Arabic shaping pipeline

Enter Arabic with diacritics, numbers or a Latin word in the editor, compare the preview, then export SVG to inspect the final paths. You can also compare all 12 included typefaces before choosing one.

Primary technical references

Open your text in the full path-based editor.

Open Studio