diff options
| author | Adrian Robert | 2009-08-02 15:37:07 +0000 |
|---|---|---|
| committer | Adrian Robert | 2009-08-02 15:37:07 +0000 |
| commit | b9173dc296f964cab904fc5eae02344e1b59eed2 (patch) | |
| tree | 4ddd61bc1d3a4cd9502cc0bf076c06bd06c93075 | |
| parent | 2aafe8087c996eda241abf47ca03283ee6d9f5a3 (diff) | |
| download | emacs-b9173dc296f964cab904fc5eae02344e1b59eed2.tar.gz emacs-b9173dc296f964cab904fc5eae02344e1b59eed2.zip | |
* nsfont.m (ns_descriptor_to_entity): Handle case when descriptor has no family set. (nsfont_open): Handle case when entity has no family.
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/nsfont.m | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 989831d6763..a33144b7a33 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2009-08-02 Adrian Robert <Adrian.B.Robert@gmail.com> | ||
| 2 | |||
| 3 | * nsfont.m (ns_descriptor_to_entity): Handle case when descriptor has | ||
| 4 | no family set. | ||
| 5 | (nsfont_open): Handle case when entity has no family. | ||
| 6 | |||
| 1 | 2009-07-29 Adrian Robert <Adrian.B.Robert@gmail.com> | 7 | 2009-07-29 Adrian Robert <Adrian.B.Robert@gmail.com> |
| 2 | 8 | ||
| 3 | * nsfont.m (ns_findfonts): Fix 2009-07-24 change to return only one | 9 | * nsfont.m (ns_findfonts): Fix 2009-07-24 change to return only one |
diff --git a/src/nsfont.m b/src/nsfont.m index a4c4444069b..46c50aa96d3 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -166,9 +166,16 @@ ns_descriptor_to_entity (NSFontDescriptor *desc, Lisp_Object extra, char *style) | |||
| 166 | Lisp_Object font_entity = font_make_entity (); | 166 | Lisp_Object font_entity = font_make_entity (); |
| 167 | /* NSString *psName = [desc postscriptName]; */ | 167 | /* NSString *psName = [desc postscriptName]; */ |
| 168 | NSString *family = [desc objectForKey: NSFontFamilyAttribute]; | 168 | NSString *family = [desc objectForKey: NSFontFamilyAttribute]; |
| 169 | char *escapedFamily = strdup ([family UTF8String]); | ||
| 170 | unsigned int traits = [desc symbolicTraits]; | 169 | unsigned int traits = [desc symbolicTraits]; |
| 170 | char *escapedFamily; | ||
| 171 | 171 | ||
| 172 | /* Shouldn't happen, but on Tiger fallback desc gets name but no family. */ | ||
| 173 | if (family == nil) | ||
| 174 | family = [desc objectForKey: NSFontNameAttribute]; | ||
| 175 | if (family == nil) | ||
| 176 | family = [[NSFont userFixedPitchFontOfSize: 0] familyName]; | ||
| 177 | |||
| 178 | escapedFamily = strdup ([family UTF8String]); | ||
| 172 | ns_escape_name (escapedFamily); | 179 | ns_escape_name (escapedFamily); |
| 173 | 180 | ||
| 174 | ASET (font_entity, FONT_TYPE_INDEX, Qns); | 181 | ASET (font_entity, FONT_TYPE_INDEX, Qns); |
| @@ -669,6 +676,8 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 669 | synthItal = !NILP (tem) && !strncmp ("synthItal", SDATA (SYMBOL_NAME (tem)), | 676 | synthItal = !NILP (tem) && !strncmp ("synthItal", SDATA (SYMBOL_NAME (tem)), |
| 670 | 9); | 677 | 9); |
| 671 | family = ns_get_family (font_entity); | 678 | family = ns_get_family (font_entity); |
| 679 | if (family == nil) | ||
| 680 | family = [[NSFont userFixedPitchFontOfSize: 0] familyName]; | ||
| 672 | /* Should be > 0.23 as some font descriptors (e.g. Terminus) set to that | 681 | /* Should be > 0.23 as some font descriptors (e.g. Terminus) set to that |
| 673 | when setting family in ns_spec_to_descriptor(). */ | 682 | when setting family in ns_spec_to_descriptor(). */ |
| 674 | if (ns_attribute_fvalue (fontDesc, NSFontWeightTrait) > 0.50) | 683 | if (ns_attribute_fvalue (fontDesc, NSFontWeightTrait) > 0.50) |