3 #include "gdipp_lib/lru.h"
4 #include "gdipp_server/glyph_run.h"
12 typedef uint128_t string_id_type
;
13 typedef uint128_t char_id_type
;
14 typedef std::pair
<string_id_type
, uint128_t
> glyph_run_id_type
;
16 static string_id_type
get_string_id(const wchar_t *string
, unsigned int count
, bool is_glyph_index
);
17 static char_id_type
get_char_id(uint128_t render_trait
, FT_UInt index
, bool is_glyph_index
);
23 const FT_Glyph
lookup_glyph(char_id_type char_id
);
24 bool store_glyph(char_id_type char_id
, const FT_Glyph glyph
);
25 const glyph_run
*lookup_glyph_run(string_id_type string_id
, uint128_t render_trait
) const;
26 bool store_glyph_run(string_id_type string_id
, uint128_t render_trait
, glyph_run
*a_glyph_run
);
29 // std::map from render trait to glyph run
30 typedef std::map
<uint128_t
, glyph_run
*> trait_to_run_map
;
32 // std::map from character ID (including character index and render trait) to its glyph
33 std::map
<char_id_type
, INIT_ONCE
> _glyph_store
;
34 // std::map from string ID to glyph run
35 // use hierarchical design so that when LRU string is evicted, all associated glyph runs are erased
36 std::map
<string_id_type
, trait_to_run_map
> _glyph_run_store
;
38 // least recently used glyph runs, indexed by string ID
39 lru_list
<string_id_type
> _glyph_run_lru
;