Re: multiple line
Shachar Shemesh <[email protected]> Mon, 18 Sep 2017 23:38:40 +0300
| Newsgroups | gmane.comp.internationalization.fribidi |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --===============0748301861== Content-Type: multipart/alternative; boundary="------------CA6C9DAE48D08260CE57F698" Content-Language: he This is a multi-part message in MIME format. --------------CA6C9DAE48D08260CE57F698 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Please see if https://www.lingnu.com/programming/57-bidi-aware-programming-introduction.html 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. Shachar On 18/09/17 14:24, Yuri D. wrote: > Hi, > > I wonder what is the correct input to the FRIBIDI library while > parsing the levels for multiple lines? > Should I send each line separately or I can send all the lines in the > same string? > > I'm running the code below: > > FriBidiChar* unicodeString = new FriBidiChar[textLength]; > FriBidiCharType* bidiTypes = new FriBidiCharType[textLength]; > FriBidiLevel* bidiLevels = new FriBidiLevel[textLength]; > > std::string text = "some.\ncar.\nhere."; > > // Convert string to unicode > FriBidiStrIndex len = > fribidi_charset_to_unicode(FRIBIDI_CHAR_SET_UTF8, text.c_str(), > (FriBidiStrIndex)text.length(), unicodeString); > > // Get BIDI types > fribidi_get_bidi_types(unicodeString, (uint32_t)text.size(), bidiTypes); > > // Get BIDI levels > FriBidiLevel resolveParDir = > fribidi_get_par_embedding_levels(bidiTypes, (uint32_t)text.size(), > *FRIBIDI_PAR_RTL*, bidiLevels); > > And in the result, I get the BIDI levels below: > 2 2 2 2 1 1 0 0 0 0 1 0 0 0 0 0 > > The question is: why I have a level change for the first '.' but not > for the following '.'? > > > > _______________________________________________ > fribidi mailing list > [email protected] > https://lists.freedesktop.org/mailman/listinfo/fribidi --------------CA6C9DAE48D08260CE57F698 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit <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:[email protected]">[email protected]</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> --------------CA6C9DAE48D08260CE57F698-- --===============0748301861== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZnJpYmlkaSBt YWlsaW5nIGxpc3QKZnJpYmlkaUBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0cy5m cmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9mcmliaWRpCg== --===============0748301861==--