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



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

Functions [#functions]

<ApiMember kind="function" name="lv_text_ap_strlen" file="private/misc/lv_text_ap.h" line="46" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/misc/lv_text_ap.h#L46">
  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:** `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="private/misc/lv_text_ap.h" line="64" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/misc/lv_text_ap.h#L64">
  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="private/misc/lv_text_ap.h" line="25" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/misc/lv_text_ap.h#L25">
  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="private/misc/lv_text_ap.h" line="26" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/misc/lv_text_ap.h#L26">
  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="private/misc/lv_text_ap.h" line="27" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/misc/lv_text_ap.h#L27">
  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;lvgl_public.h&#x22;]" includedBy="[&#x22;lvgl_private.h&#x22;]" />
