X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Ftext-interface.cc;h=c406beaab5436a9a053883651ff02d1b5364ed87;hb=4024156d2ebb9d7b5caf34dde98afca000d4b296;hp=2bb4545a2067b4529567b419e78f8b585a5f1d8b;hpb=d199c2786d16e1fc00bd17fd9b1a54a8312e2079;p=lilypond.git diff --git a/lily/text-interface.cc b/lily/text-interface.cc index 2bb4545a20..c406beaab5 100644 --- a/lily/text-interface.cc +++ b/lily/text-interface.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 1998--2011 Han-Wen Nienhuys + Copyright (C) 1998--2012 Han-Wen Nienhuys Jan Nieuwenhuizen LilyPond is free software: you can redistribute it and/or modify @@ -19,7 +19,9 @@ */ #include "text-interface.hh" +#include "skyline-pair.hh" +#include "lookup.hh" #include "config.hh" #include "font-interface.hh" #include "grob.hh" @@ -50,15 +52,15 @@ replace_special_characters (string &str, SCM props) { /* Don't match in mid-UTF-8 */ if ((str[i] & 0xc0) == 0x80) - continue; + continue; for (vsize j = max_length + 1; j--;) { - if (j > str.size () - i) - continue; + if (j > str.size () - i) + continue; string dummy = str.substr (i, j); SCM ligature = ly_assoc_get (ly_string2scm (dummy), - replacement_alist, SCM_BOOL_F); - if (scm_is_true (ligature)) + replacement_alist, SCM_BOOL_F); + if (scm_is_true (ligature)) str.replace (i, j, robust_scm2string (ligature, "")); } } @@ -107,12 +109,10 @@ Text_interface::interpret_markup (SCM layout_smob, SCM props, SCM markup) { if (scm_is_string (markup)) return interpret_string (layout_smob, props, markup); - else if (scm_is_pair (markup)) + else if (is_markup (markup)) { SCM func = scm_car (markup); SCM args = scm_cdr (markup); - if (!is_markup (markup)) - programming_error ("markup head has no markup signature"); /* Use a hare/tortoise algorithm to detect whether we are in a cycle, * i.e. whether we have already encountered the same markup in the @@ -151,7 +151,7 @@ Text_interface::interpret_markup (SCM layout_smob, SCM props, SCM markup) } else { - programming_error ("Object is not a markup. "); + programming_error ("Object is not a markup."); scm_puts ("This object should be a markup: ", scm_current_error_port ()); scm_display (markup, scm_current_error_port ()); scm_puts ("\n", scm_current_error_port ()); @@ -175,11 +175,14 @@ Text_interface::print (SCM grob) bool Text_interface::is_markup (SCM x) { - return (scm_is_string (x) - || (scm_is_pair (x) - && SCM_BOOL_F - != scm_object_property (scm_car (x), - ly_symbol2scm ("markup-signature")))); + return scm_is_string (x) + || (scm_is_pair (x) + && scm_is_true + (scm_object_property (scm_car (x), + ly_symbol2scm ("markup-signature"))) + && scm_is_false + (scm_object_property (scm_car (x), + ly_symbol2scm ("markup-list-command")))); } bool