https://docs.lvgl.io/8.2/libs/freetype.html
FreeType support
Interface to FreeType to generate font bitmaps run time.
Install FreeType
英文
|
自動翻訳
|
- Download Freetype from here
make
sudo make install
|
- ここからFreetypeをダウンロードします
make
sudo make install
|
Add FreeType to your project
英文
|
自動翻訳
|
- Add include path:
/usr/include/freetype2 (for GCC: -I/usr/include/freetype2 -L/usr/local/lib )
- Add library:
freetype (for GCC: -L/usr/local/lib -lfreetype )
|
- インクルードパスを追加:
/usr/include/freetype2 (GCCの場合-I/usr/include/freetype2 -L/usr/local/lib :)
- ライブラリを追加:
freetype (GCCの場合-L/usr/local/lib -lfreetype :)
|
Usage
英文
|
自動翻訳
|
Enable LV_USE_FREETYPE in lv_conf.h .
To cache the glyphs from the opened fonts, set LV_FREETYPE_CACHE_SIZE >= 0 and then use the following macros for detailed configuration:
LV_FREETYPE_CACHE_SIZE :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.
LV_FREETYPE_CACHE_FT_FACES :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.
LV_FREETYPE_CACHE_FT_SIZES :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 LV_FREETYPE_SBIT_CACHE , which is much more memory efficient for small bitmaps.
You can use lv_ft_font_init() to create FreeType fonts. It returns true to indicate success, at the same time, the font member of lv_ft_info_t 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:
FT_FONT_STYLE_NORMAL :default style.
FT_FONT_STYLE_ITALIC :Italic style
FT_FONT_STYLE_BOLD :bold style
They can be combined.eg:FT_FONT_STYLE_BOLD | FT_FONT_STYLE_ITALIC .
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.
|
で有効LV_USE_FREETYPE にしlv_conf.h ます。
開いたフォントからグリフをキャッシュするにLV_FREETYPE_CACHE_SIZE >= 0 は、次のマクロを設定して使用し、詳細な構成を行います。
LV_FREETYPE_CACHE_SIZE :フォントビットマップ、アウトライン、文字コード表などをキャッシュするために使用される最大メモリ(バイト)。0はシステムのデフォルト値を使用することを意味し、0未満はキャッシュを無効にすることを意味します。注:この値は、管理対象のFT_FaceおよびFT_Sizeオブジェクトを考慮していないことに注意してください。
LV_FREETYPE_CACHE_FT_FACES :このキャッシュインスタンスによって管理される開かれたFT_Faceオブジェクトの最大数。0は、システムのデフォルト値を使用することを意味します。LV_FREETYPE_CACHE_SIZE>=0の場合にのみ役立ちます。
LV_FREETYPE_CACHE_FT_SIZES :このキャッシュインスタンスによって管理される、開かれたFT_Sizeオブジェクトの最大数。0は、システムのデフォルト値を使用することを意味します。LV_FREETYPE_CACHE_SIZE>=0の場合にのみ役立ちます。
使用するすべてのフォントサイズが256を超えないことが確実な場合は、を有効LV_FREETYPE_SBIT_CACHE にできます。これにより、小さなビットマップのメモリ効率が大幅に向上します。
lv_ft_font_init() FreeTypeフォントの作成に使用できます。成功を示すために戻りますtrue 。同時に、のfont メンバーはlv_ft_info_t LVGLフォントへのポインターで埋められ、他のLVGLフォントと同じように使用できます。
フォントスタイルは太字と斜体をサポートしています。次のマクロを使用して設定できます。
FT_FONT_STYLE_NORMAL :デフォルトのスタイル。
FT_FONT_STYLE_ITALIC :斜体
FT_FONT_STYLE_BOLD :太字スタイル
それらは組み合わせることができます。例:FT_FONT_STYLE_BOLD | FT_FONT_STYLE_ITALIC 。
FreeType拡張機能はLVGLのファイルシステムを使用しないことに注意してください。オペレーティングシステムまたはプラットフォームで通常どおり、フォントへのパスを渡すだけです。
|
Example
英文
|
自動翻訳
|
Open a front with FreeType
|
|
Learn more
英文
|
自動翻訳
|
- FreeType tutorial
- LVGL's font interface
|
- FreeTypeチュートリアル
- LVGLのフォントインターフェース
|
API
英文
|
自動翻訳
|
Enums
- enum LV_FT_FONT_STYLE
- Values:
- enumerator FT_FONT_STYLE_NORMAL
- enumerator FT_FONT_STYLE_ITALIC
- enumerator FT_FONT_STYLE_BOLD
Functions
- bool lv_freetype_init(uint16_t max_faces, uint16_t max_sizes, uint32_t max_bytes)
- init freetype library
- Parameters
-
- 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_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.
- Returns
- true on success, otherwise false.
- void lv_freetype_destroy(void)
- Destroy freetype library
- bool lv_ft_font_init(lv_ft_info_t *info)
- Creates a font with info parameter specified.
- Parameters
- info -- See lv_ft_info_t for details. when success, lv_ft_info_t->font point to the font you created.
- Returns
- true on success, otherwise false.
- void lv_ft_font_destroy(lv_font_t *font)
- Destroy a font that has been created.
- Parameters
- font -- pointer to font.
- struct lv_ft_info_t
- Public Members
- const char *name
- const void *mem
- size_t mem_size
- lv_font_t *font
- uint16_t weight
- uint16_t style
|
列挙型
- 列挙型LV_FT_FONT_STYLE
- 値:
- 列挙子FT_FONT_STYLE_NORMAL
- 列挙子FT_FONT_STYLE_ITALIC
- 列挙子FT_FONT_STYLE_BOLD
機能
- bool lv_freetype_init(uint16_t max_faces、uint16_t max_sizes、uint32_t max_bytes)
- initfreetypeライブラリ
- パラメーター
-
- max_faces-このキャッシュインスタンスによって管理される開かれたFT_Faceオブジェクトの最大数。デフォルトには0を使用します。
- max_sizes-このキャッシュインスタンスによって管理される開かれたFT_Sizeオブジェクトの最大数。デフォルトには0を使用します。
- max_bytes-キャッシュされたデータノードに使用する最大バイト数。デフォルトには0を使用します。この値は、管理対象のFT_FaceオブジェクトとFT_Sizeオブジェクトを考慮していないことに注意してください。
- 戻り値
- 成功した場合はtrue、それ以外の場合はfalse。
- void lv_freetype_destroy(void)
- FreeTypeライブラリを破棄します
- bool lv_ft_font_init(lv_ft_info_t * info)
- infoパラメータを指定してフォントを作成します。
- パラメーター
- info-詳細については、lv_ft_info_tを参照してください。成功すると、lv_ft_info_t->fontは作成したフォントを指します。
- 戻り値
- 成功した場合はtrue、それ以外の場合はfalse。
- void lv_ft_font_destroy(lv_font_t * font)
- 作成されたフォントを破棄します。
- パラメーター
- font-フォントへのポインタ。
- struct lv_ft_info_t
- パブリックメンバー
- const char * name
- const void * mem
- size_t mem_size
- lv_font_t * font
- uint16_tの重み
- uint16_tスタイル
|
- 戻る : Previous