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:
fribidi_shape_arabic(3)fribidi_get_par_direction(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)
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
- 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