[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Mac OS Italic and Bold Font Display/Hollow Boxes Bug Fix
From: |
Andrew Choi |
Subject: |
Mac OS Italic and Bold Font Display/Hollow Boxes Bug Fix |
Date: |
Mon, 27 May 2002 17:32:19 -0600 |
Hi Everyone,
The following patch (to be applied to the version in the CVS
repository) fixes a bug which prevents Emacs from correctly displaying
the italic, bold, and bold-italic variants of most fonts on the Mac OS
(classic and X).
Please test it. I'll check it into the CVS once I have used it a bit
more.
Andrew.
-----
Index: lisp/term/mac-win.el
===================================================================
RCS file: /cvsroot/emacs//emacs/lisp/term/mac-win.el,v
retrieving revision 1.8
diff -u -r1.8 mac-win.el
--- lisp/term/mac-win.el 26 Apr 2002 23:39:04 -0000 1.8
+++ lisp/term/mac-win.el 27 May 2002 22:59:32 -0000
@@ -225,6 +225,12 @@
;; ange-ftp will not work without it.
(setq process-connection-type nil)
+;; Assume that fonts are always scalable on the Mac. This sometimes
+;; results in characters with jagged edges. However, without it,
+;; fonts with both truetype and bitmap representations but no italic
+;; or bold bitmap versions will not display these variants correctly.
+(setq scalable-fonts-allowed t)
+
;; (prefer-coding-system 'mac-roman)
;;
Index: src/fontset.c
===================================================================
RCS file: /cvsroot/emacs//emacs/src/fontset.c,v
retrieving revision 1.67
diff -u -r1.67 fontset.c
--- src/fontset.c 20 May 2002 08:05:48 -0000 1.67
+++ src/fontset.c 27 May 2002 22:59:34 -0000
@@ -1413,7 +1413,7 @@
#if defined (MAC_OS)
FONTSET_ASCII (Vdefault_fontset)
= Fcons (make_number (0),
- build_string ("-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1"));
+ build_string
("-apple-monaco-medium-r-*--*-120-*-*-*-*-mac-roman"));
#elif defined (WINDOWSNT)
FONTSET_ASCII (Vdefault_fontset)
= Fcons (make_number (0),
Index: src/macfns.c
===================================================================
RCS file: /cvsroot/emacs//emacs/src/macfns.c,v
retrieving revision 1.3
diff -u -r1.3 macfns.c
--- src/macfns.c 20 May 2002 08:06:16 -0000 1.3
+++ src/macfns.c 27 May 2002 22:59:43 -0000
@@ -4434,7 +4434,7 @@
}
#endif /* 0 */
- error ("Display has an unknown visual class");
+ return (intern ("true-color"));
}
DEFUN ("x-display-save-under", Fx_display_save_under,
Index: src/macterm.c
===================================================================
RCS file: /cvsroot/emacs//emacs/src/macterm.c,v
retrieving revision 1.3
diff -u -r1.3 macterm.c
--- src/macterm.c 8 May 2002 21:30:03 -0000 1.3
+++ src/macterm.c 27 May 2002 22:59:54 -0000
@@ -9559,6 +9559,13 @@
/* Now make the frame display the given font. */
if (FRAME_MAC_WINDOW (f) != 0)
{
+ XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->normal_gc,
+ f->output_data.mac->font);
+ XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->reverse_gc,
+ f->output_data.mac->font);
+ XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->cursor_gc,
+ f->output_data.mac->font);
+
frame_update_line_height (f);
if (NILP (tip_frame) || XFRAME (tip_frame) != f)
x_set_window_size (f, 0, f->width, f->height);
@@ -10651,10 +10658,30 @@
}
-/* Sets up the table font_name_table to contain the list of all
- monospace fonts in the system the first time the table is used so
- that the Resource Manager need not be accessed every time this
- information is needed. */
+static void
+add_font_name_table_entry (char *font_name)
+{
+ if (font_name_table_size == 0)
+ {
+ font_name_table_size = 16;
+ font_name_table = (char **)
+ xmalloc (font_name_table_size * sizeof (char *));
+ }
+ else if (font_name_count + 1 >= font_name_table_size)
+ {
+ font_name_table_size += 16;
+ font_name_table = (char **)
+ xrealloc (font_name_table,
+ font_name_table_size * sizeof (char *));
+ }
+
+ font_name_table[font_name_count++] = font_name;
+}
+
+/* Sets up the table font_name_table to contain the list of all fonts
+ in the system the first time the table is used so that the Resource
+ Manager need not be accessed every time this information is
+ needed. */
static void
init_font_name_table ()
@@ -10700,23 +10727,21 @@
while (FMGetNextFontFamilyInstance (&ffii, &font, &style, &size)
== noErr)
- {
- if (font_name_table_size == 0)
- {
- font_name_table_size = 16;
- font_name_table = (char **)
- xmalloc (font_name_table_size * sizeof (char *));
- }
- else if (font_name_count + 1 >= font_name_table_size)
- {
- font_name_table_size += 16;
- font_name_table = (char **)
- xrealloc (font_name_table,
- font_name_table_size * sizeof (char *));
- }
- font_name_table[font_name_count++]
- = mac_to_x_fontname (name, size, style, sc);
- }
+ if (size == 0)
+ {
+ add_font_name_table_entry (mac_to_x_fontname (name, size,
+ style, sc));
+ add_font_name_table_entry (mac_to_x_fontname (name, size,
+ italic, sc));
+ add_font_name_table_entry (mac_to_x_fontname (name, size,
+ bold, sc));
+ add_font_name_table_entry (mac_to_x_fontname (name, size,
+ italic | bold,
+ sc));
+ }
+ else
+ add_font_name_table_entry (mac_to_x_fontname (name, size, style,
+ sc));
}
/* Dispose of the iterators. */
Index: src/xfaces.c
===================================================================
RCS file: /cvsroot/emacs//emacs/src/xfaces.c,v
retrieving revision 1.253
diff -u -r1.253 xfaces.c
--- src/xfaces.c 20 May 2002 08:06:45 -0000 1.253
+++ src/xfaces.c 27 May 2002 22:59:59 -0000
@@ -918,6 +918,9 @@
#ifdef WINDOWSNT
if (!FRAME_WINDOW_P (f) || FRAME_W32_WINDOW (f))
#endif
+#ifdef MAC_OS
+ if (!FRAME_MAC_P (f) || FRAME_MAC_WINDOW (f))
+#endif
if (!realize_basic_faces (f))
abort ();
}
@@ -6026,6 +6029,17 @@
if (STRINGP (face_family))
nfonts = try_alternative_families (f, face_family, registry, fonts);
+#ifdef MAC_OS
+ /* When realizing the default face and a font spec does not matched
+ exactly, Emacs looks for ones with the same registry as the
+ default font. On the Mac, this is mac-roman, which does not work
+ if the family is -etl-fixed, e.g. The following widens the
+ choices and fixes that problem. */
+ if (nfonts == 0 && STRINGP (face_family) && STRINGP (registry)
+ && xstricmp (XSTRING (registry)->data, "mac-roman") == 0)
+ nfonts = try_alternative_families (f, face_family, Qnil, fonts);
+#endif
+
if (nfonts == 0 && !NILP (family))
nfonts = try_alternative_families (f, family, registry, fonts);
@@ -6432,18 +6446,6 @@
fontset = default_face->fontset;
face->fontset = make_fontset_for_ascii_face (f, fontset);
face->font = NULL; /* to force realize_face to load font */
-
-#ifdef MAC_OS
- /* Load the font if it is specified in ATTRS. This fixes
- changing frame font on the Mac. */
- if (STRINGP (attrs[LFACE_FONT_INDEX]))
- {
- struct font_info *font_info =
- FS_LOAD_FONT (f, 0, XSTRING (attrs[LFACE_FONT_INDEX])->data, -1);
- if (font_info)
- face->font = font_info->font;
- }
-#endif
}
/* Load colors, and set remaining attributes. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Mac OS Italic and Bold Font Display/Hollow Boxes Bug Fix,
Andrew Choi <=