[uniscribe] Minor

This commit is contained in:
Behdad Esfahbod 2011-08-24 02:09:04 +02:00
parent cd2b901027
commit 71388b3ee7

View File

@ -92,12 +92,13 @@ populate_log_font (LOGFONTW *lf,
} }
static hb_user_data_key_t uniscribe_data_key;
static struct hb_uniscribe_face_data_t { static struct hb_uniscribe_face_data_t {
HANDLE fh; HANDLE fh;
} _hb_uniscribe_face_data_nil = {0}; } _hb_uniscribe_face_data_nil = {0};
static hb_user_data_key_t uniscribe_face_data_key;
static void static void
_hb_uniscribe_face_data_destroy (hb_uniscribe_face_data_t *data) _hb_uniscribe_face_data_destroy (hb_uniscribe_face_data_t *data)
{ {
@ -109,7 +110,7 @@ _hb_uniscribe_face_data_destroy (hb_uniscribe_face_data_t *data)
static hb_uniscribe_face_data_t * static hb_uniscribe_face_data_t *
_hb_uniscribe_face_get_data (hb_face_t *face) _hb_uniscribe_face_get_data (hb_face_t *face)
{ {
hb_uniscribe_face_data_t *data = (hb_uniscribe_face_data_t *) hb_face_get_user_data (face, &uniscribe_face_data_key); hb_uniscribe_face_data_t *data = (hb_uniscribe_face_data_t *) hb_face_get_user_data (face, &uniscribe_data_key);
if (likely (data)) return data; if (likely (data)) return data;
data = (hb_uniscribe_face_data_t *) calloc (1, sizeof (hb_uniscribe_face_data_t)); data = (hb_uniscribe_face_data_t *) calloc (1, sizeof (hb_uniscribe_face_data_t));
@ -128,12 +129,12 @@ _hb_uniscribe_face_get_data (hb_face_t *face)
if (unlikely (!data->fh)) if (unlikely (!data->fh))
DEBUG_MSG (UNISCRIBE, face, "Face AddFontMemResourceEx() failed"); DEBUG_MSG (UNISCRIBE, face, "Face AddFontMemResourceEx() failed");
if (unlikely (!hb_face_set_user_data (face, &uniscribe_face_data_key, data, if (unlikely (!hb_face_set_user_data (face, &uniscribe_data_key, data,
(hb_destroy_func_t) _hb_uniscribe_face_data_destroy, (hb_destroy_func_t) _hb_uniscribe_face_data_destroy,
FALSE))) FALSE)))
{ {
_hb_uniscribe_face_data_destroy (data); _hb_uniscribe_face_data_destroy (data);
data = (hb_uniscribe_face_data_t *) hb_face_get_user_data (face, &uniscribe_face_data_key); data = (hb_uniscribe_face_data_t *) hb_face_get_user_data (face, &uniscribe_data_key);
if (data) if (data)
return data; return data;
else else
@ -151,8 +152,6 @@ static struct hb_uniscribe_font_data_t {
SCRIPT_CACHE script_cache; SCRIPT_CACHE script_cache;
} _hb_uniscribe_font_data_nil = {NULL, NULL, NULL}; } _hb_uniscribe_font_data_nil = {NULL, NULL, NULL};
static hb_user_data_key_t uniscribe_font_data_key;
static void static void
_hb_uniscribe_font_data_destroy (hb_uniscribe_font_data_t *data) _hb_uniscribe_font_data_destroy (hb_uniscribe_font_data_t *data)
{ {
@ -168,7 +167,7 @@ _hb_uniscribe_font_data_destroy (hb_uniscribe_font_data_t *data)
static hb_uniscribe_font_data_t * static hb_uniscribe_font_data_t *
_hb_uniscribe_font_get_data (hb_font_t *font) _hb_uniscribe_font_get_data (hb_font_t *font)
{ {
hb_uniscribe_font_data_t *data = (hb_uniscribe_font_data_t *) hb_font_get_user_data (font, &uniscribe_font_data_key); hb_uniscribe_font_data_t *data = (hb_uniscribe_font_data_t *) hb_font_get_user_data (font, &uniscribe_data_key);
if (likely (data)) return data; if (likely (data)) return data;
data = (hb_uniscribe_font_data_t *) calloc (1, sizeof (hb_uniscribe_font_data_t)); data = (hb_uniscribe_font_data_t *) calloc (1, sizeof (hb_uniscribe_font_data_t));
@ -187,12 +186,12 @@ _hb_uniscribe_font_get_data (hb_font_t *font)
DEBUG_MSG (UNISCRIBE, font, "Font SelectObject() failed"); DEBUG_MSG (UNISCRIBE, font, "Font SelectObject() failed");
} }
if (unlikely (!hb_font_set_user_data (font, &uniscribe_font_data_key, data, if (unlikely (!hb_font_set_user_data (font, &uniscribe_data_key, data,
(hb_destroy_func_t) _hb_uniscribe_font_data_destroy, (hb_destroy_func_t) _hb_uniscribe_font_data_destroy,
FALSE))) FALSE)))
{ {
_hb_uniscribe_font_data_destroy (data); _hb_uniscribe_font_data_destroy (data);
data = (hb_uniscribe_font_data_t *) hb_font_get_user_data (font, &uniscribe_font_data_key); data = (hb_uniscribe_font_data_t *) hb_font_get_user_data (font, &uniscribe_data_key);
if (data) if (data)
return data; return data;
else else