Skip to content

glyph_cache_t

概述

glyph cache

函数

函数名称说明
glyph_cache_add增加一个glyph对象到cache。
glyph_cache_deinit释放全部cache。
glyph_cache_init初始化glyph_cache对象。
glyph_cache_lookup查找glyph对象。
glyph_cache_shrink释放部分glyph。

glyph_cache_add 函数

  • 函数功能:

增加一个glyph对象到cache。

  • 函数原型:
ret_t glyph_cache_add (glyph_cache_t* cache, wchar_t code, font_size_t size, glyph_t* g);
  • 参数说明:
参数类型说明
返回值ret_t返回RET_OK表示成功,否则表示失败。
cacheglyph_cache_t*cache对象。
codewchar_t字符。
sizefont_size_t字体大小。
gglyph_t*glyph对象。

glyph_cache_deinit 函数

  • 函数功能:

释放全部cache。

  • 函数原型:
ret_t glyph_cache_deinit (glyph_cache_t* cache);
  • 参数说明:
参数类型说明
返回值ret_t返回RET_OK表示成功,否则表示失败。
cacheglyph_cache_t*cache对象。

glyph_cache_init 函数

  • 函数功能:

初始化glyph_cache对象。

  • 函数原型:
glyph_cache_t* glyph_cache_init (glyph_cache_t* cache, uint32_t capacity, tk_destroy_t destroy_glyph);
  • 参数说明:
参数类型说明
返回值glyph_cache_t*返回cache对象。
cacheglyph_cache_t*cache对象。
capacityuint32_t最大容量。
destroy_glyphtk_destroy_t销毁函数。

glyph_cache_lookup 函数

  • 函数功能:

查找glyph对象。

  • 函数原型:
ret_t glyph_cache_lookup (glyph_cache_t* cache, wchar_t code, font_size_t size, glyph_t* g);
  • 参数说明:
参数类型说明
返回值ret_t返回RET_OK表示成功,否则表示失败。
cacheglyph_cache_t*cache对象。
codewchar_t字符。
sizefont_size_t字体大小。
gglyph_t*glyph对象(用于返回glyph)。

glyph_cache_shrink 函数

  • 函数功能:

释放部分glyph。

  • 函数原型:
ret_t glyph_cache_shrink (glyph_cache_t* cache, uint32_t cache_size);
  • 参数说明:
参数类型说明
返回值ret_t返回RET_OK表示成功,否则表示失败。
cacheglyph_cache_t*cache对象。
cache_sizeuint32_t保留cache个数。