# lv_bidi_private.h (/api/misc/lv_bidi_private_h)



<RelatedHeaders name="lv_bidi.h" isPrivate="true" />

<ApiSummary functions="5" />

Functions [#functions]

<ApiTabs items="[&#x22;Getters (2)&#x22;,&#x22;Other (3)&#x22;]">
  <ApiTab value="Getters (2)">
    <ApiMember kind="function" name="lv_bidi_get_logical_pos" file="misc/lv_bidi_private.h" line="60" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/lv_bidi_private.h#L60">
      lv_bidi_get_logical_pos [#lv_bidi_get_logical_pos]

      Get the logical position of a character in a line

      ```c title=" " lineNumbers=1
      uint16_t lv_bidi_get_logical_pos(const char *str_in, char **bidi_txt, uint32_t len, lv_base_dir_t base_dir, uint32_t visual_pos, bool *is_rtl)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name         | Type                                     | Description                                                                                                                                                                          |
      | ------------ | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
      | `str_in`     | `const char *`                           | the input string. Can be only one line.                                                                                                                                              |
      | `bidi_txt`   | `char **`                                | internally the text is bidi processed which buffer can be get here. If not required anymore has to freed with <ApiLink name="lv_free" display="lv_free()" /> Can be `NULL` is unused |
      | `len`        | <ApiLink name="uint32_t" />              | length of the line in character count                                                                                                                                                |
      | `base_dir`   | <ApiLink name="lv_base_dir_t" />         | base direction of the text: `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL`                                                                                                                   |
      | `visual_pos` | <ApiLink name="uint32_t" />              | the visual character position which logical position should be get                                                                                                                   |
      | `is_rtl`     | <ApiLink name="bool" display="bool *" /> | tell the char at `visual_pos` is RTL or LTR context                                                                                                                                  |

      **Returns:** <ApiLink name="uint16_t" /> — the logical character position
    </ApiMember>

    <ApiMember kind="function" name="lv_bidi_get_visual_pos" file="misc/lv_bidi_private.h" line="75" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/lv_bidi_private.h#L75">
      lv_bidi_get_visual_pos [#lv_bidi_get_visual_pos]

      Get the visual position of a character in a line

      ```c title=" " lineNumbers=1
      uint16_t lv_bidi_get_visual_pos(const char *str_in, char **bidi_txt, uint16_t len, lv_base_dir_t base_dir, uint32_t logical_pos, bool *is_rtl)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name          | Type                                     | Description                                                                                                                                                                          |
      | ------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
      | `str_in`      | `const char *`                           | the input string. Can be only one line.                                                                                                                                              |
      | `bidi_txt`    | `char **`                                | internally the text is bidi processed which buffer can be get here. If not required anymore has to freed with <ApiLink name="lv_free" display="lv_free()" /> Can be `NULL` is unused |
      | `len`         | <ApiLink name="uint16_t" />              | length of the line in character count                                                                                                                                                |
      | `base_dir`    | <ApiLink name="lv_base_dir_t" />         | base direction of the text: `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL`                                                                                                                   |
      | `logical_pos` | <ApiLink name="uint32_t" />              | the logical character position which visual position should be get                                                                                                                   |
      | `is_rtl`      | <ApiLink name="bool" display="bool *" /> | tell the char at `logical_pos` is RTL or LTR context                                                                                                                                 |

      **Returns:** <ApiLink name="uint16_t" /> — the visual character position
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (3)">
    <ApiMember kind="function" name="lv_bidi_process" file="misc/lv_bidi_private.h" line="39" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/lv_bidi_private.h#L39">
      lv_bidi_process [#lv_bidi_process]

      Convert a text to get the characters in the correct visual order according to Unicode Bidirectional Algorithm

      ```c title=" " lineNumbers=1
      void lv_bidi_process(const char *str_in, char *str_out, lv_base_dir_t base_dir)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name       | Type                             | Description                                               |
      | ---------- | -------------------------------- | --------------------------------------------------------- |
      | `str_in`   | `const char *`                   | the text to process                                       |
      | `str_out`  | `char *`                         | store the result here. Has the be `strlen(str_in)` length |
      | `base_dir` | <ApiLink name="lv_base_dir_t" /> | `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL`                    |
    </ApiMember>

    <ApiMember kind="function" name="lv_bidi_detect_base_dir" file="misc/lv_bidi_private.h" line="46" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/lv_bidi_private.h#L46">
      lv_bidi_detect_base_dir [#lv_bidi_detect_base_dir]

      Auto-detect the direction of a text based on the first strong character

      ```c title=" " lineNumbers=1
      lv_base_dir_t lv_bidi_detect_base_dir(const char *txt)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type           | Description         |
      | ----- | -------------- | ------------------- |
      | `txt` | `const char *` | the text to process |

      **Returns:** <ApiLink name="lv_base_dir_t" /> — `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL`
    </ApiMember>

    <ApiMember kind="function" name="lv_bidi_process_paragraph" file="misc/lv_bidi_private.h" line="88" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/lv_bidi_private.h#L88">
      lv_bidi_process_paragraph [#lv_bidi_process_paragraph]

      Bidi process a paragraph of text

      ```c title=" " lineNumbers=1
      void lv_bidi_process_paragraph(const char *str_in, char *str_out, uint32_t len, lv_base_dir_t base_dir, uint16_t *pos_conv_out, uint16_t pos_conv_len)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name           | Type                                             | Description                                                                                         |
      | -------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------- |
      | `str_in`       | `const char *`                                   | the string to process                                                                               |
      | `str_out`      | `char *`                                         | store the result here                                                                               |
      | `len`          | <ApiLink name="uint32_t" />                      | length of the text                                                                                  |
      | `base_dir`     | <ApiLink name="lv_base_dir_t" />                 | base dir of the text                                                                                |
      | `pos_conv_out` | <ApiLink name="uint16_t" display="uint16_t *" /> | an `uint16_t` array to store the related logical position of the character. Can be `NULL` is unused |
      | `pos_conv_len` | <ApiLink name="uint16_t" />                      | length of `pos_conv_out` in element count                                                           |
    </ApiMember>
  </ApiTab>
</ApiTabs>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_bidi.h&#x22;]" transitiveIncludes="[&#x22;lv_area.h&#x22;, &#x22;lv_assert.h&#x22;, &#x22;lv_color.h&#x22;, &#x22;lv_color_op.h&#x22;, &#x22;lv_conf_internal.h&#x22;, &#x22;lv_conf_kconfig.h&#x22;, &#x22;lv_draw_buf.h&#x22;, &#x22;lv_font.h&#x22;, &#x22;lv_image_dsc.h&#x22;, &#x22;lv_log.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_mem.h&#x22;, &#x22;lv_palette.h&#x22;, &#x22;lv_sprintf.h&#x22;, &#x22;lv_string.h&#x22;, &#x22;lv_symbol_def.h&#x22;, &#x22;lv_text.h&#x22;, &#x22;lv_types.h&#x22;]" />
