Skip to content

Instantly share code, notes, and snippets.

@nobu
Created April 19, 2009 15:31
Show Gist options
  • Save nobu/98102 to your computer and use it in GitHub Desktop.
Save nobu/98102 to your computer and use it in GitHub Desktop.
--- src/nsfont.m~ 2007-11-14 03:56:17.000000000 +0900
+++ src/nsfont.m 2009-04-20 00:04:13.000000000 +0900
@@ -167,5 +167,5 @@ nsfont_fmember_to_entity (NSString *fami
// NSString *psName = [famMember objectAtIndex: 0];
NSMutableString *suffix = [[famMember objectAtIndex: 1] mutableCopy];
- char *escapedFamily = [family UTF8String];
+ char *escapedFamily = strdup ([family UTF8String]);
nsfont_escape_name(escapedFamily);
@@ -178,4 +178,5 @@ nsfont_fmember_to_entity (NSString *fami
ASET (font_entity, FONT_ADSTYLE_INDEX, intern([suffix UTF8String]));
ASET (font_entity, FONT_REGISTRY_INDEX, Qiso10646_1);
+ free (escapedFamily);
ASET (font_entity, FONT_WEIGHT_INDEX, traits & NSBoldFontMask ?
@@ -881,4 +882,5 @@ nsfont_draw (struct glyph_string *s, int
for (i=0; i<s->nchars - s->gidx; i++, t++)
{
+ struct font_metrics *mp;
hi = (*t & 0xFF00) >> 8;
lo = *t & 0x00FF;
@@ -887,7 +889,11 @@ nsfont_draw (struct glyph_string *s, int
cwidth = s->cmp->offsets[s->gidx++ * 2] - twidth;
}
+ else if (mp = font->metrics[hi])
+ {
+ cwidth = mp[lo].width;
+ }
else
{
- cwidth = font->metrics[hi][lo].width;
+ cwidth = 0;
}
twidth += cwidth;
@@ -1192,5 +1198,5 @@ void nsfont_make_fontset_for_font(Lisp_O
- char *family = [[cfont familyName] UTF8String];
+ char *family = strdup ([[cfont familyName] UTF8String]);
Lisp_Object famAndReg;
@@ -1203,4 +1209,5 @@ void nsfont_make_fontset_for_font(Lisp_O
Fset_fontset_font (name, scripts[i], famAndReg, Qnil, Qnil);
+ free(family);
}
}
--- nsfns.m~ 2007-11-19 04:45:33.000000000 +0900
+++ nsfns.m 2009-04-20 01:31:18.000000000 +0900
@@ -227,4 +227,6 @@ ns_get_screen(Lisp_Object anythingUnderT
} else if (STRINGP(anythingUnderTheSun)) { // FIXME/cl for multi-display
+ } else {
+ return NULL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment