diff options
| author | Adrian Robert | 2008-09-30 01:03:00 +0000 |
|---|---|---|
| committer | Adrian Robert | 2008-09-30 01:03:00 +0000 |
| commit | 1bc98b35df8565aac8a1008ea233db339faab89c (patch) | |
| tree | fc1efa68719ccc5990d75cf2e56046290fa1b819 /src/nsfont.m | |
| parent | 4520e527831ff37e96fede77461df4b7d181ec18 (diff) | |
| download | emacs-1bc98b35df8565aac8a1008ea233db339faab89c.tar.gz emacs-1bc98b35df8565aac8a1008ea233db339faab89c.zip | |
* nsfont.m (nsfont_trait_distance): Fix bug. (nsfont_list): Return a list rather than a vector (syncs with Handa changes of 2008-05-14). (nsfont_open): Improve logging.
Diffstat (limited to 'src/nsfont.m')
| -rw-r--r-- | src/nsfont.m | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/nsfont.m b/src/nsfont.m index 8761e57ca6e..813b04be662 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -178,7 +178,7 @@ nsfont_fmember_to_entity (NSString *family, NSArray *famMember) | |||
| 178 | { | 178 | { |
| 179 | fprintf (stderr, "created font_entity:\n "); | 179 | fprintf (stderr, "created font_entity:\n "); |
| 180 | debug_print (font_entity); | 180 | debug_print (font_entity); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | [suffix release]; | 183 | [suffix release]; |
| 184 | free (escapedFamily); | 184 | free (escapedFamily); |
| @@ -190,12 +190,12 @@ nsfont_fmember_to_entity (NSString *family, NSArray *famMember) | |||
| 190 | static int | 190 | static int |
| 191 | nsfont_trait_distance (unsigned int traits1, unsigned int traits2) | 191 | nsfont_trait_distance (unsigned int traits1, unsigned int traits2) |
| 192 | { | 192 | { |
| 193 | int i, d =0; | 193 | int i, d = 0; |
| 194 | for (i =0; i<sizeof (unsigned int)*8; i++) | 194 | for (i = 0; i < sizeof (unsigned int) * 8; i++) |
| 195 | { | 195 | { |
| 196 | d += (traits1 & 0x1) ^ (traits2 & 0x1); | 196 | d += (traits1 & 0x1) ^ (traits2 & 0x1); |
| 197 | traits1 >> 1; | 197 | traits1 >>= 1; |
| 198 | traits2 >> 1; | 198 | traits2 >>= 1; |
| 199 | } | 199 | } |
| 200 | return d; | 200 | return d; |
| 201 | } | 201 | } |
| @@ -267,7 +267,7 @@ nsfont_get_cache (FRAME_PTR frame) | |||
| 267 | 267 | ||
| 268 | 268 | ||
| 269 | /* List fonts exactly matching with FONT_SPEC on FRAME. The value | 269 | /* List fonts exactly matching with FONT_SPEC on FRAME. The value |
| 270 | is a vector of font-entities. This is the sole API that | 270 | is a **list** of font-entities. This is the sole API that |
| 271 | allocates font-entities. */ | 271 | allocates font-entities. */ |
| 272 | static Lisp_Object | 272 | static Lisp_Object |
| 273 | nsfont_list (Lisp_Object frame, Lisp_Object font_spec) | 273 | nsfont_list (Lisp_Object frame, Lisp_Object font_spec) |
| @@ -349,7 +349,7 @@ nsfont_list (Lisp_Object frame, Lisp_Object font_spec) | |||
| 349 | if (NSFONT_TRACE) | 349 | if (NSFONT_TRACE) |
| 350 | fprintf (stderr, " Returning %d entities.\n", XINT (Flength (list))); | 350 | fprintf (stderr, " Returning %d entities.\n", XINT (Flength (list))); |
| 351 | 351 | ||
| 352 | return (NILP (list) ? Qnil : Fvconcat (1, &list));/* Qnil was null_vector */ | 352 | return list; |
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | 355 | ||
| @@ -540,8 +540,9 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 540 | family = nsfont_get_family (font_entity); | 540 | family = nsfont_get_family (font_entity); |
| 541 | if (NSFONT_TRACE) | 541 | if (NSFONT_TRACE) |
| 542 | { | 542 | { |
| 543 | fprintf (stderr, "family: '%s'\ttraits = %ld\tbold = %d\n", | 543 | fprintf (stderr, "family: '%s'\ttraits = %ld\tbold = %d\titalic = %d\n", |
| 544 | [family UTF8String], traits, traits & NSBoldFontMask); | 544 | [family UTF8String], traits, traits & NSBoldFontMask, |
| 545 | traits & NSItalicFontMask); | ||
| 545 | } | 546 | } |
| 546 | 547 | ||
| 547 | /* see http://cocoadev.com/forums/comments.php?DiscussionID =74 */ | 548 | /* see http://cocoadev.com/forums/comments.php?DiscussionID =74 */ |
| @@ -576,6 +577,8 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 576 | } | 577 | } |
| 577 | } | 578 | } |
| 578 | 579 | ||
| 580 | //NSLog(@"%@\n",nsfont); | ||
| 581 | |||
| 579 | #if 0 | 582 | #if 0 |
| 580 | { | 583 | { |
| 581 | NSNumber *cached = [fontCache objectForKey: nsfont]; | 584 | NSNumber *cached = [fontCache objectForKey: nsfont]; |