1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-21 10:24:55 +00:00

* nsterm.m (EV_TRAILER): Always use emacsframe for frame_or_window. (ns_font_to_xlfd, ns_fontname_to_xlfd): Remove, unused.

This commit is contained in:
Adrian Robert 2009-01-21 18:56:41 +00:00
parent 193e68284e
commit 35ed44db5a
2 changed files with 9 additions and 73 deletions

View File

@ -1,3 +1,8 @@
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>
* nsmenu.m (NSMENUPROFILE): Change #if style.
@ -12,6 +17,7 @@
(EmacsPrefsController-setDefaultFont:,-setColors:): Raise the frame.
(EmacsPrefsController-setPanelFromDefaultValues) New function.
(EmacsPrefsController-resetToDefaults:): Use it. (Bug#1801)
(ns_font_to_xlfd, ns_fontname_to_xlfd): Remove, unused.
* nsimage.m (EmacsImage+allocInitFromFile:): Set to ignore DPI.
(Bug#1316)

View File

@ -289,8 +289,7 @@ the Function modifer (laptops). May be any of the modifier lisp symbols. */
methods. Maybe it should even be a function. */
#define EV_TRAILER(e) \
{ \
XSETFRAME (emacs_event->frame_or_window, [NSApp isActive] ? \
emacsframe : SELECTED_FRAME ()); \
XSETFRAME (emacs_event->frame_or_window, emacsframe); \
if (e) emacs_event->timestamp = EV_TIMESTAMP (e); \
n_emacs_events_pending++; \
kbd_buffer_store_event_hold (emacs_event, q_event_ptr); \
@ -6247,7 +6246,6 @@ - (IBAction)setDefaultFont: (id)sender
/* ==========================================================================
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.
/* XLFD: -foundry-family-weight-slant-swidth-adstyle-pxlsz-ptSz-resx-resy-spc-avgWidth-rgstry-encoding */
static const char *
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;
}
/* Note: ns_font_to_xlfd and ns_fontname_to_xlfd no longer needed, removed
in 1.43. */
const char *
ns_xlfd_to_fontname (const char *xlfd)