# BinFont Loader (/main-modules/fonts/binfont_loader)



Overview [#overview]

<ApiLink name="lv_binfont_create" /> can be used to load a font from a file. The font needs
to have a special binary format. (Not TTF or WOFF). Use
[lv\_font\_conv](https://github.com/lvgl/lv_font_conv/) with the
`--format bin` option to generate an LVGL compatible font file.

Loading from File [#loading-from-file]

| Field  | Description                                                                                          |
| ------ | ---------------------------------------------------------------------------------------------------- |
| `note` | To load a font [LVGL's filesystem](/main-modules/fs) needs to be enabled and a driver must be added. |

Example

```c title=" " lineNumbers=1
lv_font_t *my_font = lv_binfont_create("X:/path/to/my_font.bin");
if(my_font == NULL) return;

/* Use the font */

/* Free the font if not required anymore */
lv_binfont_destroy(my_font);
```

Loading from Memory [#loading-from-memory]

<ApiLink name="lv_binfont_create_from_buffer" /> can be used to load a font from a memory buffer.
This function may be useful to load a font from an external file system, which is not
supported by LVGL. The font needs to be in the same format as if it were loaded from a file.

| Field  | Description                                                                                                                |
| ------ | -------------------------------------------------------------------------------------------------------------------------- |
| `note` | To load a font from a buffer [LVGL's filesystem](/main-modules/fs) needs to be enabled and the MEMFS driver must be added. |

Example

```c title=" " lineNumbers=1
lv_font_t *my_font;
uint8_t *buf;
uint32_t bufsize;

/* Read font file into the buffer from the external file system */
...

/* Load font from the buffer */
my_font = lv_binfont_create_from_buffer((void *)buf, buf));
if(my_font == NULL) return;
/* Use the font */

/* Free the font if not required anymore */
lv_binfont_destroy(my_font);
```
