[ot-font] Allow 24bit glyphs in advance cache
This commit is contained in:
parent
99070a734a
commit
d7adc55e18
|
@ -82,11 +82,5 @@ struct hb_cache_t
|
|||
item_t values[1u<<cache_bits];
|
||||
};
|
||||
|
||||
template <bool thread_safe = true>
|
||||
using hb_cmap_cache_t = hb_cache_t<21, 16, 8, thread_safe>;
|
||||
|
||||
template <bool thread_safe = true>
|
||||
using hb_advance_cache_t = hb_cache_t<16, 24, 8, thread_safe>;
|
||||
|
||||
|
||||
#endif /* HB_CACHE_HH */
|
||||
|
|
|
@ -80,6 +80,8 @@
|
|||
*/
|
||||
|
||||
|
||||
using hb_ft_advance_cache_t = hb_cache_t<16, 24, 8, false>;
|
||||
|
||||
struct hb_ft_font_t
|
||||
{
|
||||
int load_flags;
|
||||
|
@ -89,7 +91,7 @@ struct hb_ft_font_t
|
|||
mutable hb_mutex_t lock;
|
||||
FT_Face ft_face;
|
||||
mutable unsigned cached_serial;
|
||||
mutable hb_advance_cache_t<false> advance_cache;
|
||||
mutable hb_ft_advance_cache_t advance_cache;
|
||||
};
|
||||
|
||||
static hb_ft_font_t *
|
||||
|
|
|
@ -59,13 +59,15 @@
|
|||
* never need to call these functions directly.
|
||||
**/
|
||||
|
||||
using hb_ot_font_advance_cache_t = hb_cache_t<24, 16, 8, true>;
|
||||
|
||||
struct hb_ot_font_t
|
||||
{
|
||||
const hb_ot_face_t *ot_face;
|
||||
|
||||
/* h_advance caching */
|
||||
mutable hb_atomic_int_t cached_coords_serial;
|
||||
mutable hb_atomic_ptr_t<hb_advance_cache_t<>> advance_cache;
|
||||
mutable hb_atomic_ptr_t<hb_ot_font_advance_cache_t> advance_cache;
|
||||
};
|
||||
|
||||
static hb_ot_font_t *
|
||||
|
@ -161,14 +163,14 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
|
|||
bool use_cache = false;
|
||||
#endif
|
||||
|
||||
hb_advance_cache_t<> *cache = nullptr;
|
||||
hb_ot_font_advance_cache_t *cache = nullptr;
|
||||
if (use_cache)
|
||||
{
|
||||
retry:
|
||||
cache = ot_font->advance_cache.get_acquire ();
|
||||
if (unlikely (!cache))
|
||||
{
|
||||
cache = (hb_advance_cache_t<> *) hb_malloc (sizeof (hb_advance_cache_t<>));
|
||||
cache = (hb_ot_font_advance_cache_t *) hb_malloc (sizeof (hb_ot_font_advance_cache_t));
|
||||
if (unlikely (!cache))
|
||||
{
|
||||
use_cache = false;
|
||||
|
|
Loading…
Reference in New Issue