aboutsummaryrefslogtreecommitdiffstats
path: root/src/ftfont.c
diff options
context:
space:
mode:
authorJoakim Verona2013-01-15 00:03:45 +0100
committerJoakim Verona2013-01-15 00:03:45 +0100
commitbc4f7ac4ec3ee942171b9fef6eec6b1a61cc5b8b (patch)
tree481f44117938f166336393293fa73eaeff179406 /src/ftfont.c
parent132fdce3d2530db5a6edeaf4242257ff01ea4760 (diff)
parent982c5d68ff9a798d777d25ccfda7ca6616fab1e2 (diff)
downloademacs-bc4f7ac4ec3ee942171b9fef6eec6b1a61cc5b8b.tar.gz
emacs-bc4f7ac4ec3ee942171b9fef6eec6b1a61cc5b8b.zip
auto upstream
Diffstat (limited to 'src/ftfont.c')
-rw-r--r--src/ftfont.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/ftfont.c b/src/ftfont.c
index 1ada95d377c..1d7678bfe09 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -393,16 +393,14 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for)
393 cache_data = xmalloc (sizeof *cache_data); 393 cache_data = xmalloc (sizeof *cache_data);
394 cache_data->ft_face = NULL; 394 cache_data->ft_face = NULL;
395 cache_data->fc_charset = NULL; 395 cache_data->fc_charset = NULL;
396 val = make_save_value (NULL, 0); 396 val = make_save_value (cache_data, 0);
397 XSAVE_VALUE (val)->integer = 0;
398 XSAVE_VALUE (val)->pointer = cache_data;
399 cache = Fcons (Qnil, val); 397 cache = Fcons (Qnil, val);
400 Fputhash (key, cache, ft_face_cache); 398 Fputhash (key, cache, ft_face_cache);
401 } 399 }
402 else 400 else
403 { 401 {
404 val = XCDR (cache); 402 val = XCDR (cache);
405 cache_data = XSAVE_VALUE (val)->pointer; 403 cache_data = XSAVE_POINTER (val);
406 } 404 }
407 405
408 if (cache_for == FTFONT_CACHE_FOR_ENTITY) 406 if (cache_for == FTFONT_CACHE_FOR_ENTITY)
@@ -468,7 +466,7 @@ ftfont_get_fc_charset (Lisp_Object entity)
468 466
469 cache = ftfont_lookup_cache (entity, FTFONT_CACHE_FOR_CHARSET); 467 cache = ftfont_lookup_cache (entity, FTFONT_CACHE_FOR_CHARSET);
470 val = XCDR (cache); 468 val = XCDR (cache);
471 cache_data = XSAVE_VALUE (val)->pointer; 469 cache_data = XSAVE_POINTER (val);
472 return cache_data->fc_charset; 470 return cache_data->fc_charset;
473} 471}
474 472
@@ -1200,9 +1198,9 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
1200 filename = XCAR (val); 1198 filename = XCAR (val);
1201 idx = XCDR (val); 1199 idx = XCDR (val);
1202 val = XCDR (cache); 1200 val = XCDR (cache);
1203 cache_data = XSAVE_VALUE (XCDR (cache))->pointer; 1201 cache_data = XSAVE_POINTER (XCDR (cache));
1204 ft_face = cache_data->ft_face; 1202 ft_face = cache_data->ft_face;
1205 if (XSAVE_VALUE (val)->integer > 0) 1203 if (XSAVE_INTEGER (val) > 0)
1206 { 1204 {
1207 /* FT_Face in this cache is already used by the different size. */ 1205 /* FT_Face in this cache is already used by the different size. */
1208 if (FT_New_Size (ft_face, &ft_size) != 0) 1206 if (FT_New_Size (ft_face, &ft_size) != 0)
@@ -1213,13 +1211,13 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
1213 return Qnil; 1211 return Qnil;
1214 } 1212 }
1215 } 1213 }
1216 XSAVE_VALUE (val)->integer++; 1214 XSAVE_INTEGER (val)++;
1217 size = XINT (AREF (entity, FONT_SIZE_INDEX)); 1215 size = XINT (AREF (entity, FONT_SIZE_INDEX));
1218 if (size == 0) 1216 if (size == 0)
1219 size = pixel_size; 1217 size = pixel_size;
1220 if (FT_Set_Pixel_Sizes (ft_face, size, size) != 0) 1218 if (FT_Set_Pixel_Sizes (ft_face, size, size) != 0)
1221 { 1219 {
1222 if (XSAVE_VALUE (val)->integer == 0) 1220 if (XSAVE_INTEGER (val) == 0)
1223 FT_Done_Face (ft_face); 1221 FT_Done_Face (ft_face);
1224 return Qnil; 1222 return Qnil;
1225 } 1223 }
@@ -1328,10 +1326,10 @@ ftfont_close (FRAME_PTR f, struct font *font)
1328 cache = ftfont_lookup_cache (val, FTFONT_CACHE_FOR_FACE); 1326 cache = ftfont_lookup_cache (val, FTFONT_CACHE_FOR_FACE);
1329 eassert (CONSP (cache)); 1327 eassert (CONSP (cache));
1330 val = XCDR (cache); 1328 val = XCDR (cache);
1331 (XSAVE_VALUE (val)->integer)--; 1329 (XSAVE_INTEGER (val))--;
1332 if (XSAVE_VALUE (val)->integer == 0) 1330 if (XSAVE_INTEGER (val) == 0)
1333 { 1331 {
1334 struct ftfont_cache_data *cache_data = XSAVE_VALUE (val)->pointer; 1332 struct ftfont_cache_data *cache_data = XSAVE_POINTER (val);
1335 1333
1336 FT_Done_Face (cache_data->ft_face); 1334 FT_Done_Face (cache_data->ft_face);
1337#ifdef HAVE_LIBOTF 1335#ifdef HAVE_LIBOTF