1 ;;;; This file is part of LilyPond, the GNU music typesetter.
3 ;;;; Copyright (C) 2004--2015 Jan Nieuwenhuizen <janneke@gnu.org>
5 ;;;; LilyPond is free software: you can redistribute it and/or modify
6 ;;;; it under the terms of the GNU General Public License as published by
7 ;;;; the Free Software Foundation, either version 3 of the License, or
8 ;;;; (at your option) any later version.
10 ;;;; LilyPond is distributed in the hope that it will be useful,
11 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;;;; GNU General Public License for more details.
15 ;;;; You should have received a copy of the GNU General Public License
16 ;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
18 (define-public latin1-coding-vector
19 #(.notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
20 .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
21 .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
22 .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
24 space exclam quotedbl numbersign dollar percent ampersand quoteright
25 parenleft parenright asterisk plus comma hyphen period slash
26 zero one two three four five six seven
27 eight nine colon semicolon less equal greater question
32 X Y Z bracketleft backslash bracketright asciicircum underscore
34 `quoteleft a b c d e f g
37 x y z braceleft bar braceright asciitilde .notdef
39 .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
40 .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
41 dotlessi grave acute circumflex tilde macron breve dotaccent
42 dieresis .notdef ring cedilla .notdef hungarumlaut ogonek caron
44 space exclamdown cent sterling currency yen brokenbar section
45 dieresis copyright ordfeminine guillemotleft logicalnot hyphen registered macron
46 degree plusminus twosuperior threesuperior acute mu paragraph periodcentered
47 cedilla onesuperior ordmasculine guillemotright onequarter onehalf threequarters questiondown
49 Agrave Aacute Acircumflex Atilde Adieresis Aring AE Ccedilla
50 Egrave Eacute Ecircumflex Edieresis Igrave Iacute Icircumflex Idieresis
51 Eth Ntilde Ograve Oacute Ocircumflex Otilde Odieresis multiply
52 Oslash Ugrave Uacute Ucircumflex Udieresis Yacute Thorn germandbls
54 agrave aacute acircumflex atilde adieresis aring ae ccedilla
55 egrave eacute ecircumflex edieresis igrave iacute icircumflex idieresis
56 eth ntilde ograve oacute ocircumflex otilde odieresis divide
57 oslash ugrave uacute ucircumflex udieresis yacute thorn ydieresis))
60 (define-public (decode-byte-string str)
61 "Return vector of glyphname symbols that correspond to string,
62 assuming that @var{str} is byte-coded using latin-1 encoding."
64 (let* ((len (string-length str))
65 (output-vector (make-vector len '.notdef)))
68 ((>= idx len) output-vector)
69 (vector-set! output-vector idx
70 (vector-ref latin1-coding-vector
71 (char->integer (string-ref str idx)))))))