fribidi_remove_bidi_marks(3)

πŸ’… fribidi_remove_bidi_marks πŸ’…

okay bestie, so this is a page from the Programmer's Manual for fribidi_remove_bidi_marks(3) β€” yes the whole page is about one function, and honestly? she's a little icon for it. πŸŽ€


✨ NAME ✨

fribidi_remove_bidi_marks β€” remove bidi marks out of a string. that's it, that's the job, and she does it flawlessly. 🫢


🌸 SYNOPSIS 🌸

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

FriBidiStrIndex fribidi_remove_bidi_marks
(
     FriBidiChar *str,
     const FriBidiStrIndex len,
     FriBidiStrIndex *positions_to_this,
     FriBidiStrIndex *position_from_this_list,
     FriBidiLevel *embedding_levels
);

like, look at her. five parameters. all of them matter. no notes. πŸ’…


πŸ¦‹ PARAMETERS πŸ¦‹

  • FriBidiChar *str β€” the input string you wanna clean up. give her the messy one, she'll handle it.
  • const FriBidiStrIndex len β€” the input string length. she needs to know how much she's working with, obviously.
  • FriBidiStrIndex *positions_to_this β€” a list mapping positions to the order used in str.
  • FriBidiStrIndex *position_from_this_list β€” a list mapping positions from the order used in str.
  • FriBidiLevel *embedding_levels β€” the list of embedding levels. (⚠️ read the description before you go handing her this one, ok?)

πŸ’– DESCRIPTION πŸ’–

so what does she actually do? she removes the bidi and boundary-neutral marks out of a string and the accompanying lists. both. together. that's the whole vibe. ✨

she implements rule X9 of the Unicode Bidirectional Algorithm, which lives right here: http://www.unicode.org/reports/tr9/#X9 β€” with one exception: she also removes U+200E LEFT-TO-RIGHT MARK and U+200F RIGHT-TO-LEFT MARK. yeah. those too. not me being extra, that's just the spec. 😌

here's the rundown on the lists:

  • if any of the input lists are NULL, that list is skipped. no drama, she just moves on.
  • if str is the visual string, then positions_to_this is positions_L_to_V and position_from_this_list is positions_V_to_L.
  • if str is the logical string, it's the other way around.
  • also, the position maps should be filled with valid entries. like, please. valid ones. πŸ™

a position map pointing to a removed character gets filled with βˆ’1. and btw β€” you should not use embedding_levels if str is a visual string. nope. don't. πŸ’€

for best results, run this on a whole paragraph, not on lines. but if you know what you're doing, feel free to do otherwise, bestie β€” she's not gonna stop you. 🧚


πŸ“ RETURNS πŸ“

the new length of the string πŸ’– β€” or βˆ’1 if an error occurred (memory allocation failure, most probably 😭).


🌈 SEE ALSO 🌈

the whole friend group, fr fr β€” go say hi:


okay that's the whole page bestie, you're officially educated πŸ’œ this masterpiece was generated by c2man from fribidi.h, dated 29 October 2026, and it's still filed under fribidi_remove_bidi_marks(3) β€” go forth and remove those marks, queen πŸ‘‘βœ¨

πŸ“¦ where this page comes from