# lv_text_ap.h (/api/misc/lv_text_ap_h)



<ApiSummary functions="2" macros="3" />

Functions [#functions]

<ApiMember kind="function" name="lv_text_ap_strlen" file="misc/lv_text_ap.h" line="47" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/lv_text_ap.h#L47">
  lv_text_ap_strlen [#lv_text_ap_strlen]

  Calculate the number of bytes required to store the Arabic/Persian processed version of a UTF-8 string, excluding the null terminator. Analogous to strlen() but accounts for character form substitutions (e.g. initial, medial, final, isolated forms).

  ```c title=" " lineNumbers=1
  size_t lv_text_ap_strlen(const char *txt)
  ```

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

  | Name  | Type           | Description                                           |
  | ----- | -------------- | ----------------------------------------------------- |
  | `txt` | `const char *` | Null-terminated UTF-8 input string. Must not be NULL. |

  **Returns:** <ApiLink name="size_t" /> — Number of bytes in the processed output, excluding '\0'. Allocate (lv\_text\_ap\_strlen(txt) + 1) bytes for the output buffer.
</ApiMember>

<ApiMember kind="function" name="lv_text_ap_proc" file="misc/lv_text_ap.h" line="65" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/lv_text_ap.h#L65">
  lv_text_ap_proc [#lv_text_ap_proc]

  Process a UTF-8 string and replace Arabic/Persian characters with their correct contextual forms (isolated, initial, medial, final) based on their position within each word.

  The output buffer must be pre-allocated with at least (lv\_text\_ap\_strlen(txt) + 1) bytes.

  Returns early if `txt` or `txt_out` are null

  ```c title=" " lineNumbers=1
  void lv_text_ap_proc(const char *txt, char *txt_out)
  ```

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

  | Name      | Type           | Description                                                                          |
  | --------- | -------------- | ------------------------------------------------------------------------------------ |
  | `txt`     | `const char *` | Null-terminated UTF-8 input string.                                                  |
  | `txt_out` | `char *`       | Output buffer to write the processed UTF-8 string into. Must not overlap with `txt`. |

  <Callout type="info">
    Non-Arabic/Persian characters are copied to the output unchanged.
  </Callout>
</ApiMember>

Macros [#macros]

<ApiMember kind="macro" name="LV_UNDEF_ARABIC_PERSIAN_CHARS" file="misc/lv_text_ap.h" line="26" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/lv_text_ap.h#L26">
  LV_UNDEF_ARABIC_PERSIAN_CHARS [#lv_undef_arabic_persian_chars]

  ```c title=" " lineNumbers=1
  #define LV_UNDEF_ARABIC_PERSIAN_CHARS (UINT32_MAX)
  ```
</ApiMember>

<ApiMember kind="macro" name="LV_AP_ALPHABET_BASE_CODE" file="misc/lv_text_ap.h" line="27" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/lv_text_ap.h#L27">
  LV_AP_ALPHABET_BASE_CODE [#lv_ap_alphabet_base_code]

  ```c title=" " lineNumbers=1
  #define LV_AP_ALPHABET_BASE_CODE 0x0622
  ```
</ApiMember>

<ApiMember kind="macro" name="LV_AP_END_CHARS_LIST" file="misc/lv_text_ap.h" line="28" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/lv_text_ap.h#L28">
  LV_AP_END_CHARS_LIST [#lv_ap_end_chars_list]

  ```c title=" " lineNumbers=1
  #define LV_AP_END_CHARS_LIST {0,0,0,0,0,{0,0}}
  ```
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_text.h&#x22;, &#x22;lv_types.h&#x22;, &#x22;lv_draw.h&#x22;]" transitiveIncludes="[&#x22;lv_anim.h&#x22;, &#x22;lv_area.h&#x22;, &#x22;lv_array.h&#x22;, &#x22;lv_assert.h&#x22;, &#x22;lv_bidi.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_event.h&#x22;, &#x22;lv_ext_data.h&#x22;, &#x22;lv_flex.h&#x22;, &#x22;lv_font.h&#x22;, &#x22;lv_fs.h&#x22;, &#x22;lv_grad.h&#x22;, &#x22;lv_grid.h&#x22;, &#x22;lv_image_decoder.h&#x22;, &#x22;lv_image_dsc.h&#x22;, &#x22;lv_layout.h&#x22;, &#x22;lv_ll.h&#x22;, &#x22;lv_log.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_matrix.h&#x22;, &#x22;lv_mem.h&#x22;, &#x22;lv_palette.h&#x22;, &#x22;lv_profiler.h&#x22;, &#x22;lv_profiler_builtin.h&#x22;, &#x22;lv_sprintf.h&#x22;, &#x22;lv_string.h&#x22;, &#x22;lv_style.h&#x22;, &#x22;lv_style_gen.h&#x22;, &#x22;lv_symbol_def.h&#x22;, &#x22;lv_tick.h&#x22;, &#x22;lv_timer.h&#x22;]" />
