<html style="direction: ltr;">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">body p { margin-bottom: 0.2cm; margin-top: 0pt; } </style>
  </head>
  <body bidimailui-charset-is-forced="true" style="direction: ltr;"
    text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Please see if
<a class="moz-txt-link-freetext" href="https://www.lingnu.com/programming/57-bidi-aware-programming-introduction.html">https://www.lingnu.com/programming/57-bidi-aware-programming-introduction.html</a>
      is of any help in understanding how to apply the bidi algorithm
      over multiple lines. It is not FreeBidi specific, but was meant to
      help in understanding of the concepts.<br>
      <br>
      Shachar<br>
      <br>
      On 18/09/17 14:24, Yuri D. wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOGDOUte-BpNTo2K_UpUoDR1CapPfBtAyTksLvpyMyVgbPAUGg@mail.gmail.com">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>I wonder what is the correct input to the FRIBIDI library
          while parsing the levels for multiple lines? </div>
        <div>Should I send each line separately or I can send all the
          lines in the same string? </div>
        <div><br>
        </div>
        <div>
          <p
style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe
            UI",Helvetica,Arial,sans-serif,"Apple Color
            Emoji","Segoe UI Emoji","Segoe UI
            Symbol";font-size:14px;margin-top:0px">I'm running the
            code below:</p>
          <p
style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe
            UI",Helvetica,Arial,sans-serif,"Apple Color
            Emoji","Segoe UI Emoji","Segoe UI
            Symbol";font-size:14px">FriBidiChar* unicodeString =
            new FriBidiChar[textLength];<br
              style="box-sizing:border-box">
            FriBidiCharType* bidiTypes = new
            FriBidiCharType[textLength];<br
              style="box-sizing:border-box">
            FriBidiLevel* bidiLevels = new FriBidiLevel[textLength];</p>
          <p
style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe
            UI",Helvetica,Arial,sans-serif,"Apple Color
            Emoji","Segoe UI Emoji","Segoe UI
            Symbol";font-size:14px">std::string text =
            "some.\ncar.\nhere.";</p>
          <p
style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe
            UI",Helvetica,Arial,sans-serif,"Apple Color
            Emoji","Segoe UI Emoji","Segoe UI
            Symbol";font-size:14px">// Convert string to unicode<br
              style="box-sizing:border-box">
            FriBidiStrIndex len =
            fribidi_charset_to_unicode(FRIBIDI_CHAR_SET_UTF8,
            text.c_str(), (FriBidiStrIndex)text.length(),
            unicodeString);</p>
          <p
style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe
            UI",Helvetica,Arial,sans-serif,"Apple Color
            Emoji","Segoe UI Emoji","Segoe UI
            Symbol";font-size:14px">// Get BIDI types<br
              style="box-sizing:border-box">
            fribidi_get_bidi_types(unicodeString, (uint32_t)text.size(),
            bidiTypes);</p>
          <p
style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe
            UI",Helvetica,Arial,sans-serif,"Apple Color
            Emoji","Segoe UI Emoji","Segoe UI
            Symbol";font-size:14px">// Get BIDI levels<br
              style="box-sizing:border-box">
            FriBidiLevel resolveParDir =
            fribidi_get_par_embedding_levels(bidiTypes,
            (uint32_t)text.size(), <b>FRIBIDI_PAR_RTL</b>, bidiLevels);</p>
          <p
style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe
            UI",Helvetica,Arial,sans-serif,"Apple Color
            Emoji","Segoe UI Emoji","Segoe UI
            Symbol";font-size:14px">And in the result, I get the
            BIDI levels below:<br style="box-sizing:border-box">
            2 2 2 2 1 1 0 0 0 0 1 0 0 0 0 0</p>
          <p
style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe
            UI",Helvetica,Arial,sans-serif,"Apple Color
            Emoji","Segoe UI Emoji","Segoe UI
            Symbol";font-size:14px">The question is: why I have a
            level change for the first '.' but not for the following
            '.'?</p>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
fribidi mailing list
<a class="moz-txt-link-abbreviated" href="mailto:fribidi@lists.freedesktop.org">fribidi@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/fribidi">https://lists.freedesktop.org/mailman/listinfo/fribidi</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>