[Q] Re: [21.5] Implement FcConfig handling (95%)

Stephen J. Turnbull stephen at xemacs.org
Mon Apr 23 11:58:26 EDT 2007


Aidan Kehoe writes:

 >  Ar an cúigiú lá déag de mí Aibréan, scríobh Stephen J. Turnbull: 
 >  > +DEFUN("fc-config-up-to-date", Ffc_config_up_to_date, 1, 1, 0, /*
 >  > + -- Function: FcBool FcConfigUptoDate (FcConfig *config)
 >  > +     Checks all of the files related to 'config' and returns whether the
 >  > +     in-memory version is in sync
 >  > +  /* Yes, we need to do this check -- sheesh, Keith! */	\
 >  > +  if (!thing_list)					\
 >  > +    return Qnil;					\
 >  > +  while ((thing = FcStrListNext (thing_list)))		\
 >  > +    value = Fcons (build_fcapi_string (thing), value);	\
 >  > +  FcStrListDone (thing_list);				\
 >  > +  return value;						\
 >  > +  } while (0)
 > 
 > What happened there? Is reading from processes still losing data?

No, it's missing from my FCC of the patch.  I just started using
patcher again, maybe the back and forth between ChangeLogs and the
mail buffer confused me.  Here's the relevant code, containing two
full function definitions followed by a macro declaration:

+DEFUN("fc-config-up-to-date", Ffc_config_up_to_date, 1, 1, 0, /*
+ -- Function: FcBool FcConfigUptoDate (FcConfig *config)
+     Checks all of the files related to 'config' and returns whether the
+     in-memory version is in sync with the disk version. */
+      (config))
+{
+  CHECK_FCCONFIG (config);
+  return FcConfigUptoDate (XFCCONFIG_PTR (config)) == FcFalse ? Qnil : Qt;
+}
+
+DEFUN("fc-config-build-fonts", Ffc_config_build_fonts, 1, 1, 0, /*
+ -- Function: FcBool FcConfigBuildFonts (FcConfig *config)
+     Builds the set of available fonts for the given configuration.
+     Note that any changes to the configuration after this call have
+     indeterminate effects.  Returns FcFalse if this operation runs out
+     of memory.
+XEmacs: signal out-of-memory, or return nil on success. */
+      (config))
+{
+  CHECK_FCCONFIG (config);
+  if (FcConfigBuildFonts (XFCCONFIG_PTR (config)) == FcFalse)
+    out_of_memory ("FcConfigBuildFonts failed", config);
+  return Qnil;
+}
+
+/* Calls its argument on `config', which must be defined by the caller. */
+
+#define FCSTRLIST_TO_LISP_USING(source) do {			\
+  FcChar8 *thing;					\
+  FcStrList *thing_list;					\
+  Lisp_Object value = Qnil;				\
+  CHECK_FCCONFIG (config);				\
+  thing_list = source (XFCCONFIG_PTR(config));		\
+  /* Yes, we need to do this check -- sheesh, Keith! */	\
+  if (!thing_list)					\
+    return Qnil;					\
+  while ((thing = FcStrListNext (thing_list)))		\
+    value = Fcons (build_fcapi_string (thing), value);	\
+  FcStrListDone (thing_list);				\
+  return value;						\
+  } while (0)
+

Sorry for the confusion.

 >  > +  CHECK_STRING (file);
 >  > +  if (FcConfigAppFontAddFile
 >  > +      (XFCCONFIG_PTR (config),
 >  > +       /* #### FIXME! is this really Qnative? */
 > 
 > It appears to be--Google Code search is really useful for checking this,
 > http://www.google.com/codesearch . 

I'm not confident that we can't get hosed by LANG, etc.

 >  > +  lrecord_type_fc_config,
 > 
 > Should this be wrapped in an #ifdef FONTCONFIG_EXPOSE_CONFIG? But I suppose
 > that #define isn't available in lrecord.h.

It's not.  AFAIK unused enumerator constants are costless, and the
reason for the #ifdef is to mark the new code as much as because I
expect anyone to actually #undef it.  (If I did, I'd add a configure
option.)





More information about the XEmacs-Patches mailing list