X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Ffont-config-scheme.cc;h=a2bc3ae5d0f7111df71e39ff11cbbb3b05a827ff;hb=a6a51abfd0195a3cf7d6ea095cf69808852f21ce;hp=ce4525467a3a82297506708771999723af5e88e5;hpb=54ff8316fc7bb1b9494ca09e835f980a79db893a;p=lilypond.git diff --git a/lily/font-config-scheme.cc b/lily/font-config-scheme.cc index ce4525467a..a2bc3ae5d0 100644 --- a/lily/font-config-scheme.cc +++ b/lily/font-config-scheme.cc @@ -1,10 +1,20 @@ /* - font-config-scheme.cc -- implement FontConfig bindings. + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2005--2015 Han-Wen Nienhuys - (c) 2005--2008 Han-Wen Nienhuys + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "lily-guile.hh" @@ -28,12 +38,14 @@ display_fontset (FcFontSet *fs) font = FcNameUnparse (fs->fonts[j]); if (FcPatternGetString (fs->fonts[j], FC_FILE, 0, &str) == FcResultMatch) - retval += String_convert::form_string ("FILE %s\n", str); + retval += String_convert::form_string ("FILE %s\n", str); + if (FcPatternGetString (fs->fonts[j], FC_INDEX, 0, &str) == FcResultMatch) + retval += String_convert::form_string ("INDEX %s\n", str); if (FcPatternGetString (fs->fonts[j], FC_FAMILY, 0, &str) == FcResultMatch) - retval += String_convert::form_string ("family %s\n ", str); + retval += String_convert::form_string ("family %s\n ", str); if (FcPatternGetString (fs->fonts[j], - "designsize", 0, &str) == FcResultMatch) - retval += String_convert::form_string ("designsize %s\n ", str); + "designsize", 0, &str) == FcResultMatch) + retval += String_convert::form_string ("designsize %s\n ", str); retval += String_convert::form_string ("%s\n", (const char *)font); free (font); @@ -86,10 +98,9 @@ display_list (FcConfig *fcc) return retval; } - LY_DEFINE (ly_font_config_get_font_file, "ly:font-config-get-font-file", 1, 0, 0, - (SCM name), - "Get the file for font @var{name}.") + (SCM name), + "Get the file for font @var{name}.") { LY_ASSERT_TYPE (scm_is_string, name, 1); @@ -109,16 +120,16 @@ LY_DEFINE (ly_font_config_get_font_file, "ly:font-config-get-font-file", 1, 0, 0 pat = FcFontMatch (NULL, pat, &result); FcChar8 *str = 0; if (FcPatternGetString (pat, FC_FILE, 0, &str) == FcResultMatch) - scm_result = scm_from_locale_string ((char const *)str); + scm_result = scm_from_utf8_string ((char const *)str); FcPatternDestroy (pat); return scm_result; } - + LY_DEFINE (ly_font_config_display_fonts, "ly:font-config-display-fonts", 0, 0, 0, - (), - "Dump a list of all fonts visible to FontConfig.") + (), + "Dump a list of all fonts visible to FontConfig.") { string str = display_list (NULL); str += display_config (NULL); @@ -129,8 +140,8 @@ LY_DEFINE (ly_font_config_display_fonts, "ly:font-config-display-fonts", 0, 0, 0 } LY_DEFINE (ly_font_config_add_directory, "ly:font-config-add-directory", 1, 0, 0, - (SCM dir), - "Add directory @var{dir} to FontConfig.") + (SCM dir), + "Add directory @var{dir} to FontConfig.") { LY_ASSERT_TYPE (scm_is_string, dir, 1); @@ -138,15 +149,15 @@ LY_DEFINE (ly_font_config_add_directory, "ly:font-config-add-directory", 1, 0, 0 if (!FcConfigAppFontAddDir (0, (const FcChar8 *)d.c_str ())) error (_f ("failed adding font directory: %s", d.c_str ())); - else if (be_verbose_global) - message (_f ("adding font directory: %s", d.c_str ())); + else + debug_output (_f ("Adding font directory: %s", d.c_str ())); return SCM_UNSPECIFIED; } LY_DEFINE (ly_font_config_add_font, "ly:font-config-add-font", 1, 0, 0, - (SCM font), - "Add font @var{font} to FontConfig.") + (SCM font), + "Add font @var{font} to FontConfig.") { LY_ASSERT_TYPE (scm_is_string, font, 1); @@ -154,8 +165,8 @@ LY_DEFINE (ly_font_config_add_font, "ly:font-config-add-font", 1, 0, 0, if (!FcConfigAppFontAddFile (0, (const FcChar8 *)f.c_str ())) error (_f ("failed adding font file: %s", f.c_str ())); - else if (be_verbose_global) - message (_f ("adding font file: %s", f.c_str ())); + else + debug_output (_f ("Adding font file: %s", f.c_str ())); return SCM_UNSPECIFIED; }