Commit 35ed44db authored by Adrian Robert's avatar Adrian Robert
Browse files

* nsterm.m (EV_TRAILER): Always use emacsframe for frame_or_window. ...

* nsterm.m (EV_TRAILER): Always use emacsframe for frame_or_window.  (ns_font_to_xlfd, ns_fontname_to_xlfd): Remove, unused.
parent 193e6828
2009-01-21 Wolfgang Lux <wolfgang.lux@gmail.com> (tiny change)
* nsterm.m (EV_TRAILER): Always use emacsframe for frame_or_window.
2009-01-21 Adrian Robert <Adrian.B.Robert@gmail.com> 2009-01-21 Adrian Robert <Adrian.B.Robert@gmail.com>
* nsmenu.m (NSMENUPROFILE): Change #if style. * nsmenu.m (NSMENUPROFILE): Change #if style.
...@@ -12,6 +17,7 @@ ...@@ -12,6 +17,7 @@
(EmacsPrefsController-setDefaultFont:,-setColors:): Raise the frame. (EmacsPrefsController-setDefaultFont:,-setColors:): Raise the frame.
(EmacsPrefsController-setPanelFromDefaultValues) New function. (EmacsPrefsController-setPanelFromDefaultValues) New function.
(EmacsPrefsController-resetToDefaults:): Use it. (Bug#1801) (EmacsPrefsController-resetToDefaults:): Use it. (Bug#1801)
(ns_font_to_xlfd, ns_fontname_to_xlfd): Remove, unused.
* nsimage.m (EmacsImage+allocInitFromFile:): Set to ignore DPI. * nsimage.m (EmacsImage+allocInitFromFile:): Set to ignore DPI.
(Bug#1316) (Bug#1316)
......
...@@ -289,8 +289,7 @@ the Function modifer (laptops). May be any of the modifier lisp symbols. */ ...@@ -289,8 +289,7 @@ the Function modifer (laptops). May be any of the modifier lisp symbols. */
methods. Maybe it should even be a function. */ methods. Maybe it should even be a function. */
#define EV_TRAILER(e) \ #define EV_TRAILER(e) \
{ \ { \
XSETFRAME (emacs_event->frame_or_window, [NSApp isActive] ? \ XSETFRAME (emacs_event->frame_or_window, emacsframe); \
emacsframe : SELECTED_FRAME ()); \
if (e) emacs_event->timestamp = EV_TIMESTAMP (e); \ if (e) emacs_event->timestamp = EV_TIMESTAMP (e); \
n_emacs_events_pending++; \ n_emacs_events_pending++; \
kbd_buffer_store_event_hold (emacs_event, q_event_ptr); \ kbd_buffer_store_event_hold (emacs_event, q_event_ptr); \
...@@ -6247,7 +6246,6 @@ - (IBAction)setDefaultFont: (id)sender ...@@ -6247,7 +6246,6 @@ - (IBAction)setDefaultFont: (id)sender
/* ========================================================================== /* ==========================================================================
Font-related functions; these used to be in nsfaces.m Font-related functions; these used to be in nsfaces.m
The XLFD functions (115 lines) are an abomination that should be removed.
========================================================================== */ ========================================================================== */
...@@ -6297,76 +6295,8 @@ The XLFD functions (115 lines) are an abomination that should be removed. ...@@ -6297,76 +6295,8 @@ The XLFD functions (115 lines) are an abomination that should be removed.
/* XLFD: -foundry-family-weight-slant-swidth-adstyle-pxlsz-ptSz-resx-resy-spc-avgWidth-rgstry-encoding */ /* XLFD: -foundry-family-weight-slant-swidth-adstyle-pxlsz-ptSz-resx-resy-spc-avgWidth-rgstry-encoding */
/* Note: ns_font_to_xlfd and ns_fontname_to_xlfd no longer needed, removed
static const char * in 1.43. */
ns_font_to_xlfd (NSFont *nsfont)
/* --------------------------------------------------------------------------
Convert an NS font name to an X font name (XLFD).
The string returned is temporarily allocated.
-------------------------------------------------------------------------- */
{
NSFontManager *mgr = [NSFontManager sharedFontManager];
NSString *sname = [nsfont /*familyName*/fontName];
char *famName = (char *)[sname UTF8String];
char *weightStr = [mgr fontNamed: sname hasTraits: NSBoldFontMask] ?
"bold" : "medium";
char *slantStr = [mgr fontNamed: sname hasTraits: NSItalicFontMask] ?
"i" : "r";
int size = [nsfont pointSize];
int aWidth = lrint (10.0 * [nsfont widthOfString: @"a"]);
const char *xlfd;
int i, len;
/* change '-' to '$' to avoid messing w/XLFD separator */
for (len = strlen (famName), i =0; i<len; i++)
if (famName[i] == '-')
{
famName[i] = '\0';
break;
}
xlfd = [[NSString stringWithFormat:
@"-apple-%s-%s-%s-normal--%d-%d-75-75-m-%d-iso10646-1",
famName, weightStr, slantStr, size, 10*size, aWidth]
UTF8String];
/*fprintf (stderr, "converted '%s' to '%s'\n",name,xlfd); */
return xlfd;
}
static const char *
ns_fontname_to_xlfd (const char *name)
/* --------------------------------------------------------------------------
Convert an NS font name to an X font name (XLFD).
Sizes are set to 0.
The string returned is temporarily allocated.
-------------------------------------------------------------------------- */
{
char famName[180];
char *weightStr = strcasestr (name, "bold") ? "bold" : "medium";
char *slantStr = strcasestr (name, "italic") || strcasestr (name, "oblique")
|| strcasestr (name, "synthital") ? "i" : "r";
int i, len;
const char *xlfd;
/* change '-' to '$' to avoid messing w/XLFD separator, and ' ' to '_' */
bzero (famName, 180);
bcopy (name, famName, max (strlen (name), 179));
for (len =strlen (famName), i =0; i<len; i++)
{
if (famName[i] == '-')
famName[i] = '$';
else if (famName[i] == ' ')
famName[i] = '_';
}
xlfd = [[NSString stringWithFormat:
@"-apple-%s-%s-%s-normal--0-0-75-75-m-0-iso10646-1",
famName, weightStr, slantStr]
UTF8String];
/*fprintf (stderr, "converted '%s' to '%s'\n",name,xlfd); */
return xlfd;
}
const char * const char *
ns_xlfd_to_fontname (const char *xlfd) ns_xlfd_to_fontname (const char *xlfd)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment