changeset 21348:d7920b488fa2

Use (ass_font_t, char code) instead of (FT_Face, glyph index) to identify glyphs in cache.
author eugeni
date Tue, 28 Nov 2006 22:17:33 +0000
parents 2d5ad5048952
children 11679d93c7d8
files libass/ass_cache.c libass/ass_cache.h libass/ass_render.c
diffstat 3 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass_cache.c	Tue Nov 28 19:01:04 2006 +0000
+++ b/libass/ass_cache.c	Tue Nov 28 22:17:33 2006 +0000
@@ -122,13 +122,13 @@
 static unsigned glyph_hash(glyph_hash_key_t* key) {
 	unsigned val = 0;
 	unsigned i;
-	for (i = 0; i < sizeof(key->face); ++i)
-		val += *(unsigned char *)(&(key->face) + i);
+	for (i = 0; i < sizeof(key->font); ++i)
+		val += *(unsigned char *)(&(key->font) + i);
 	val <<= 21;
 	
 	if (key->bitmap)   val &= 0x80000000;
 	if (key->be) val &= 0x40000000;
-	val += key->index;
+	val += key->ch;
 	val += key->size << 8;
 	val += key->outline << 3;
 	val += key->advance.x << 10;
--- a/libass/ass_cache.h	Tue Nov 28 19:01:04 2006 +0000
+++ b/libass/ass_cache.h	Tue Nov 28 22:17:33 2006 +0000
@@ -30,9 +30,9 @@
 // describes a glyph; glyphs with equivalents structs are considered identical
 typedef struct glyph_hash_key_s {
 	char bitmap; // bool : true = bitmap, false = outline
-	FT_Face face;
+	ass_font_t* font;
 	int size; // font size
-	int index; // glyph index in the face
+	uint32_t ch; // character code
 	unsigned outline; // border width, 16.16 fixed point value
 	int bold, italic;
 	char be; // blur edges
--- a/libass/ass_render.c	Tue Nov 28 19:01:04 2006 +0000
+++ b/libass/ass_render.c	Tue Nov 28 22:17:33 2006 +0000
@@ -1196,15 +1196,15 @@
  * \param advance advance vector of the extracted glyph
  * \return 0 on success
  */
-static int get_glyph(int index, int symbol, glyph_info_t* info, FT_Vector* advance)
+static int get_glyph(int symbol, glyph_info_t* info, FT_Vector* advance)
 {
 	int error;
 	glyph_hash_val_t* val;
 	glyph_hash_key_t* key = &(info->hash_key);
 	
-	key->face = render_context.font->face;
+	key->font = render_context.font;
 	key->size = render_context.font_size;
-	key->index = index;
+	key->ch = symbol;
 	key->outline = (render_context.border * 0xFFFF); // convert to 16.16
 	key->scale_x = (render_context.scale_x * 0xFFFF);
 	key->scale_y = (render_context.scale_y * 0xFFFF);
@@ -1625,7 +1625,7 @@
 			ass_font_set_transform(render_context.font, &matrix, &shift );
 		}
 		
-		error = get_glyph(glyph_index, code, text_info.glyphs + text_info.length, &shift);
+		error = get_glyph(code, text_info.glyphs + text_info.length, &shift);
 
 		if (error) {
 			continue;