「App:Library:LVGL:docs:3rd party libraries:FreeType support」の版間の差分

提供: robot-jp wiki
ナビゲーションに移動検索に移動
 
(同じ利用者による、間の3版が非表示)
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"
 +
!英文
 +
!自動翻訳
 +
|-
 +
|
 +
* Download Freetype from here
 +
* <code style="color: #bb0000;">make</code>
 +
* <code style="color: #bb0000;">sudo make install</code>
 +
|
 +
* ここからFreetypeをダウンロードします
 +
* <code style="color: #bb0000;">make</code>
 +
* <code style="color: #bb0000;">sudo make install</code>
 +
|}
 +
 +
 +
== Add FreeType to your project ==
 
{| class="wikitable"
 
{| class="wikitable"
 
!英文
 
!英文
6行目: 26行目:
 
|-
 
|-
 
|
 
|
 +
* 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>)
 
|
 
|
 +
* インクルードパスを追加: <code style="color: #bb0000;">/usr/include/freetype2</code>(GCCの場合<code style="color: #bb0000;">-I/usr/include/freetype2 -L/usr/local/lib</code>:)
 +
* ライブラリを追加: <code style="color: #bb0000;">freetype</code>(GCCの場合<code style="color: #bb0000;">-L/usr/local/lib -lfreetype</code>:)
 
|}
 
|}
  
  
 +
== Usage ==
 +
{| 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 style="color: #bb0000;">LV_FREETYPE_CACHE_SIZE >= 0</code> and then use the following macros for detailed configuration:
 +
 +
# <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 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 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 style="color: #bb0000;">LV_FREETYPE_SBIT_CACHE</code>, which is much more memory efficient for small bitmaps.
 +
 +
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:
 +
 +
# <code style="color: #bb0000;">FT_FONT_STYLE_NORMAL</code>:default style.
 +
# <code style="color: #bb0000;">FT_FONT_STYLE_ITALIC</code>:Italic style
 +
# <code style="color: #bb0000;">FT_FONT_STYLE_BOLD</code>:bold style
 +
 +
 +
They can be combined.eg:<code style="color: #bb0000;">FT_FONT_STYLE_BOLD | FT_FONT_STYLE_ITALIC</code>.
  
= FreeType support =
+
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.
Interface to FreeType to generate font bitmaps run time.
+
|<code style="color: #bb0000;">lv_conf.h</code> で <code style="color: #bb0000;">LV_USE_FREETYPE</code> を有効化します。
  
== Install FreeType ==
 
  
* Download Freetype from here
+
開いているフォントのグリフをキャッシュするには、<code style="color: #bb0000;">LV_FREETYPE_CACHE_SIZE >= 0</code> に設定した後、以下のマクロで詳細な設定を行います。
* <code>make</code>
 
* <code>sudo make install</code>
 
  
== Add FreeType to your project ==
+
# <code style="color: #bb0000;">LV_FREETYPE_CACHE_SIZE</code>:フォントビットマップ、アウトライン、文字コード表などをキャッシュするために使用される最大メモリ(バイト)。0はシステムのデフォルト値を使用することを意味し、0未満はキャッシュを無効にすることを意味します。注:この値は、管理対象のFT_FaceおよびFT_Sizeオブジェクトを考慮していないことに注意してください。
 +
# <code style="color: #bb0000;">LV_FREETYPE_CACHE_FT_FACES</code>:このキャッシュインスタンスによって管理される開かれたFT_Faceオブジェクトの最大数。0は、システムのデフォルト値を使用することを意味します。LV_FREETYPE_CACHE_SIZE>=0の場合にのみ役立ちます。
 +
# <code style="color: #bb0000;">LV_FREETYPE_CACHE_FT_SIZES</code>:このキャッシュインスタンスによって管理される、開かれたFT_Sizeオブジェクトの最大数。0は、システムのデフォルト値を使用することを意味します。LV_FREETYPE_CACHE_SIZE>=0の場合にのみ役立ちます。
  
* Add include path: <code>/usr/include/freetype2</code> (for GCC: <code>-I/usr/include/freetype2 -L/usr/local/lib</code>)
 
* Add library: <code>freetype</code> (for GCC: <code>-L/usr/local/lib -lfreetype</code>)
 
  
== Usage ==
+
使用するフォントサイズがすべて256を超えないことが確実な場合は、<code style="color: #bb0000;">LV_FREETYPE_SBIT_CACHE</code>を有効にすると、小さなビットマップに対してより高いメモリ効率を実現することができます。
Enable <code>LV_USE_FREETYPE</code> in <code>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:
 
  
# <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_ft_font_init()</code> を使用すると、FreeType フォントを作成することができます。これは成功を示す<code style="color: #bb0000;">true</code>を返し、同時に<code style="color: #bb0000;">lv_ft_info_t</code> の <code style="color: #bb0000;">font</code>メンバに LVGL フォントへのポインタが格納され、他の LVGL フォントと同様に使用できるようになります。
# <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>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.
+
フォントスタイルは太字と斜体をサポートしています。次のマクロを使用して設定できます。
  
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.
+
# <code style="color: #bb0000;">FT_FONT_STYLE_NORMAL</code>:デフォルトのスタイル。
 +
# <code style="color: #bb0000;">FT_FONT_STYLE_ITALIC</code>:斜体
 +
# <code style="color: #bb0000;">FT_FONT_STYLE_BOLD</code>:太字スタイル
  
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_BOLD | FT_FONT_STYLE_ITALIC</code>
# <code>FT_FONT_STYLE_ITALIC</code>:Italic style
 
# <code>FT_FONT_STYLE_BOLD</code>:bold style
 
  
They can be combined.eg:<code>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.
+
FreeType拡張は、LVGLのファイルシステムを使用しないことに注意してください。あなたのオペレーティングシステムやプラットフォームで通常行われているように、単にフォントのパスを渡すことができます。
 +
|}
 +
 
  
 
== 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
 +
|
 +
* FreeTypeチュートリアル
 +
* LVGLのフォントインターフェース
 +
|}
 +
  
 
== API ==
 
== API ==
 +
{| class="wikitable"
 +
!英文
 +
!自動翻訳
 +
|-
 +
|
 
Enums
 
Enums
  
; <span id="_CPPv316LV_FT_FONT_STYLE"></span><span id="_CPPv216LV_FT_FONT_STYLE"></span><span id="lv__freetype_8h_1a1ba84fb8ade4d4c103a7f9d3521a02f9" class="target"></span>enum LV_FT_FONT_STYLE[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv416LV_FT_FONT_STYLE] <span id="_CPPv316LV_FT_FONT_STYLE"></span><span id="_CPPv216LV_FT_FONT_STYLE"></span><span id="lv__freetype_8h_1a1ba84fb8ade4d4c103a7f9d3521a02f9" class="target"></span>
+
; enum LV_FT_FONT_STYLE  
 
: ''Values:''
 
: ''Values:''
:; <span id="_CPPv3N16LV_FT_FONT_STYLE20FT_FONT_STYLE_NORMALE"></span><span id="_CPPv2N16LV_FT_FONT_STYLE20FT_FONT_STYLE_NORMALE"></span><span id="lv__freetype_8h_1a1ba84fb8ade4d4c103a7f9d3521a02f9abf4126e5116be22fe4c0af0ff336b186" class="target"></span>enumer[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv416LV_FT_FONT_STYLE]ator FT_FONT_STYLE_NORMAL[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N16LV_FT_FONT_STYLE20FT_FONT_STYLE_NORMALE] <span id="_CPPv3N16LV_FT_FONT_STYLE20FT_FONT_STYLE_NORMALE"></span><span id="_CPPv2N16LV_FT_FONT_STYLE20FT_FONT_STYLE_NORMALE"></span><span id="lv__freetype_8h_1a1ba84fb8ade4d4c103a7f9d3521a02f9abf4126e5116be22fe4c0af0ff336b186" class="target"></span>
+
:; enumerator FT_FONT_STYLE_NORMAL  
 
::
 
::
:; <span id="_CPPv3N16LV_FT_FONT_STYLE20FT_FONT_STYLE_ITALICE"></span><span id="_CPPv2N16LV_FT_FONT_STYLE20FT_FONT_STYLE_ITALICE"></span><span id="lv__freetype_8h_1a1ba84fb8ade4d4c103a7f9d3521a02f9aa703d47cf40ebeccde18785f528a96e2" class="target"></span>enumerator FT_FONT_ST[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N16LV_FT_FONT_STYLE20FT_FONT_STYLE_NORMALE]YLE_ITALIC[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N16LV_FT_FONT_STYLE20FT_FONT_STYLE_ITALICE] <span id="_CPPv3N16LV_FT_FONT_STYLE20FT_FONT_STYLE_ITALICE"></span><span id="_CPPv2N16LV_FT_FONT_STYLE20FT_FONT_STYLE_ITALICE"></span><span id="lv__freetype_8h_1a1ba84fb8ade4d4c103a7f9d3521a02f9aa703d47cf40ebeccde18785f528a96e2" class="target"></span>
+
:; enumerator FT_FONT_STYLE_ITALIC
 
::
 
::
:; <span id="_CPPv3N16LV_FT_FONT_STYLE18FT_FONT_STYLE_BOLDE"></span><span id="_CPPv2N16LV_FT_FONT_STYLE18FT_FONT_STYLE_BOLDE"></span><span id="lv__freetype_8h_1a1ba84fb8ade4d4c103a7f9d3521a02f9a1f361569958a1ecf690aa777f1f37d87" class="target"></span>enumerator FT_FONT_ST[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N16LV_FT_FONT_STYLE20FT_FONT_STYLE_ITALICE]YLE_BOLD[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N16LV_FT_FONT_STYLE18FT_FONT_STYLE_BOLDE] <span id="_CPPv3N16LV_FT_FONT_STYLE18FT_FONT_STYLE_BOLDE"></span><span id="_CPPv2N16LV_FT_FONT_STYLE18FT_FONT_STYLE_BOLDE"></span><span id="lv__freetype_8h_1a1ba84fb8ade4d4c103a7f9d3521a02f9a1f361569958a1ecf690aa777f1f37d87" class="target"></span>
+
:; enumerator FT_FONT_STYLE_BOLD
 
::
 
::
  
 
Functions
 
Functions
  
; <span id="_CPPv316lv_freetype_init8uint16_t8uint16_t8uint32_t"></span><span id="_CPPv216lv_freetype_init8uint16_t8uint16_t8uint32_t"></span><span id="lv_freetype_init__uint16_t.uint16_t.uint32_t"></span><span id="lv__freetype_8h_1a8ca334813647721c3fcdbbb1ce443fb6" class="target"></span>bool l[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N16LV_FT_FONT_STYLE18FT_FONT_STYLE_BOLDE]v_freetype_init(uint16_t max_faces, uint16_t max_sizes, uint32_t max_bytes)[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv416lv_freetype_init8uint16_t8uint16_t8uint32_t] <span id="_CPPv316lv_freetype_init8uint16_t8uint16_t8uint32_t"></span><span id="_CPPv216lv_freetype_init8uint16_t8uint16_t8uint32_t"></span><span id="lv_freetype_init__uint16_t.uint16_t.uint32_t"></span><span id="lv__freetype_8h_1a8ca334813647721c3fcdbbb1ce443fb6" class="target"></span>
+
; 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 opene[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv416lv_freetype_init8uint16_t8uint16_t8uint32_t]d FT_Face objects managed by this cache instance. Use 0 for defaults.
+
::* 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行目: 146行目:
 
:: true on success, otherwise false.
 
:: true on success, otherwise false.
  
; <span id="_CPPv319lv_freetype_destroyv"></span><span id="_CPPv219lv_freetype_destroyv"></span><span id="lv_freetype_destroy__void"></span><span id="lv__freetype_8h_1a7ce3c9bfea8f9e0459c56a8b4cb7fa79" class="target"></span>void lv_freetype_destroy(void)[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv419lv_freetype_destroyv] <span id="_CPPv319lv_freetype_destroyv"></span><span id="_CPPv219lv_freetype_destroyv"></span><span id="lv_freetype_destroy__void"></span><span id="lv__freetype_8h_1a7ce3c9bfea8f9e0459c56a8b4cb7fa79" class="target"></span>
+
; void lv_freetype_destroy(void)  
 
: Destroy freetype library
 
: Destroy freetype library
[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv419lv_freetype_destroyv]
 
  
; <span id="_CPPv315lv_ft_font_initP12lv_ft_info_t"></span><span id="_CPPv215lv_ft_font_initP12lv_ft_info_t"></span><span id="lv_ft_font_init__lv_ft_info_tP"></span><span id="lv__freetype_8h_1af8c1c5dfb3d8484c67914966f496fa5d" class="target"></span>bool lv_ft_font_init(lv_ft_info_t *info)[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv415lv_ft_font_initP12lv_ft_info_t] <span id="_CPPv315lv_ft_font_initP12lv_ft_info_t"></span><span id="_CPPv215lv_ft_font_initP12lv_ft_info_t"></span><span id="lv_ft_font_init__lv_ft_info_tP"></span><span id="lv__freetype_8h_1af8c1c5dfb3d8484c67914966f496fa5d" class="target"></span>
+
 
: Creates a font with info parameter s[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv415lv_ft_font_initP12lv_ft_info_t]pecified.
+
; 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行目: 157行目:
 
:: true on success, otherwise false.
 
:: true on success, otherwise false.
  
; <span id="_CPPv318lv_ft_font_destroyP9lv_font_t"></span><span id="_CPPv218lv_ft_font_destroyP9lv_font_t"></span><span id="lv_ft_font_destroy__lv_font_tP"></span><span id="lv__freetype_8h_1a14e8da96c428a2a3659b18ac7c548a5d" class="target"></span>void lv_ft_font_destroy(lv_font_t *font)[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv418lv_ft_font_destroyP9lv_font_t] <span id="_CPPv318lv_ft_font_destroyP9lv_font_t"></span><span id="_CPPv218lv_ft_font_destroyP9lv_font_t"></span><span id="lv_ft_font_destroy__lv_font_tP"></span><span id="lv__freetype_8h_1a14e8da96c428a2a3659b18ac7c548a5d" class="target"></span>
+
; void lv_ft_font_destroy(lv_font_t *font)  
: Destroy a font that has been created[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv418lv_ft_font_destroyP9lv_font_t].
+
: Destroy a font that has been created.
 
:; Parameters
 
:; Parameters
 
:: font -- pointer to font.
 
:: font -- pointer to font.
  
; <span id="_CPPv312lv_ft_info_t"></span><span id="_CPPv212lv_ft_info_t"></span><span id="lv_ft_info_t"></span><span id="structlv__ft__info__t" class="target"></span>struct lv_ft_info_t[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv412lv_ft_info_t] <span id="_CPPv312lv_ft_info_t"></span><span id="_CPPv212lv_ft_info_t"></span><span id="lv_ft_info_t"></span><span id="structlv__ft__info__t" class="target"></span>
+
; struct lv_ft_info_t  
: Public Members [https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv412lv_ft_info_t]
+
: Public Members  
:; <span id="_CPPv3N12lv_ft_info_t4nameE"></span><span id="_CPPv2N12lv_ft_info_t4nameE"></span><span id="lv_ft_info_t::name__cCP"></span><span id="structlv__ft__info__t_1a553cf8a5701a8fca3c7aea5f9ad23791" class="target"></span>const char *name[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N12lv_ft_info_t4nameE] <span id="_CPPv3N12lv_ft_info_t4nameE"></span><span id="_CPPv2N12lv_ft_info_t4nameE"></span><span id="lv_ft_info_t::name__cCP"></span><span id="structlv__ft__info__t_1a553cf8a5701a8fca3c7aea5f9ad23791" class="target"></span>
+
:; const char *name  
 
::
 
::
:; <span id="_CPPv3N12lv_ft_info_t3memE"></span><span id="_CPPv2N12lv_ft_info_t3memE"></span><span id="lv_ft_info_t::mem__voidCP"></span><span id="structlv__ft__info__t_1a087c8647c7f86ba5a43b142d8733b0bd" class="target"></span>const [https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N12lv_ft_info_t4nameE]void *mem[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N12lv_ft_info_t3memE] <span id="_CPPv3N12lv_ft_info_t3memE"></span><span id="_CPPv2N12lv_ft_info_t3memE"></span><span id="lv_ft_info_t::mem__voidCP"></span><span id="structlv__ft__info__t_1a087c8647c7f86ba5a43b142d8733b0bd" class="target"></span>
+
:; const void *mem  
 
::
 
::
:; <span id="_CPPv3N12lv_ft_info_t8mem_sizeE"></span><span id="_CPPv2N12lv_ft_info_t8mem_sizeE"></span><span id="lv_ft_info_t::mem_size__s"></span><span id="structlv__ft__info__t_1a23549db5fa70cb314a0ac19a5cc61aae" class="target"></span>size_[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N12lv_ft_info_t3memE]t mem_size[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N12lv_ft_info_t8mem_sizeE] <span id="_CPPv3N12lv_ft_info_t8mem_sizeE"></span><span id="_CPPv2N12lv_ft_info_t8mem_sizeE"></span><span id="lv_ft_info_t::mem_size__s"></span><span id="structlv__ft__info__t_1a23549db5fa70cb314a0ac19a5cc61aae" class="target"></span>
+
:; size_t mem_size  
 
::
 
::
:; <span id="_CPPv3N12lv_ft_info_t4fontE"></span><span id="_CPPv2N12lv_ft_info_t4fontE"></span><span id="lv_ft_info_t::font__lv_font_tP"></span><span id="structlv__ft__info__t_1a76ba9e1f18a57250cb61b04df77b6a15" class="target"></span>lv_fo[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N12lv_ft_info_t8mem_sizeE]nt_t *font[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N12lv_ft_info_t4fontE] <span id="_CPPv3N12lv_ft_info_t4fontE"></span><span id="_CPPv2N12lv_ft_info_t4fontE"></span><span id="lv_ft_info_t::font__lv_font_tP"></span><span id="structlv__ft__info__t_1a76ba9e1f18a57250cb61b04df77b6a15" class="target"></span>
+
:; lv_font_t *font  
 
::
 
::
:; <span id="_CPPv3N12lv_ft_info_t6weightE"></span><span id="_CPPv2N12lv_ft_info_t6weightE"></span><span id="lv_ft_info_t::weight__uint16_t"></span><span id="structlv__ft__info__t_1a35fb57771e69d1f84be27bfe41e61a87" class="target"></span>uint1[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N12lv_ft_info_t4fontE]6_t weight[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N12lv_ft_info_t6weightE] <span id="_CPPv3N12lv_ft_info_t6weightE"></span><span id="_CPPv2N12lv_ft_info_t6weightE"></span><span id="lv_ft_info_t::weight__uint16_t"></span><span id="structlv__ft__info__t_1a35fb57771e69d1f84be27bfe41e61a87" class="target"></span>
+
:; uint16_t weight  
 
::
 
::
:; <span id="_CPPv3N12lv_ft_info_t5styleE"></span><span id="_CPPv2N12lv_ft_info_t5styleE"></span><span id="lv_ft_info_t::style__uint16_t"></span><span id="structlv__ft__info__t_1afbd2099d6fc045edd53e5830c8cfad65" class="target"></span>uint1[https://docs.lvgl.io/8.2/libs/freetype.html#_CPPv4N12lv_ft_info_t6weightE]6_t style
+
:; 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スタイル
 +
|}
  
  
  
----
 
 
:[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]]
 
:[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]]

2022年6月29日 (水) 16:59時点における最新版

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:

  1. 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.
  2. 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.
  3. 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:

  1. FT_FONT_STYLE_NORMAL:default style.
  2. FT_FONT_STYLE_ITALIC:Italic style
  3. 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_conf.hLV_USE_FREETYPE を有効化します。


開いているフォントのグリフをキャッシュするには、LV_FREETYPE_CACHE_SIZE >= 0 に設定した後、以下のマクロで詳細な設定を行います。

  1. LV_FREETYPE_CACHE_SIZE:フォントビットマップ、アウトライン、文字コード表などをキャッシュするために使用される最大メモリ(バイト)。0はシステムのデフォルト値を使用することを意味し、0未満はキャッシュを無効にすることを意味します。注:この値は、管理対象のFT_FaceおよびFT_Sizeオブジェクトを考慮していないことに注意してください。
  2. LV_FREETYPE_CACHE_FT_FACES:このキャッシュインスタンスによって管理される開かれたFT_Faceオブジェクトの最大数。0は、システムのデフォルト値を使用することを意味します。LV_FREETYPE_CACHE_SIZE>=0の場合にのみ役立ちます。
  3. LV_FREETYPE_CACHE_FT_SIZES:このキャッシュインスタンスによって管理される、開かれたFT_Sizeオブジェクトの最大数。0は、システムのデフォルト値を使用することを意味します。LV_FREETYPE_CACHE_SIZE>=0の場合にのみ役立ちます。


使用するフォントサイズがすべて256を超えないことが確実な場合は、LV_FREETYPE_SBIT_CACHEを有効にすると、小さなビットマップに対してより高いメモリ効率を実現することができます。


lv_ft_font_init() を使用すると、FreeType フォントを作成することができます。これは成功を示すtrueを返し、同時にlv_ft_info_tfontメンバに LVGL フォントへのポインタが格納され、他の LVGL フォントと同様に使用できるようになります。

フォントスタイルは太字と斜体をサポートしています。次のマクロを使用して設定できます。

  1. FT_FONT_STYLE_NORMAL:デフォルトのスタイル。
  2. FT_FONT_STYLE_ITALIC:斜体
  3. FT_FONT_STYLE_BOLD:太字スタイル


これらは組み合わせることができます。例:FT_FONT_STYLE_BOLD | FT_FONT_STYLE_ITALIC


FreeType拡張は、LVGLのファイルシステムを使用しないことに注意してください。あなたのオペレーティングシステムやプラットフォームで通常行われているように、単にフォントのパスを渡すことができます。


Example

英文 自動翻訳

Open a front with FreeType

LVGL docs 3rdPartyLibs FreeType 01.png


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