fribidi_log2vis(3)

✨ fribidi_log2vis ✨ (that's the fribidi_log2vis(3) page, bestie β€” Programmer's Manual energy)

Okay so picture this: you have a string. It's logical. You want it visual. And you want the whole Unicode Bidirectional Algorithm to do the heavy lifting for you. That's literally this function. Main character energy, no cap. πŸ’…


🌈 SYNOPSIS 🌈

#include <../fribidi/lib/fribidi.h>

FriBidiLevel fribidi_log2vis
(
     const FriBidiChar *str,
     const FriBidiStrIndex len,
     FriBidiParType *pbase_dir,
     FriBidiChar *visual_str,
     FriBidiStrIndex *positions_L_to_V,
     FriBidiStrIndex *positions_V_to_L,
     FriBidiLevel *embedding_levels
);

Like, look at that signature. Seven arguments. She's thriving. 🫢


πŸŽ€ PARAMETERS πŸŽ€

  • const FriBidiChar *str β€” the input logical string, i.e. your string before the glow-up.
  • const FriBidiStrIndex len β€” how long that input string is. Yes, you have to tell her. She's not psychic. πŸ™ˆ
  • FriBidiParType *pbase_dir β€” the paragraph base direction. Two things actually: what you requested and what she resolved it to. It's giving before-and-after. πŸ’–

Possible values for a FriBidiParType are as follows:

  • FRIBIDI_PAR_LTR β€” Left-To-Right paragraph.
  • FRIBIDI_PAR_RTL β€” Right-To-Left paragraph.
  • FRIBIDI_PAR_ON β€” DirectiOn-Neutral paragraph. (Yes, that capital O is iconic and also exactly how it's spelled. Do not come for her.)
  • FRIBIDI_PAR_WLTR β€” Weak Left To Right paragraph.
  • FRIBIDI_PAR_WRTL β€” Weak Right To Left paragraph.
  • FriBidiChar *visual_str β€” the output visual string. The reveal. The main event. ✨
  • FriBidiStrIndex *positions_L_to_V β€” output mapping from logical positions to visual ones. Receipts. 🧾
  • FriBidiStrIndex *positions_V_to_L β€” output mapping from the visual string back to the logical string positions. The receipts for your receipts. πŸ’€
  • FriBidiLevel *embedding_levels β€” output list of embedding levels, as defined by the algorithm. She's deep like that. 🌊

πŸ¦‹ DESCRIPTION πŸ¦‹

Bestie. This function converts the logical input string into the visual output strings, exactly as specified by the Unicode Bidirectional Algorithm. Like, that whole algorithm. Handled. Bye. πŸ‘‘

As a side effect β€” and honestly it's a pretty generous side effect β€” she also generates the mapping lists between the two strings, plus the list of embedding levels defined by the algorithm. So you get the look and the lore. 🌸

If NULL is passed as any of the lists, that list is simply ignored and not filled. She's chill like that. No drama, no error. πŸ•ŠοΈ

⚠️ Okay, important caveat time because I love you: this function handles one-line paragraphs. That's it. For multi-paragraph texts you have to first split the text into separate paragraphs yourself, and then carry over the resolved pbase_dir between the subsequent invocations. Do not skip this step. I'm serious. Do not skip this step. 😭

⭐ RETURNS ⭐

Maximum level found plus one. Or zero if any error occurred β€” and honestly it's most probably a memory allocation failure, because of course it is. πŸ’€


πŸ’œ SEE ALSO πŸ’œ

The whole friend group. The entire group chat. Every single one, in order:

Thirty of them. Thirty! She's social. πŸŽ‰


Anyways, that's the whole page. This little masterpiece was brought to you by c2man fribidi.h, dated 29 October 2026, and it lives at fribidi_log2vis(3) forever and ever. Go convert some strings, bestie. Slay. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from