fribidi_get...ng_levels_ex(3)

πŸ’… NAME

fribidi_get_par_embedding_levels_ex β€” bestie, this is the one that gets you the bidi embedding levels of a whole paragraph ✨

(also hi, you're reading the Programmer's Manual, welcome to the function that does the actual Unicode bidi heavy lifting 🫢)


πŸŽ€ SYNOPSIS

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

FriBidiLevel fribidi_get_par_embedding_levels_ex
(
     const FriBidiCharType *bidi_types,
     const FriBidiBracketType *bracket_types,
     const FriBidiStrIndex len,
     FriBidiParType *pbase_dir,
     FriBidiLevel *embedding_levels
);

🌸 PARAMETERS

  • const FriBidiCharType *bidi_types β€” the input list of bidi types, exactly as handed back by fribidi_get_bidi_types(). πŸ’–

and okay so, a little note: since there are 23 possible values for a const FriBidiCharType, they are not all listed here. iykyk, there's literally 23 of them, we're not doing that πŸ’€

  • const FriBidiBracketType *bracket_types β€” the input list of bracket types, as handed back by fribidi_get_bracket_types(). πŸŽ€
  • const FriBidiStrIndex len β€” input string length of the paragraph. that's it, that's the whole vibe. πŸ“
  • FriBidiParType *pbase_dir β€” the requested and resolved paragraph base direction. it goes in as your ask and comes back as the answer, main character energy fr fr ✨

the possible values for a FriBidiParType are, in order:

  • FRIBIDI_PAR_LTR β€” Left-To-Right paragraph.
  • FRIBIDI_PAR_RTL β€” Right-To-Left paragraph.
  • FRIBIDI_PAR_ON β€” DirectiOn-Neutral paragraph. (yes it's spelled like that, iconic πŸ’…)
  • FRIBIDI_PAR_WLTR β€” Weak Left To Right paragraph.
  • FRIBIDI_PAR_WRTL β€” Weak Right To Left paragraph.
  • FriBidiLevel *embedding_levels β€” the output list of embedding levels. this is where the magic lands, your fave delivery slot πŸ¦‹

πŸ”₯ DESCRIPTION

okay so here's what's tea β˜•: this function finds the bidi embedding levels of a single paragraph, as defined by the Unicode Bidirectional Algorithm, which lives at http://www.unicode.org/reports/tr9/. go read it, it's giving lore.

she implements rules P2 to I1 inclusive, and parts 1 to 3 of L1 β€” with one exception, rule X9, because X9 is implemented over in fribidi_remove_bidi_marks() instead. and part 4 of L1? that one lives in fribidi_reorder_line(). so like, this function does her part and trusts her friends to do theirs, teamwork slay 🀝

also! there are a few macros defined in fribidi-bidi-types.h to work with these embedding levels. so go look at those before you start hand-rolling stuff, bestie, i'm begging πŸ™ˆ


⭐ RETURNS

maximum level found plus one πŸŽ‰ β€” or zero if any error occurred (memory allocation failure, most probably 😭).

ngl if you get a 0 back, don't just keep going β€” check that allocation. zero is the "something went wrong" vibe check and it failed. πŸ’€

πŸ¦‹ SEE ALSO

the whole friend group, fr fr:


and that's the page, bestie 🫢 this lil gift was generated by c2man from fribidi-bidi.h, dated 29 October 2026 β€” go forth and get those embedding levels, you're gonna ate πŸ’–πŸ‘‘

πŸ“¦ where this page comes from