LEFT | RIGHT |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1998--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1998--2011 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 Jan Nieuwenhuizen <janneke@gnu.org> | 5 Jan Nieuwenhuizen <janneke@gnu.org> |
6 | 6 |
7 LilyPond is free software: you can redistribute it and/or modify | 7 LilyPond is free software: you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation, either version 3 of the License, or | 9 the Free Software Foundation, either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "program-option.hh" | 31 #include "program-option.hh" |
32 #include "international.hh" | 32 #include "international.hh" |
33 #include "warn.hh" | 33 #include "warn.hh" |
34 | 34 |
35 static void | 35 static void |
36 replace_special_characters (string *str, SCM props) | 36 replace_special_characters (string *str, SCM props) |
37 { | 37 { |
38 vsize i = 0; | 38 vsize i = 0; |
39 SCM replacement_alist = ly_chain_assoc_get (ly_symbol2scm ("replacement-alist"
), | 39 SCM replacement_alist = ly_chain_assoc_get (ly_symbol2scm ("replacement-alist"
), |
40 props, | 40 props, |
41 SCM_BOOL_F); | 41 SCM_EOL); |
42 | |
43 if (!ly_is_list (replacement_alist) | |
44 || scm_is_null (replacement_alist)) | |
45 return; | |
46 | 42 |
47 int max_length = 0; | 43 int max_length = 0; |
48 for (SCM s = replacement_alist; scm_is_pair (s); s = scm_cdr (s)) | 44 for (SCM s = replacement_alist; scm_is_pair (s); s = scm_cdr (s)) |
49 { | 45 { |
50 max_length = max (max_length, scm_to_int | 46 max_length = max (max_length, scm_to_int |
51 (scm_string_length (scm_caar (s)))); | 47 (scm_string_length (scm_caar (s)))); |
52 } | 48 } |
53 | 49 |
54 while (i <= str->size ()) | 50 while (i <= str->size ()) |
55 { | 51 { |
56 for (vsize j = max_length; j--;) | 52 for (vsize j = max_length + 1; j--;) |
57 { | 53 { |
58 string dummy = str->substr (i, j); | 54 string dummy = str->substr (i, j); |
59 string ligature = robust_scm2string | 55 string ligature = robust_scm2string |
60 (ly_assoc_get (ly_string2scm (dummy), | 56 (ly_assoc_get (ly_string2scm (dummy), |
61 replacement_alist, SCM_BOOL_F), ""); | 57 replacement_alist, SCM_BOOL_F), ""); |
62 if (ligature != "") | 58 if (ligature != "") |
63 str->replace (i, j, ligature); | 59 str->replace (i, j, ligature); |
64 } | 60 } |
65 i += utf8_char_len ((*str)[i]); | 61 i += utf8_char_len ((*str)[i]); |
66 } | 62 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 " @code{ly:text-interface::interpret-markup}.", | 197 " @code{ly:text-interface::interpret-markup}.", |
202 | 198 |
203 /* properties */ | 199 /* properties */ |
204 "baseline-skip " | 200 "baseline-skip " |
205 "replacement-alist " | 201 "replacement-alist " |
206 "text " | 202 "text " |
207 "word-space " | 203 "word-space " |
208 "text-direction " | 204 "text-direction " |
209 ); | 205 ); |
210 | 206 |
LEFT | RIGHT |