2006-10-01 17:09:04 +00:00
|
|
|
// -*- c-basic-offset: 8; indent-tabs-mode: t -*-
|
|
|
|
// vim:ts=8:sw=8:noet:ai:
|
|
|
|
/*
|
|
|
|
Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2006-07-07 18:26:51 +00:00
|
|
|
#ifndef __ASS_CACHE_H__
|
|
|
|
#define __ASS_CACHE_H__
|
|
|
|
|
2006-11-26 20:34:54 +00:00
|
|
|
void ass_font_cache_init(void);
|
2006-11-27 17:13:52 +00:00
|
|
|
ass_font_t* ass_font_cache_find(ass_font_desc_t* desc);
|
|
|
|
void ass_font_cache_add(ass_font_t* font);
|
2006-11-26 20:34:54 +00:00
|
|
|
void ass_font_cache_done(void);
|
2006-07-07 18:26:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
// describes a glyph; glyphs with equivalents structs are considered identical
|
|
|
|
typedef struct glyph_hash_key_s {
|
|
|
|
char bitmap; // bool : true = bitmap, false = outline
|
2006-11-28 22:17:33 +00:00
|
|
|
ass_font_t* font;
|
2006-07-07 18:26:51 +00:00
|
|
|
int size; // font size
|
2006-11-28 22:17:33 +00:00
|
|
|
uint32_t ch; // character code
|
2006-07-07 18:26:51 +00:00
|
|
|
unsigned outline; // border width, 16.16 fixed point value
|
|
|
|
int bold, italic;
|
2006-09-16 13:32:46 +00:00
|
|
|
char be; // blur edges
|
2006-07-07 18:26:51 +00:00
|
|
|
|
|
|
|
// the following affects bitmap glyphs only
|
|
|
|
unsigned scale_x, scale_y; // 16.16
|
|
|
|
int angle; // signed 16.16
|
|
|
|
|
|
|
|
FT_Vector advance; // subpixel shift vector
|
|
|
|
} glyph_hash_key_t;
|
|
|
|
|
|
|
|
typedef struct glyph_hash_val_s {
|
2006-09-16 13:08:17 +00:00
|
|
|
bitmap_t* bm; // the actual glyph bitmaps
|
|
|
|
bitmap_t* bm_o;
|
2006-09-24 16:04:37 +00:00
|
|
|
bitmap_t* bm_s;
|
2006-07-07 18:26:51 +00:00
|
|
|
FT_BBox bbox_scaled; // bbox after scaling, but before rotation
|
|
|
|
FT_Vector advance; // 26.6, advance distance to the next glyph in line
|
|
|
|
} glyph_hash_val_t;
|
|
|
|
|
|
|
|
void ass_glyph_cache_init(void);
|
|
|
|
void cache_add_glyph(glyph_hash_key_t* key, glyph_hash_val_t* val);
|
|
|
|
glyph_hash_val_t* cache_find_glyph(glyph_hash_key_t* key);
|
2006-08-26 19:00:21 +00:00
|
|
|
void ass_glyph_cache_reset(void);
|
2006-07-07 18:26:51 +00:00
|
|
|
void ass_glyph_cache_done(void);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|