# lv_binfont_loader.h (/api/public/font/lv_binfont_loader_h)



<ApiSummary functions="4" structs="2" variables="1" />

Functions [#functions]

<ApiMember kind="function" name="lv_binfont_create" file="public/font/lv_binfont_loader.h" line="65" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/font/lv_binfont_loader.h#L65">
  lv_binfont_create [#lv_binfont_create]

  Loads a `lv_font_t` object from a binary font file

  ```c title=" " lineNumbers=1
  lv_font_t * lv_binfont_create(const char *path)
  ```

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

  | Name   | Type           | Description       |
  | ------ | -------------- | ----------------- |
  | `path` | `const char *` | path to font file |

  **Returns:** <ApiLink name="lv_font_t" display="lv_font_t *" /> — pointer to font where to load
</ApiMember>

<ApiMember kind="function" name="lv_binfont_create_ex" file="public/font/lv_binfont_loader.h" line="72" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/font/lv_binfont_loader.h#L72">
  lv_binfont_create_ex [#lv_binfont_create_ex]

  Loads a `lv_font_t` object from a binary font file with additional options.

  ```c title=" " lineNumbers=1
  lv_font_t * lv_binfont_create_ex(const lv_binfont_dsc_t *dsc)
  ```

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

  | Name  | Type                                                                   | Description                                  |
  | ----- | ---------------------------------------------------------------------- | -------------------------------------------- |
  | `dsc` | <ApiLink name="lv_binfont_dsc_t" display="const lv_binfont_dsc_t *" /> | describes the font source and how to load it |

  **Returns:** <ApiLink name="lv_font_t" display="lv_font_t *" /> — pointer to the loaded font or `NULL` on error
</ApiMember>

<ApiMember kind="function" name="lv_binfont_create_from_buffer" file="public/font/lv_binfont_loader.h" line="82" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/font/lv_binfont_loader.h#L82">
  lv_binfont_create_from_buffer [#lv_binfont_create_from_buffer]

  Loads a `lv_font_t` object from a memory buffer containing the binary font file. Requires LV\_USE\_FS\_MEMFS

  ```c title=" " lineNumbers=1
  lv_font_t * lv_binfont_create_from_buffer(void *buffer, uint32_t size)
  ```

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

  | Name     | Type       | Description                            |
  | -------- | ---------- | -------------------------------------- |
  | `buffer` | `void *`   | address of the font file in the memory |
  | `size`   | `uint32_t` | size of the font file buffer           |

  **Returns:** <ApiLink name="lv_font_t" display="lv_font_t *" /> — pointer to font where to load
</ApiMember>

<ApiMember kind="function" name="lv_binfont_destroy" file="public/font/lv_binfont_loader.h" line="89" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/font/lv_binfont_loader.h#L89">
  lv_binfont_destroy [#lv_binfont_destroy]

  Frees the memory allocated by the <ApiLink name="lv_binfont_create" display="lv_binfont_create()" /> function

  ```c title=" " lineNumbers=1
  void lv_binfont_destroy(lv_font_t *font)
  ```

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

  | Name   | Type                                               | Description                                                                       |
  | ------ | -------------------------------------------------- | --------------------------------------------------------------------------------- |
  | `font` | <ApiLink name="lv_font_t" display="lv_font_t *" /> | lv\_font\_t object created by the lv\_binfont\_create function **May** be `NULL`. |
</ApiMember>

Structs [#structs]

<ApiMember kind="struct" name="lv_binfont_font_src_t">
  lv_binfont_font_src_t [#lv_binfont_font_src_t]

  | Member               | Type           | Description                                                               |
  | -------------------- | -------------- | ------------------------------------------------------------------------- |
  | `font_size`          | `uint32_t`     | Size of the font in pixels                                                |
  | `path`               | `const char *` | Path to font file                                                         |
  | `buffer`             | `const void *` | Address of the font file in the memory                                    |
  | `buffer_size`        | `uint32_t`     | Size of the font file buffer                                              |
  | `dynamic_glyph_load` | `bool`         | Load the glyph bitmaps on demand. See <ApiLink name="lv_binfont_dsc_t" /> |
</ApiMember>

<ApiMember kind="struct" name="lv_binfont_dsc_t">
  lv_binfont_dsc_t [#lv_binfont_dsc_t]

  Describes how a binary font should be loaded

  | Member               | Type           | Description                                                                                                                                                    |
  | -------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `path`               | `const char *` | Path to the font file. If `NULL` the font is loaded from `buffer`.                                                                                             |
  | `buffer`             | `const void *` | Address of the font file in the memory. Used only if `path` is `NULL`. Requires LV\_USE\_FS\_MEMFS.                                                            |
  | `buffer_size`        | `uint32_t`     | Size of the font file buffer                                                                                                                                   |
  | `dynamic_glyph_load` | `bool`         | if true the glyph bitmaps are not loaded into RAM when the font is created, instead the glyph is loaded from the file during rendering when the glyph is drawn |
</ApiMember>

<TypeUsedBy name="lv_binfont_dsc_t" count="1">
  * `lv_binfont_create_ex` — param `dsc`
</TypeUsedBy>

Variables [#variables]

<ApiMember kind="variable" name="lv_binfont_font_class" file="public/font/lv_binfont_loader.h" line="54" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/font/lv_binfont_loader.h#L54">
  lv_binfont_font_class [#lv_binfont_font_class]

  ```c title=" " lineNumbers=1
  const lv_font_class_t lv_binfont_font_class
  ```
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_types.h&#x22;]" includedBy="[&#x22;lvgl.h&#x22;]" transitiveIncludes="[&#x22;lv_conf_internal.h&#x22;]" />
