User: eric
Date: 05/02/11 16:39:12
Modified: xemacs/src Tag: sjt-xft ChangeLog xft-fonts.c xft-fonts.h
Log:
encode fontconfig property and fontnames as Qnative
Revision Changes Path
No revision
No revision
1.758.2.7 +9 -0 XEmacs/xemacs/src/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.758.2.6
retrieving revision 1.758.2.7
diff -u -r1.758.2.6 -r1.758.2.7
--- ChangeLog 2005/02/09 12:53:01 1.758.2.6
+++ ChangeLog 2005/02/11 15:39:04 1.758.2.7
@@ -1,3 +1,12 @@
+2005-02-11 Eric Knauel <eric(a)xemacs.org>
+
+ * xft-fonts.h: New prototype
+
+ * xft-fonts.c (Ffc_name_parse, Ffc_pattern_add, Ffc_pattern_del)
+ (Ffc_pattern_get, fc_font_real_pattern)
+ (string_list_to_fcobjectset): Use extract_fcapi_string()
+ (extract_fcapi_string): New function
+
2005-02-09 Eric Knauel <eric(a)xemacs.org>
* xft-fonts.c (string_list_to_fcobjectset): Use loop macro instead
1.1.2.5 +24 -10 XEmacs/xemacs/src/Attic/xft-fonts.c
Index: xft-fonts.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/Attic/xft-fonts.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- xft-fonts.c 2005/02/09 12:53:04 1.1.2.4
+++ xft-fonts.c 2005/02/11 15:39:07 1.1.2.5
@@ -139,7 +139,7 @@
CHECK_STRING(name);
- fcpat->fcpatPtr = FcNameParse(XSTRING_DATA(name));
+ fcpat->fcpatPtr = FcNameParse (extract_fcapi_string (name));
fcpat->fontset = Qnil;
return wrap_fcpattern(fcpat);
}
@@ -186,14 +186,14 @@
if (STRINGP(value))
{
res = FcPatternAddString (XFCPATTERN_PTR(fcpat),
- XSTRING_DATA(object),
- (FcChar8 *) XSTRING_DATA(value));
+ extract_fcapi_string (object),
+ (FcChar8 *) extract_fcapi_string (value));
return res ? Qt : Qnil;
}
if (INTP(value))
{
res = FcPatternAddInteger (XFCPATTERN_PTR(fcpat),
- XSTRING_DATA(object),
+ extract_fcapi_string (object),
XINT(value));
return res ? Qt : Qnil;
}
@@ -201,7 +201,7 @@
if (FLOATP(value))
{
res = FcPatternAddDouble (XFCPATTERN_PTR(fcpat),
- XSTRING_DATA(object),
+ extract_fcapi_string (object),
(double) XFLOAT_DATA(value));
return res ? Qt : Qnil;
}
@@ -209,7 +209,7 @@
if (SYMBOLP(value))
{
res = FcPatternAddBool (XFCPATTERN_PTR(fcpat),
- XSTRING_DATA(object),
+ extract_fcapi_string (object),
!NILP(value));
return res ? Qt : Qnil;
}
@@ -227,7 +227,8 @@
CHECK_FCPATTERN(fcpat);
CHECK_STRING(object);
- res = FcPatternDel(XFCPATTERN_PTR(fcpat), XSTRING_DATA(object));
+ res = FcPatternDel(XFCPATTERN_PTR(fcpat),
+ extract_fcapi_string (object));
return res ? Qt : Qnil;
}
@@ -326,7 +327,7 @@
if (STRINGP (property))
{
/* #### need to Mule-ize */
- fc_property = (FcChar8 *) XSTRING_DATA (property);
+ fc_property = (FcChar8 *) extract_fcapi_string (property);
}
else
{
@@ -840,7 +841,7 @@
dpy = DEVICE_X_DISPLAY (XDEVICE (xdevice));
font = XftFontOpenName (dpy, DefaultScreen(dpy),
- XSTRING_DATA(fontname));
+ extract_fcapi_string (fontname));
if (font == NULL)
return Qnil;
copy = FcPatternDuplicate(font->pattern);
@@ -1006,8 +1007,21 @@
EXTERNAL_LIST_LOOP_2 (elt, list)
{
CHECK_STRING (elt);
- FcObjectSetAdd (os, XSTRING_DATA (elt));
+ FcObjectSetAdd (os, extract_fcapi_string (elt));
}
+}
+
+/*
+ extract the C representation of the Lisp string STR and convert it
+ to the encoding used by the Fontconfig API for property and font
+ names. I suppose that Qnative is the right encoding, the manual
+ doesn't say much about this topic. This functions assumes that STR
+ is a Lisp string.
+*/
+inline static char *
+extract_fcapi_string (Lisp_Object str)
+{
+ return NEW_LISP_STRING_TO_EXTERNAL (str, Qnative);
}
void
1.1.2.4 +3 -0 XEmacs/xemacs/src/Attic/xft-fonts.h
Index: xft-fonts.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/Attic/xft-fonts.h,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- xft-fonts.h 2005/02/04 16:05:38 1.1.2.3
+++ xft-fonts.h 2005/02/11 15:39:08 1.1.2.4
@@ -93,4 +93,7 @@
static void
string_list_to_fcobjectset (Lisp_Object, FcObjectSet*);
+inline static char *
+extract_fcapi_string (Lisp_Object str);
+
#endif /* INCLUDED_xft_fonts_h_ */