「App:Library:LVGL:docs:3rd party libraries:FreeType support」の版間の差分
1行目: | 1行目: | ||
https://docs.lvgl.io/8.2/libs/freetype.html | https://docs.lvgl.io/8.2/libs/freetype.html | ||
__NOTOC__ | __NOTOC__ | ||
+ | = FreeType support = | ||
+ | Interface to FreeType to generate font bitmaps run time. | ||
+ | |||
+ | == Install FreeType == | ||
{| class="wikitable" | {| class="wikitable" | ||
!英文 | !英文 | ||
6行目: | 10行目: | ||
|- | |- | ||
| | | | ||
+ | * Download Freetype from here | ||
+ | * <code style="color: #bb0000;">make</code> | ||
+ | * <code style="color: #bb0000;">sudo make install</code> | ||
| | | | ||
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Add FreeType to your project == | == Add FreeType to your project == | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
+ | * Add include path: <code style="color: #bb0000;">/usr/include/freetype2</code> (for GCC: <code style="color: #bb0000;">-I/usr/include/freetype2 -L/usr/local/lib</code>) | ||
+ | * Add library: <code style="color: #bb0000;">freetype</code> (for GCC: <code style="color: #bb0000;">-L/usr/local/lib -lfreetype</code>) | ||
+ | | | ||
+ | |} | ||
− | |||
− | |||
== Usage == | == Usage == | ||
− | Enable <code>LV_USE_FREETYPE</code> in <code>lv_conf.h</code>. | + | {| class="wikitable" |
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
+ | Enable <code style="color: #bb0000;">LV_USE_FREETYPE</code> in <code style="color: #bb0000;">lv_conf.h</code>. | ||
− | To cache the glyphs from the opened fonts, set <code>LV_FREETYPE_CACHE_SIZE >= 0</code> and then use the following macros for detailed configuration: | + | To cache the glyphs from the opened fonts, set <code style="color: #bb0000;">LV_FREETYPE_CACHE_SIZE >= 0</code> and then use the following macros for detailed configuration: |
− | # <code>LV_FREETYPE_CACHE_SIZE</code>:maximum memory(bytes) used to cache font bitmap, outline, character maps, etc. 0 means use the system default value, less than 0 means disable cache. Note: that this value does not account for managed FT_Face and FT_Size objects. | + | # <code style="color: #bb0000;">LV_FREETYPE_CACHE_SIZE</code>:maximum memory(bytes) used to cache font bitmap, outline, character maps, etc. 0 means use the system default value, less than 0 means disable cache. Note: that this value does not account for managed FT_Face and FT_Size objects. |
− | # <code>LV_FREETYPE_CACHE_FT_FACES</code>:maximum number of opened FT_Face objects managed by this cache instance.0 means use the system default value. Only useful when LV_FREETYPE_CACHE_SIZE >= 0. | + | # <code style="color: #bb0000;">LV_FREETYPE_CACHE_FT_FACES</code>:maximum number of opened FT_Face objects managed by this cache instance.0 means use the system default value. Only useful when LV_FREETYPE_CACHE_SIZE >= 0. |
− | # <code>LV_FREETYPE_CACHE_FT_SIZES</code>:maximum number of opened FT_Size objects managed by this cache instance. 0 means use the system default value. Only useful when LV_FREETYPE_CACHE_SIZE >= 0. | + | # <code style="color: #bb0000;">LV_FREETYPE_CACHE_FT_SIZES</code>:maximum number of opened FT_Size objects managed by this cache instance. 0 means use the system default value. Only useful when LV_FREETYPE_CACHE_SIZE >= 0. |
− | When you are sure that all the used font sizes will not be greater than 256, you can enable <code>LV_FREETYPE_SBIT_CACHE</code>, which is much more memory efficient for small bitmaps. | + | When you are sure that all the used font sizes will not be greater than 256, you can enable <code style="color: #bb0000;">LV_FREETYPE_SBIT_CACHE</code>, which is much more memory efficient for small bitmaps. |
− | You can use <code>lv_ft_font_init()</code> to create FreeType fonts. It returns <code>true</code> to indicate success, at the same time, the <code>font</code> member of <code>lv_ft_info_t</code> will be filled with a pointer to an LVGL font, and you can use it like any LVGL font. | + | You can use <code style="color: #bb0000;">lv_ft_font_init()</code> to create FreeType fonts. It returns <code style="color: #bb0000;">true</code> to indicate success, at the same time, the <code style="color: #bb0000;">font</code> member of <code style="color: #bb0000;">lv_ft_info_t</code> will be filled with a pointer to an LVGL font, and you can use it like any LVGL font. |
Font style supports bold and italic, you can use the following macros to set: | Font style supports bold and italic, you can use the following macros to set: | ||
− | # <code>FT_FONT_STYLE_NORMAL</code>:default style. | + | # <code style="color: #bb0000;">FT_FONT_STYLE_NORMAL</code>:default style. |
− | # <code>FT_FONT_STYLE_ITALIC</code>:Italic style | + | # <code style="color: #bb0000;">FT_FONT_STYLE_ITALIC</code>:Italic style |
− | # <code>FT_FONT_STYLE_BOLD</code>:bold style | + | # <code style="color: #bb0000;">FT_FONT_STYLE_BOLD</code>:bold style |
− | They can be combined.eg:<code>FT_FONT_STYLE_BOLD | FT_FONT_STYLE_ITALIC</code>. | + | They can be combined.eg:<code style="color: #bb0000;">FT_FONT_STYLE_BOLD | FT_FONT_STYLE_ITALIC</code>. |
Note that, the FreeType extension doesn't use LVGL's file system. You can simply pass the path to the font as usual on your operating system or platform. | Note that, the FreeType extension doesn't use LVGL's file system. You can simply pass the path to the font as usual on your operating system or platform. | ||
+ | | | ||
+ | |} | ||
+ | |||
== Example == | == Example == | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
=== Open a front with FreeType === | === Open a front with FreeType === | ||
[[file:LVGL docs 3rdPartyLibs FreeType 01.png|link=https://docs.lvgl.io/8.2/libs/freetype.html#open-a-front-with-freetype]] | [[file:LVGL docs 3rdPartyLibs FreeType 01.png|link=https://docs.lvgl.io/8.2/libs/freetype.html#open-a-front-with-freetype]] | ||
+ | | | ||
+ | |} | ||
− | |||
== Learn more == | == Learn more == | ||
− | + | {| class="wikitable" | |
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
* FreeType tutorial | * FreeType tutorial | ||
* LVGL's font interface | * LVGL's font interface | ||
+ | | | ||
+ | |} | ||
+ | |||
== API == | == API == | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
Enums | Enums | ||
− | ; | + | ; enum LV_FT_FONT_STYLE |
: ''Values:'' | : ''Values:'' | ||
− | :; | + | :; enumerator FT_FONT_STYLE_NORMAL |
:: | :: | ||
− | :; | + | :; enumerator FT_FONT_STYLE_ITALIC |
:: | :: | ||
− | :; | + | :; enumerator FT_FONT_STYLE_BOLD |
:: | :: | ||
Functions | Functions | ||
− | ; | + | ; bool lv_freetype_init(uint16_t max_faces, uint16_t max_sizes, uint32_t max_bytes) |
: init freetype library | : init freetype library | ||
:; Parameters | :; Parameters | ||
− | ::* max_faces -- Maximum number of | + | ::* max_faces -- Maximum number of opened FT_Face objects managed by this cache instance. Use 0 for defaults. |
::* max_sizes -- Maximum number of opened FT_Size objects managed by this cache instance. Use 0 for defaults. | ::* max_sizes -- Maximum number of opened FT_Size objects managed by this cache instance. Use 0 for defaults. | ||
::* max_bytes -- Maximum number of bytes to use for cached data nodes. Use 0 for defaults. Note that this value does not account for managed FT_Face and FT_Size objects. | ::* max_bytes -- Maximum number of bytes to use for cached data nodes. Use 0 for defaults. Note that this value does not account for managed FT_Face and FT_Size objects. | ||
82行目: | 112行目: | ||
:: true on success, otherwise false. | :: true on success, otherwise false. | ||
− | ; | + | ; void lv_freetype_destroy(void) |
: Destroy freetype library | : Destroy freetype library | ||
− | |||
− | ; | + | |
− | : Creates a font with info parameter | + | ; bool lv_ft_font_init(lv_ft_info_t *info) |
+ | : Creates a font with info parameter specified. | ||
:; Parameters | :; Parameters | ||
:: info -- See lv_ft_info_t for details. when success, lv_ft_info_t->font point to the font you created. | :: info -- See lv_ft_info_t for details. when success, lv_ft_info_t->font point to the font you created. | ||
93行目: | 123行目: | ||
:: true on success, otherwise false. | :: true on success, otherwise false. | ||
− | ; | + | ; void lv_ft_font_destroy(lv_font_t *font) |
− | : Destroy a font that has been created | + | : Destroy a font that has been created. |
:; Parameters | :; Parameters | ||
:: font -- pointer to font. | :: font -- pointer to font. | ||
− | ; | + | ; struct lv_ft_info_t |
− | : Public Members | + | : Public Members |
− | :; | + | :; const char *name |
:: | :: | ||
− | :; | + | :; const void *mem |
:: | :: | ||
− | :; | + | :; size_t mem_size |
:: | :: | ||
− | :; | + | :; lv_font_t *font |
:: | :: | ||
− | :; | + | :; uint16_t weight |
:: | :: | ||
− | :; | + | :; uint16_t style |
− | + | | | |
− | + | |} | |
− | |||
− | |||
− | |||
:[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]] | :[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]] |
2022年6月29日 (水) 16:51時点における版
https://docs.lvgl.io/8.2/libs/freetype.html
FreeType support
Interface to FreeType to generate font bitmaps run time.
Install FreeType
英文 | 自動翻訳 |
---|---|
|
Add FreeType to your project
英文 | 自動翻訳 |
---|---|
|
Usage
英文 | 自動翻訳 |
---|---|
Enable To cache the glyphs from the opened fonts, set
When you are sure that all the used font sizes will not be greater than 256, you can enable You can use Font style supports bold and italic, you can use the following macros to set:
They can be combined.eg: Note that, the FreeType extension doesn't use LVGL's file system. You can simply pass the path to the font as usual on your operating system or platform. |
Example
英文 | 自動翻訳 |
---|---|
Open a front with FreeType |
Learn more
英文 | 自動翻訳 |
---|---|
|
API
英文 | 自動翻訳 |
---|---|
Enums
Functions
|