fribidi_get_par_direction(3)

πŸ’– fribidi_get_par_direction β€” get base paragraph direction πŸ’–

okay so this is a page from the Programmer's Manual for fribidi_get_par_direction(3), and honestly? it's a little cutie that just wants to tell you which way your paragraph goes. let's get into it ✨


✨ SYNOPSIS ✨

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

FriBidiParType fribidi_get_par_direction
(
     const FriBidiCharType *bidi_types,
     const FriBidiStrIndex len
);

like, that's the whole vibe. two args, one direction. slay πŸŽ€


🌸 PARAMETERS 🌸

  • const FriBidiCharType *bidi_types β€” bestie, this is your input list of bidi types, exactly as they come back from fribidi_get_bidi_types(). 🫢 and real talk: there are 23 possible values for a const FriBidiCharType, so they are not all listed here. we're not doing a 23-item list, iykyk.
  • const FriBidiStrIndex len β€” the input string length. that's it. that's the whole thing. πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does this actually do? it finds the base direction of a single paragraph, as defined by rule P2 of the Unicode Bidirectional Algorithm, which lives over at http://www.unicode.org/reports/tr9/#P2. iconic algorithm, no cap.

now β€” plot twist β€” you typically do not need this function, because fribidi_get_par_embedding_levels() already knows how to compute the base direction itself. 😭 but! you might need this one if you're implementing a more sophisticated paragraph direction handling. main character energy.

and here's the juicy bit: you can pass more than a paragraph to this function, and it'll return the direction of the first non-neutral paragraph. that is, fr fr, a very good heuristic for setting the direction of the neutral paragraphs at the beginning of text. 🌈

for other neutral paragraphs, you're better off using the direction of the previous paragraph. don't fight it, just do it πŸ’œ

πŸ‘‘ RETURNS πŸ‘‘

base pargraph direction. πŸ’€ no weak paragraph direction is ever returned β€” only LTR, RTL, or ON. periodt.

the 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 πŸ¦‹
  • FRIBIDI_PAR_WLTR β€” Weak Left To Right paragraph
  • FRIBIDI_PAR_WRTL β€” Weak Right To Left paragraph

(yes the weak ones are listed here even though the function doesn't return them β€” that's the full set of possible FriBidiParType values, so now you know the whole family 🌸)


πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, respectfully:

fribidi_shape_arabic(3), fribidi_get_par_embedding_levels_ex(3), fribidi_reorder_line(3), fribidi_get_bidi_type(3), fribidi_get_bidi_types(3), fribidi_get_bidi_type_name(3), fribidi_charset_to_unicode(3), fribidi_unicode_to_charset(3), fribidi_parse_charset(3), fribidi_debug_status(3), fribidi_set_debug(3), fribidi_mirroring_status(3), fribidi_set_mirroring(3), fribidi_reorder_nsm_status(3), fribidi_set_reorder_nsm(3), fribidi_log2vis_get_embedding_levels(3), fribidi_get_type(3), fribidi_get_type_internal(3), fribidi_get_par_embedding_levels(3), fribidi_join_arabic(3), fribidi_get_joining_type(3), fribidi_get_joining_types(3), fribidi_get_joining_type_name(3), fribidi_get_mirror_char(3), fribidi_shape_mirroring(3), fribidi_get_bracket(3), fribidi_get_bracket_types(3), fribidi_shape(3), fribidi_remove_bidi_marks(3), fribidi_log2vis(3)


k bye bestie, go set some paragraph directions πŸ’…βœ¨

this page was brought to you by c2man on the file fribidi-bidi.h, dated 29 October 2026 β€” and it's the manual page for fribidi_get_par_direction(3), obviously πŸŽ€

πŸ“¦ where this page comes from