[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100110: Fix handling of font prop
From: |
Juanma Barranquero |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100110: Fix handling of font properties on Windows (bug#6303). |
Date: |
Wed, 13 Oct 2010 16:07:28 +0200 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 100110
author: Damyan Pepper <address@hidden>
committer: Juanma Barranquero <address@hidden>
branch nick: emacs-23
timestamp: Wed 2010-10-13 16:07:28 +0200
message:
Fix handling of font properties on Windows (bug#6303).
* src/font.c (font_filter_properties): New function, refactored from
ftfont_filter_properties.
* src/font.h (font_filter_properties): Declare.
* src/ftfont.c (ftfont_filter_properties): Use font_filter_properties.
* src/w32font.c (w32font_booleans, w32font_non_booleans): New variables.
(w32font_filter_properties): New function.
(w32font_driver): Add w32font_filter_properties.
modified:
src/ChangeLog
src/font.c
src/font.h
src/ftfont.c
src/w32font.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2010-10-12 23:25:19 +0000
+++ b/src/ChangeLog 2010-10-13 14:07:28 +0000
@@ -1,3 +1,14 @@
+2010-10-13 Damyan Pepper <address@hidden>
+
+ Fix handling of font properties on Windows (bug#6303).
+ * font.c (font_filter_properties): New function, refactored from
+ ftfont_filter_properties.
+ * font.h (font_filter_properties): Declare.
+ * ftfont.c (ftfont_filter_properties): Use font_filter_properties.
+ * w32font.c (w32font_booleans, w32font_non_booleans): New variables.
+ (w32font_filter_properties): New function.
+ (w32font_driver): Add w32font_filter_properties.
+
2010-10-12 Juanma Barranquero <address@hidden>
* font.c (Ffont_variation_glyphs):
=== modified file 'src/font.c'
--- a/src/font.c 2010-10-12 23:25:19 +0000
+++ b/src/font.c 2010-10-13 14:07:28 +0000
@@ -3862,6 +3862,59 @@
}
+/* Sets attributes on a font. Any properties that appear in ALIST and
+ BOOLEAN_PROPERTIES or NON_BOOLEAN_PROPERTIES are set on the font.
+ BOOLEAN_PROPERTIES and NON_BOOLEAN_PROPERTIES are NULL-terminated
+ arrays of strings. This function is intended for use by the font
+ drivers to implement their specific font_filter_properties. */
+void
+font_filter_properties (font, alist, boolean_properties,
non_boolean_properties)
+ Lisp_Object font;
+ Lisp_Object alist;
+ const char *boolean_properties[];
+ const char *non_boolean_properties[];
+{
+ Lisp_Object it;
+ int i;
+
+ /* Set boolean values to Qt or Qnil */
+ for (i = 0; boolean_properties[i] != NULL; ++i)
+ for (it = alist; ! NILP (it); it = XCDR (it))
+ {
+ Lisp_Object key = XCAR (XCAR (it));
+ Lisp_Object val = XCDR (XCAR (it));
+ char *keystr = SDATA (SYMBOL_NAME (key));
+
+ if (strcmp (boolean_properties[i], keystr) == 0)
+ {
+ const char *str = INTEGERP (val) ? (XINT (val) ? "true" : "false")
+ : SYMBOLP (val) ? (const char *) SDATA (SYMBOL_NAME (val))
+ : "true";
+
+ if (strcmp ("false", str) == 0 || strcmp ("False", str) == 0
+ || strcmp ("FALSE", str) == 0 || strcmp ("FcFalse", str) == 0
+ || strcmp ("off", str) == 0 || strcmp ("OFF", str) == 0
+ || strcmp ("Off", str) == 0)
+ val = Qnil;
+ else
+ val = Qt;
+
+ Ffont_put (font, key, val);
+ }
+ }
+
+ for (i = 0; non_boolean_properties[i] != NULL; ++i)
+ for (it = alist; ! NILP (it); it = XCDR (it))
+ {
+ Lisp_Object key = XCAR (XCAR (it));
+ Lisp_Object val = XCDR (XCAR (it));
+ char *keystr = SDATA (SYMBOL_NAME (key));
+ if (strcmp (non_boolean_properties[i], keystr) == 0)
+ Ffont_put (font, key, val);
+ }
+}
+
+
/* Return the font used to draw character C by FACE at buffer position
POS in window W. If STRING is non-nil, it is a string containing C
at index POS. If C is negative, get C from the current buffer or
=== modified file 'src/font.h'
--- a/src/font.h 2010-10-12 15:16:57 +0000
+++ b/src/font.h 2010-10-13 14:07:28 +0000
@@ -814,6 +814,11 @@
extern void *font_get_frame_data P_ ((FRAME_PTR f,
struct font_driver *driver));
+extern void font_filter_properties (Lisp_Object font,
+ Lisp_Object alist,
+ const char *boolean_properties[],
+ const char *non_boolean_properties[]);
+
#ifdef HAVE_FREETYPE
extern struct font_driver ftfont_driver;
#endif /* HAVE_FREETYPE */
=== modified file 'src/ftfont.c'
--- a/src/ftfont.c 2010-06-30 14:22:18 +0000
+++ b/src/ftfont.c 2010-10-13 14:07:28 +0000
@@ -88,7 +88,7 @@
enum ftfont_cache_for));
static void ftfont_filter_properties P_ ((Lisp_Object font, Lisp_Object
alist));
-
+
Lisp_Object ftfont_font_format P_ ((FcPattern *, Lisp_Object));
#define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM))
@@ -264,7 +264,7 @@
else
{
/* As this font is not scalable, parhaps this is a BDF or PCF
- font. */
+ font. */
FT_Face ft_face;
ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p));
@@ -2113,7 +2113,7 @@
return to;
}
-static int
+static int
ftfont_try_otf (MFLTFont *font, MFLTOtfSpec *spec,
MFLTGlyphString *in, int from, int to)
{
@@ -2681,42 +2681,7 @@
Lisp_Object font;
Lisp_Object alist;
{
- Lisp_Object it;
- int i;
-
- /* Set boolean values to Qt or Qnil */
- for (i = 0; ftfont_booleans[i] != NULL; ++i)
- for (it = alist; ! NILP (it); it = XCDR (it))
- {
- Lisp_Object key = XCAR (XCAR (it));
- Lisp_Object val = XCDR (XCAR (it));
- char *keystr = SDATA (SYMBOL_NAME (key));
-
- if (strcmp (ftfont_booleans[i], keystr) == 0)
- {
- char *str = SYMBOLP (val) ? SDATA (SYMBOL_NAME (val)) : NULL;
- if (INTEGERP (val)) str = XINT (val) != 0 ? "true" : "false";
- if (str == NULL) str = "true";
-
- val = Qt;
- if (strcmp ("false", str) == 0 || strcmp ("False", str) == 0
- || strcmp ("FALSE", str) == 0 || strcmp ("FcFalse", str) == 0
- || strcmp ("off", str) == 0 || strcmp ("OFF", str) == 0
- || strcmp ("Off", str) == 0)
- val = Qnil;
- Ffont_put (font, key, val);
- }
- }
-
- for (i = 0; ftfont_non_booleans[i] != NULL; ++i)
- for (it = alist; ! NILP (it); it = XCDR (it))
- {
- Lisp_Object key = XCAR (XCAR (it));
- Lisp_Object val = XCDR (XCAR (it));
- char *keystr = SDATA (SYMBOL_NAME (key));
- if (strcmp (ftfont_non_booleans[i], keystr) == 0)
- Ffont_put (font, key, val);
- }
+ font_filter_properties (font, alist, ftfont_booleans, ftfont_non_booleans);
}
=== modified file 'src/w32font.c'
--- a/src/w32font.c 2010-10-12 15:16:57 +0000
+++ b/src/w32font.c 2010-10-13 14:07:28 +0000
@@ -2446,6 +2446,25 @@
return DECODE_SYSTEM (build_string (buf));
}
+static const char *w32font_booleans [] = {
+ NULL,
+};
+
+static const char *w32font_non_booleans [] = {
+ ":script",
+ ":antialias",
+ ":style",
+ NULL,
+};
+
+static void
+w32font_filter_properties (font, alist)
+ Lisp_Object font;
+ Lisp_Object alist;
+{
+ font_filter_properties (font, alist, w32font_booleans, w32font_non_booleans);
+}
+
struct font_driver w32font_driver =
{
0, /* Qgdi */
@@ -2475,7 +2494,7 @@
NULL, /* shape */
NULL, /* check */
NULL, /* get_variation_glyphs */
- NULL, /* filter_properties */
+ w32font_filter_properties,
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100110: Fix handling of font properties on Windows (bug#6303).,
Juanma Barranquero <=