diff options
| author | Jan Djärv | 2012-10-08 20:31:39 +0200 |
|---|---|---|
| committer | Jan Djärv | 2012-10-08 20:31:39 +0200 |
| commit | 62c480c90a5fedee7dfa7d4d3c7c045ca9e0e892 (patch) | |
| tree | 154c5c23c82a550856fa2c42488566828c343747 /src | |
| parent | 1337353856dbf0dcfe8378ccf96f26442eee73e9 (diff) | |
| download | emacs-62c480c90a5fedee7dfa7d4d3c7c045ca9e0e892.tar.gz emacs-62c480c90a5fedee7dfa7d4d3c7c045ca9e0e892.zip | |
Fix wide-int related error and cache error in NS font handling.
* nsfont.m (Vfonts_in_cache): New variable.
(nsfont_open): Use unsignedLongLongValue for cache in case wide ints
are used. Add cached fonts to Vfonts_in_cache.
(syms_of_nsfont): Initialize and staticpro Vfonts_in_cache.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/nsfont.m | 19 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 122e0d19655..b348ec06538 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-10-08 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * nsfont.m (Vfonts_in_cache): New variable. | ||
| 4 | (nsfont_open): Use unsignedLongLongValue for cache in case wide ints | ||
| 5 | are used. Add cached fonts to Vfonts_in_cache. | ||
| 6 | (syms_of_nsfont): Initialize and staticpro Vfonts_in_cache. | ||
| 7 | |||
| 1 | 2012-10-08 Juanma Barranquero <lekktu@gmail.com> | 8 | 2012-10-08 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 9 | ||
| 3 | * makefile.w32-in (LOCAL_FLAGS): Don't define HAVE_NTGUI, it's now | 10 | * makefile.w32-in (LOCAL_FLAGS): Don't define HAVE_NTGUI, it's now |
diff --git a/src/nsfont.m b/src/nsfont.m index b13c96aa6ed..20a8f5d4028 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -53,6 +53,9 @@ extern float ns_antialias_threshold; | |||
| 53 | extern int ns_tmp_flags; | 53 | extern int ns_tmp_flags; |
| 54 | extern struct nsfont_info *ns_tmp_font; | 54 | extern struct nsfont_info *ns_tmp_font; |
| 55 | 55 | ||
| 56 | static Lisp_Object Vfonts_in_cache; | ||
| 57 | |||
| 58 | |||
| 56 | /* font glyph and metrics caching functions, implemented at end */ | 59 | /* font glyph and metrics caching functions, implemented at end */ |
| 57 | static void ns_uni_to_glyphs (struct nsfont_info *font_info, | 60 | static void ns_uni_to_glyphs (struct nsfont_info *font_info, |
| 58 | unsigned char block); | 61 | unsigned char block); |
| @@ -799,8 +802,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 799 | { | 802 | { |
| 800 | if (NSFONT_TRACE) | 803 | if (NSFONT_TRACE) |
| 801 | fprintf(stderr, "*** nsfont_open CACHE HIT!\n"); | 804 | fprintf(stderr, "*** nsfont_open CACHE HIT!\n"); |
| 802 | /* FIXME: Cast from (unsigned long) to Lisp_Object. */ | 805 | XHASH (font_object) = [cached unsignedLongLongValue]; |
| 803 | XHASH (font_object) = [cached unsignedLongValue]; | ||
| 804 | return font_object; | 806 | return font_object; |
| 805 | } | 807 | } |
| 806 | else | 808 | else |
| @@ -808,9 +810,13 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 808 | font_object = font_make_object (VECSIZE (struct nsfont_info), | 810 | font_object = font_make_object (VECSIZE (struct nsfont_info), |
| 809 | font_entity, pixel_size); | 811 | font_entity, pixel_size); |
| 810 | if (!synthItal) | 812 | if (!synthItal) |
| 811 | [fontCache setObject: [NSNumber numberWithUnsignedLong: | 813 | { |
| 812 | (unsigned long) XHASH (font_object)] | 814 | [fontCache setObject: [NSNumber |
| 813 | forKey: nsfont]; | 815 | numberWithUnsignedLongLong: |
| 816 | (unsigned long long) XHASH (font_object)] | ||
| 817 | forKey: nsfont]; | ||
| 818 | Vfonts_in_cache = Fcons (font_object, Vfonts_in_cache); | ||
| 819 | } | ||
| 814 | } | 820 | } |
| 815 | 821 | ||
| 816 | font_info = (struct nsfont_info *) XFONT_OBJECT (font_object); | 822 | font_info = (struct nsfont_info *) XFONT_OBJECT (font_object); |
| @@ -1529,4 +1535,7 @@ syms_of_nsfont (void) | |||
| 1529 | doc: /* Internal use: maps font registry to Unicode script. */); | 1535 | doc: /* Internal use: maps font registry to Unicode script. */); |
| 1530 | 1536 | ||
| 1531 | ascii_printable = NULL; | 1537 | ascii_printable = NULL; |
| 1538 | |||
| 1539 | Vfonts_in_cache = Qnil; | ||
| 1540 | staticpro (&Vfonts_in_cache); | ||
| 1532 | } | 1541 | } |