eina_file_close(map->mempool.f);
eina_file_map_free(map->index.f, map->index.data);
eina_file_close(map->index.f);
+ eina_hash_free(map->index.entries_by_hkey);
map->fe->map = NULL;
free(map);
}
map->fe = fe;
eina_clist_init(&map->glyphs);
- eina_strlcpy(map->index.path, indexpath, SHARED_BUFFER_PATH_MAX);
eina_strlcpy(map->mempool.path, datapath, SHARED_BUFFER_PATH_MAX);
- map->index.generation_id = _index.generation_id;
- _shared_index_remap_check(&map->index, sizeof(Glyph_Data));
+ if (indexpath)
+ {
+ eina_strlcpy(map->index.path, indexpath, SHARED_BUFFER_PATH_MAX);
+ map->index.generation_id = _index.generation_id;
+ _shared_index_remap_check(&map->index, sizeof(Glyph_Data));
+ }
map->mempool.f = eina_file_open(map->mempool.path, EINA_TRUE);
map->mempool.size = eina_file_size_get(map->mempool.f);
}
static void
+_glyph_map_remap_check(Glyph_Map *map)
+{
+ if (eina_file_refresh(map->mempool.f)
+ || (eina_file_size_get(map->mempool.f) != (size_t) map->mempool.size))
+ {
+ WRN("Glyph pool has been resized.");
+ eina_file_map_free(map->mempool.f, map->mempool.data);
+ map->mempool.data = eina_file_map_all(map->mempool.f, EINA_FILE_RANDOM);
+ if (map->mempool.data)
+ map->mempool.size = eina_file_size_get(map->mempool.f);
+ else
+ map->mempool.size = 0;
+ }
+}
+
+static void
_glyph_request_cb(void *data, const void *msg, int size)
{
const Msg_Font_Glyphs_Loaded *resp = msg;
datapath = name;
fe->map = _glyph_map_open(fe, idxpath, datapath);
}
+ else
+ _glyph_map_remap_check(fe->map);
for (i = 0; i < nglyphs; i++)
{
gl->base.bitmap.pixel_mode = pixel_mode;
gl->rid = 0;
+ if (gl->offset + glsize > (size_t) fe->map->mempool.size)
+ {
+ ERR("Glyph is out of the buffer. Set buffer to NULL.");
+ gl->base.bitmap.buffer = NULL;
+ }
+
eina_clist_add_head(&fe->map->glyphs, &gl->map_entry);
}
}