source file of the GNU LilyPond music typesetter
- (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
#include "lily-guile.hh"
-#include "string.hh"
+#include "string-convert.hh"
+#include "warn.hh"
#include <fontconfig/fontconfig.h>
-void
+string
display_fontset (FcFontSet *fs)
{
+ string retval;
+
int j;
for (j = 0; j < fs->nfont; j++)
{
font = FcNameUnparse (fs->fonts[j]);
if (FcPatternGetString (fs->fonts[j], FC_FILE, 0, &str) == FcResultMatch)
- printf ("FILE %s\n", str);
+ retval += String_convert::form_string ("FILE %s\n", str);
if (FcPatternGetString (fs->fonts[j], FC_FAMILY, 0, &str) == FcResultMatch)
- printf ("family %s\n ", str);
+ retval += String_convert::form_string ("family %s\n ", str);
if (FcPatternGetString (fs->fonts[j],
"designsize", 0, &str) == FcResultMatch)
- printf ("designsize %s\n ", str);
+ retval += String_convert::form_string ("designsize %s\n ", str);
- printf ("%s\n", (const char*) font);
+ retval += String_convert::form_string ("%s\n", (const char*) font);
free (font);
}
+
+ return retval;
}
-void
+string
display_strlist (char const*what, FcStrList *slist)
{
+ string retval;
while (FcChar8 *dir = FcStrListNext (slist))
{
- printf("%s: %s\n", what, dir);
+ retval += String_convert::form_string ("%s: %s\n", what, dir);
}
+ return retval;
}
-void
+string
display_config (FcConfig *fcc)
{
- display_strlist ("Config files", FcConfigGetConfigFiles(fcc));
- display_strlist ("Config dir", FcConfigGetConfigDirs(fcc));
- display_strlist ("Font dir", FcConfigGetFontDirs(fcc));
+ string retval;
+ retval += display_strlist ("Config files", FcConfigGetConfigFiles(fcc));
+ retval += display_strlist ("Config dir", FcConfigGetConfigDirs(fcc));
+ retval += display_strlist ("Font dir", FcConfigGetFontDirs(fcc));
+ return retval;
}
-void
+string
display_list (FcConfig *fcc)
{
FcPattern*pat = FcPatternCreate ();
if (pat)
FcPatternDestroy (pat);
+ string retval;
if (fs)
{
- display_fontset (fs);
+ retval = display_fontset (fs);
FcFontSetDestroy (fs);
}
+ return retval;
}
FcValue val;
val.type = FcTypeString;
- val.u.s = (const FcChar8*)ly_scm2string (name).to_str0 (); // FC_SLANT_ITALIC;
+ val.u.s = (const FcChar8*)ly_scm2string (name).c_str (); // FC_SLANT_ITALIC;
FcPatternAdd(pat, FC_FAMILY, val, FcFalse);
FcResult result;
pat = FcFontMatch(NULL, pat, &result);
FcChar8 *str = 0;
if (FcPatternGetString (pat, FC_FILE, 0, &str) == FcResultMatch)
- scm_result = scm_makfrom0str ((char const*) str);
+ scm_result = scm_from_locale_string ((char const*) str);
FcPatternDestroy (pat);
(),
"Dump a list of all fonts visible to FontConfig.")
{
- display_list (NULL);
- display_config (NULL);
+ string str = display_list (NULL);
+ str += display_config (NULL);
+
+ progress_indication (str);
return SCM_UNSPECIFIED;
}