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 fromfribidi_get_bidi_types(). π«Ά and real talk: there are 23 possible values for aconst 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 paragraphFRIBIDI_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
- arch rolling: fribidi 1.0.18-1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms