aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrian Robert2009-01-21 18:56:41 +0000
committerAdrian Robert2009-01-21 18:56:41 +0000
commit35ed44db5ac5780d77e50c38c8ac0ec3b6e34dc3 (patch)
tree14f328e17d294d89e8d31897fd36a79811d1e398 /src
parent193e68284e7ba177fdfe991cf22aceb23a6ebe91 (diff)
downloademacs-35ed44db5ac5780d77e50c38c8ac0ec3b6e34dc3.tar.gz
emacs-35ed44db5ac5780d77e50c38c8ac0ec3b6e34dc3.zip
* nsterm.m (EV_TRAILER): Always use emacsframe for frame_or_window. (ns_font_to_xlfd, ns_fontname_to_xlfd): Remove, unused.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/nsterm.m76
2 files changed, 9 insertions, 73 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b4378a7cbc2..c250ead9cc4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12009-01-21 Wolfgang Lux <wolfgang.lux@gmail.com> (tiny change)
2
3 * nsterm.m (EV_TRAILER): Always use emacsframe for frame_or_window.
4
5
12009-01-21 Adrian Robert <Adrian.B.Robert@gmail.com> 62009-01-21 Adrian Robert <Adrian.B.Robert@gmail.com>
2 7
3 * nsmenu.m (NSMENUPROFILE): Change #if style. 8 * nsmenu.m (NSMENUPROFILE): Change #if style.
@@ -12,6 +17,7 @@
12 (EmacsPrefsController-setDefaultFont:,-setColors:): Raise the frame. 17 (EmacsPrefsController-setDefaultFont:,-setColors:): Raise the frame.
13 (EmacsPrefsController-setPanelFromDefaultValues) New function. 18 (EmacsPrefsController-setPanelFromDefaultValues) New function.
14 (EmacsPrefsController-resetToDefaults:): Use it. (Bug#1801) 19 (EmacsPrefsController-resetToDefaults:): Use it. (Bug#1801)
20 (ns_font_to_xlfd, ns_fontname_to_xlfd): Remove, unused.
15 21
16 * nsimage.m (EmacsImage+allocInitFromFile:): Set to ignore DPI. 22 * nsimage.m (EmacsImage+allocInitFromFile:): Set to ignore DPI.
17 (Bug#1316) 23 (Bug#1316)
diff --git a/src/nsterm.m b/src/nsterm.m
index a8b185b538b..fba0e726e47 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -289,8 +289,7 @@ static BOOL inNsSelect = 0;
289 methods. Maybe it should even be a function. */ 289 methods. Maybe it should even be a function. */
290#define EV_TRAILER(e) \ 290#define EV_TRAILER(e) \
291 { \ 291 { \
292 XSETFRAME (emacs_event->frame_or_window, [NSApp isActive] ? \ 292 XSETFRAME (emacs_event->frame_or_window, emacsframe); \
293 emacsframe : SELECTED_FRAME ()); \
294 if (e) emacs_event->timestamp = EV_TIMESTAMP (e); \ 293 if (e) emacs_event->timestamp = EV_TIMESTAMP (e); \
295 n_emacs_events_pending++; \ 294 n_emacs_events_pending++; \
296 kbd_buffer_store_event_hold (emacs_event, q_event_ptr); \ 295 kbd_buffer_store_event_hold (emacs_event, q_event_ptr); \
@@ -6247,7 +6246,6 @@ static void selectItemWithTag (NSPopUpButton *popup, int tag)
6247/* ========================================================================== 6246/* ==========================================================================
6248 6247
6249 Font-related functions; these used to be in nsfaces.m 6248 Font-related functions; these used to be in nsfaces.m
6250 The XLFD functions (115 lines) are an abomination that should be removed.
6251 6249
6252 ========================================================================== */ 6250 ========================================================================== */
6253 6251
@@ -6297,76 +6295,8 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
6297 6295
6298 6296
6299/* XLFD: -foundry-family-weight-slant-swidth-adstyle-pxlsz-ptSz-resx-resy-spc-avgWidth-rgstry-encoding */ 6297/* XLFD: -foundry-family-weight-slant-swidth-adstyle-pxlsz-ptSz-resx-resy-spc-avgWidth-rgstry-encoding */
6300 6298/* Note: ns_font_to_xlfd and ns_fontname_to_xlfd no longer needed, removed
6301static const char * 6299 in 1.43. */
6302ns_font_to_xlfd (NSFont *nsfont)
6303/* --------------------------------------------------------------------------
6304 Convert an NS font name to an X font name (XLFD).
6305 The string returned is temporarily allocated.
6306 -------------------------------------------------------------------------- */
6307{
6308 NSFontManager *mgr = [NSFontManager sharedFontManager];
6309 NSString *sname = [nsfont /*familyName*/fontName];
6310 char *famName = (char *)[sname UTF8String];
6311 char *weightStr = [mgr fontNamed: sname hasTraits: NSBoldFontMask] ?
6312 "bold" : "medium";
6313 char *slantStr = [mgr fontNamed: sname hasTraits: NSItalicFontMask] ?
6314 "i" : "r";
6315 int size = [nsfont pointSize];
6316 int aWidth = lrint (10.0 * [nsfont widthOfString: @"a"]);
6317 const char *xlfd;
6318 int i, len;
6319
6320 /* change '-' to '$' to avoid messing w/XLFD separator */
6321 for (len = strlen (famName), i =0; i<len; i++)
6322 if (famName[i] == '-')
6323 {
6324 famName[i] = '\0';
6325 break;
6326 }
6327
6328 xlfd = [[NSString stringWithFormat:
6329 @"-apple-%s-%s-%s-normal--%d-%d-75-75-m-%d-iso10646-1",
6330 famName, weightStr, slantStr, size, 10*size, aWidth]
6331 UTF8String];
6332/*fprintf (stderr, "converted '%s' to '%s'\n",name,xlfd); */
6333 return xlfd;
6334}
6335
6336static const char *
6337ns_fontname_to_xlfd (const char *name)
6338/* --------------------------------------------------------------------------
6339 Convert an NS font name to an X font name (XLFD).
6340 Sizes are set to 0.
6341 The string returned is temporarily allocated.
6342 -------------------------------------------------------------------------- */
6343{
6344 char famName[180];
6345 char *weightStr = strcasestr (name, "bold") ? "bold" : "medium";
6346 char *slantStr = strcasestr (name, "italic") || strcasestr (name, "oblique")
6347 || strcasestr (name, "synthital") ? "i" : "r";
6348 int i, len;
6349 const char *xlfd;
6350
6351 /* change '-' to '$' to avoid messing w/XLFD separator, and ' ' to '_' */
6352 bzero (famName, 180);
6353 bcopy (name, famName, max (strlen (name), 179));
6354 for (len =strlen (famName), i =0; i<len; i++)
6355 {
6356 if (famName[i] == '-')
6357 famName[i] = '$';
6358 else if (famName[i] == ' ')
6359 famName[i] = '_';
6360 }
6361
6362 xlfd = [[NSString stringWithFormat:
6363 @"-apple-%s-%s-%s-normal--0-0-75-75-m-0-iso10646-1",
6364 famName, weightStr, slantStr]
6365 UTF8String];
6366/*fprintf (stderr, "converted '%s' to '%s'\n",name,xlfd); */
6367 return xlfd;
6368}
6369
6370 6300
6371const char * 6301const char *
6372ns_xlfd_to_fontname (const char *xlfd) 6302ns_xlfd_to_fontname (const char *xlfd)