Mercurial > emacs
changeset 104123:132eb17eec1d
* nsfont.m (ns_descriptor_to_entity): Handle case when descriptor has no family set. (nsfont_open): Handle case when entity has no family.
author | Adrian Robert <Adrian.B.Robert@gmail.com> |
---|---|
date | Sun, 02 Aug 2009 15:37:07 +0000 |
parents | 9fb3df55079f |
children | 05be2b60df7a |
files | src/ChangeLog src/nsfont.m |
diffstat | 2 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Sun Aug 02 14:56:04 2009 +0000 +++ b/src/ChangeLog Sun Aug 02 15:37:07 2009 +0000 @@ -1,3 +1,9 @@ +2009-08-02 Adrian Robert <Adrian.B.Robert@gmail.com> + + * nsfont.m (ns_descriptor_to_entity): Handle case when descriptor has + no family set. + (nsfont_open): Handle case when entity has no family. + 2009-07-29 Adrian Robert <Adrian.B.Robert@gmail.com> * nsfont.m (ns_findfonts): Fix 2009-07-24 change to return only one
--- a/src/nsfont.m Sun Aug 02 14:56:04 2009 +0000 +++ b/src/nsfont.m Sun Aug 02 15:37:07 2009 +0000 @@ -166,9 +166,16 @@ Lisp_Object font_entity = font_make_entity (); /* NSString *psName = [desc postscriptName]; */ NSString *family = [desc objectForKey: NSFontFamilyAttribute]; - char *escapedFamily = strdup ([family UTF8String]); unsigned int traits = [desc symbolicTraits]; + char *escapedFamily; + /* Shouldn't happen, but on Tiger fallback desc gets name but no family. */ + if (family == nil) + family = [desc objectForKey: NSFontNameAttribute]; + if (family == nil) + family = [[NSFont userFixedPitchFontOfSize: 0] familyName]; + + escapedFamily = strdup ([family UTF8String]); ns_escape_name (escapedFamily); ASET (font_entity, FONT_TYPE_INDEX, Qns); @@ -669,6 +676,8 @@ synthItal = !NILP (tem) && !strncmp ("synthItal", SDATA (SYMBOL_NAME (tem)), 9); family = ns_get_family (font_entity); + if (family == nil) + family = [[NSFont userFixedPitchFontOfSize: 0] familyName]; /* Should be > 0.23 as some font descriptors (e.g. Terminus) set to that when setting family in ns_spec_to_descriptor(). */ if (ns_attribute_fvalue (fontDesc, NSFontWeightTrait) > 0.50)