+2005-04-13 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * ly/performer-init.ly: add CueVoice to MIDI too.
+
+ * ps/music-drawing-routines.ps: new routine BeginEPSF /
+ EndEPSF.
+
+ * input/regression/markup-eps.ly: new file.
+
+ * scm/framework-ps.scm (write-preamble): change order: vars should
+ be inited before procedures.
+
+ * scm/output-ps.scm (glyph-string): break lines. 255 chars is max
+ for EPS files.
+
+ * scm/define-markup-commands.scm (epsfile): add epsfile command.
+
+2005-04-12 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * configure.in (gui_b): add check for ghostscript 8.15
+
+2005-04-11 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * lily/hairpin.cc (after_line_breaking): suicide the hairpinlet at
+ start of line. Fixes cresc-after-newline.ly
+
+ * lily/source-file.cc (file_line_column_string): use get_column().
+
+2005-04-10 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * lily/source-file.cc (get_column): utf-8 support for column numbers.
+
2005-04-12 Jan Nieuwenhuizen <janneke@gnu.org>
* lily/*: use message () iso progress_indication () for messages.
* GNUmakefile.in: Bugfix: also link .map files.
+>>>>>>> 1.3423
2005-04-09 Nicolas Sceaux <nicolas.sceaux@free.fr>
* scm/music-functions.scm (music->make-music): generate
local-install:
$(INSTALL) -d $(DESTDIR)$(local_lilypond_datadir)
+final-install:
+ @true
+
web-ext = html midi pdf png txt ly
footify = $(PYTHON) $(step-bindir)/add-html-footer.py --name $(PACKAGE_NAME) --version $(TOPLEVEL_VERSION)
STEPMAKE_MAKEINFO(REQUIRED)
STEPMAKE_PYTHON_DEVEL(REQUIRED)
+STEPMAKE_PATH_PROG(GHOSTSCRIPT, gs, OPTIONAL, 8.15)
+
STEPMAKE_PROGS(MFTRACE, mftrace, REQUIRED, 1.1.1)
STEPMAKE_PATH_PROG(FONTFORGE, fontforge, REQUIRED, 20041208)
--- /dev/null
+\header {
+
+ texidoc = "The epsfile markup command reads an EPS file"
+
+}
+\version "2.5.19"
+
+#(let* ((port (open-output-file "box.eps")))
+
+ (display "%!PS-Adobe-3.0 EPSF-3.0
+%%BoundingBox: 5 5 105 105
+10 setlinewidth 10 10 moveto 0 90 rlineto 90 0 rlineto 0 -90 rlineto
+closepath stroke" port)
+
+ (close port))
+
+{ c''4-\markup { \box \epsfile #"box.eps" } }
--- /dev/null
+\version "2.5.10"
+
+%% Edit this file using a Unicode aware editor, such as GVIM, GEDIT, Emacs
+
+%{
+
+You may have to install additional fonts.
+
+Red Hat Fedora
+
+ taipeifonts fonts-xorg-truetype ttfonts-ja fonts-arabic \
+ ttfonts-zh_CN fonts-ja fonts-hebrew
+
+Debian GNU/Linux
+
+ apt-get install emacs-intl-fonts xfonts-intl-.* \
+ ttf-kochi-gothic ttf-kochi-mincho
+
+%}
+
+\header {
+
+ texidoc = "Various scripts may be used for texts (like titles and
+lyrics) introduced by entering them in UTF-8 encoding, and using a
+Pango based backend. Depending on the fonts installed, this fragment
+will render Japanese, Hebrew and Cyrillic.
+
+"
+
+}
+
+japanese = \lyricmode {
+ いろはにほへど ちりぬるを
+ わがよたれぞ つねならむ
+ うゐのおくや まけふこえて
+ あさきゆめみじ ゑひもせず
+ }
+
+
+bulgarian = \lyricmode {
+ Жълтата дюля беше щастлива, че пухът, който цъфна, замръзна като гьон.
+}
+
+hebrew = \lyricmode {
+ זה כיף סתם לשמוע איך תנצח קרפד עץ טוב בגן.
+}
+
+portuguese = \lyricmode {
+ à vo cê uma can ção legal
+}
+
+
+\relative {
+ c2 d e f g f e
+}
+\addlyrics { \hebrew }
+\addlyrics { \bulgarian }
+\addlyrics { \japanese }
+\addlyrics { \portuguese }
+++ /dev/null
-\version "2.5.10"
-
-%% Edit this file using a Unicode aware editor, such as GVIM, GEDIT, Emacs
-
-%{
-
-You may have to install additional fonts.
-
-Red Hat Fedora
-
- taipeifonts fonts-xorg-truetype ttfonts-ja fonts-arabic \
- ttfonts-zh_CN fonts-ja fonts-hebrew
-
-Debian GNU/Linux
-
- apt-get install emacs-intl-fonts xfonts-intl-.* \
- ttf-kochi-gothic ttf-kochi-mincho
-
-%}
-
-\header {
-
- texidoc = "Various scripts may be used for texts (like titles and
-lyrics) introduced by entering them in UTF-8 encoding, and using a
-Pango based backend. Depending on the fonts installed, this fragment
-will render Japanese, Hebrew and Cyrillic.
-
-"
-
-}
-
-japanese = \lyricmode {
- いろはにほへど ちりぬるを
- わがよたれぞ つねならむ
- うゐのおくや まけふこえて
- あさきゆめみじ ゑひもせず
- }
-
-
-bulgarian = \lyricmode {
- Жълтата дюля беше щастлива, че пухът, който цъфна, замръзна като гьон.
-}
-
-hebrew = \lyricmode {
- זה כיף סתם לשמוע איך תנצח קרפד עץ טוב בגן.
-}
-
-portuguese = \lyricmode {
- à vo cê uma can ção legal
-}
-
-
-\relative {
- c2 d e f g f e
-}
-\addlyrics { \hebrew }
-\addlyrics { \bulgarian }
-\addlyrics { \japanese }
-\addlyrics { \portuguese }
#include "lookup.hh"
#include "text-item.hh"
+
+MAKE_SCHEME_CALLBACK(Hairpin,after_line_breaking,1);
+SCM
+Hairpin::after_line_breaking (SCM smob)
+{
+ Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
+
+ Drul_array<bool> broken;
+ Drul_array<Item *> bounds;
+ Direction d = LEFT;
+ do
+ {
+ bounds[d] = me->get_bound (d);
+ broken[d] = bounds[d]->break_status_dir () != CENTER;
+ }
+ while (flip (&d) != LEFT);
+
+ if (broken[LEFT]
+ && ly_c_equal_p (bounds[RIGHT]->get_column ()->get_property ("when"),
+ bounds[LEFT]->get_property ("when")))
+ {
+ me->suicide ();
+ }
+ return SCM_UNSPECIFIED;
+}
+
+
MAKE_SCHEME_CALLBACK (Hairpin, print, 1);
SCM
Hairpin::print (SCM smob)
{
- Grob *me = unsmob_grob (smob);
- Spanner *spanner = dynamic_cast<Spanner *> (me);
+ Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
SCM s = me->get_property ("grow-direction");
if (!is_direction (s))
Direction d = LEFT;
do
{
- bounds[d] = spanner->get_bound (d);
+ bounds[d] = me->get_bound (d);
broken[d] = bounds[d]->break_status_dir () != CENTER;
}
while (flip (&d) != LEFT);
Grob *common = bounds[LEFT]->common_refpoint (bounds[RIGHT], X_AXIS);
Drul_array<Real> x_points;
-
+
do
{
Item *b = bounds[d];
{
public:
DECLARE_SCHEME_CALLBACK (print, (SCM));
+ DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
static bool has_interface (Grob *);
};
Slice line_slice (char const *pos_str0) const;
String line_string (char const *pos_str0) const;
int get_column (char const *pos_str0) const;
- int get_char (char const *pos_str0) const;
+ int get_char_of_line (char const *pos_str0) const;
/*
JUNKME.
#include "config.hh"
+#if HAVE_UTF8_WCHAR_H
+#include <utf8/wchar.h> /* wcrtomb */
+#else
+#include <wchar.h> /* wcrtomb */
+#endif
+
#include <cstdio>
+
#if HAVE_SSTREAM
#include <sstream>
#else
int
Source_file::tell () const
{
- return pos_str0_ - contents_str0_;
+ return pos_str0_ - contents_str0_;
}
std::istream*
return " (" + _ ("position unknown") + ")";
else
return name_string () + ":" + to_string (get_line (context_str0))
- + ":" + to_string (get_char (context_str0));
+ + ":" + to_string (get_column (context_str0));
}
String
}
int
-Source_file::get_char (char const *pos_str0) const
+Source_file::get_char_of_line (char const *pos_str0) const
{
if (!contains (pos_str0))
return 0;
if (!contains (pos_str0))
return 0;
- int ch_i = get_char (pos_str0);
- String line = line_string (pos_str0);
+ Slice line = line_slice (pos_str0);
+ char const *data = to_str0 ();
+ Byte const *line_start = (Byte const *)data + line[LEFT];
+
+ int left = (Byte const*) pos_str0 - line_start;
+ String line_begin (line_start, left);
+ char const *line_chars = line_begin.to_str0();
+
+ int column = 0;
+ mbstate_t state;
+
+ /* Initialize the state. */
+ memset (&state, '\0', sizeof (state));
- int col_i = 0;
- for (int i = 0; i < ch_i; i++)
- if (line[i] == '\t')
- col_i = (col_i / 8 + 1) * 8;
- else
- col_i++;
+ while (left > 0)
+ {
+ wchar_t multibyte[2];
+ size_t thislen = mbrtowc (multibyte, line_chars, left, &state);
+
+ /* Stop converting at invalid character;
+ this can mean we have read just the first part
+ of a valid character. */
+ if (thislen == (size_t) -1)
+ break;
+ /* We want to handle embedded NUL bytes
+ but the return value is 0. Correct this. */
+ if (thislen == 0)
+ thislen = 1;
+
+ if (thislen == 1 && line_chars[0] == '\t')
+ column = (column / 8 + 1) * 8;
+ else
+ column ++;
+
+ /* Advance past this character. */
+ line_chars += thislen;
+ left -= thislen;
+ }
- return col_i;
+ return column;
}
String
if (!contains (pos_str0))
return " (" + _ ("position unknown") + ")";
- int ch_i = get_char (pos_str0);
+ int ch_i = get_char_of_line (pos_str0);
String line = line_string (pos_str0);
String context = line.left_string (ch_i)
+ to_string ('\n')
\consists "Melisma_translator"
}
+\context {
+ \Voice
+ \name CueVoice
+ \alias Voice
+}
\context {
\Voice
/pdfmark where
{pop} {userdict /pdfmark /cleartomark load put} ifelse
+% from adobe tech note 5002.
+/BeginEPSF { %def
+ /b4_Inc_state save def % Save state for cleanup
+ /dict_count countdictstack def % Count objects on dict stack
+ /op_count count 1 sub def % Count objects on operand stack
+ userdict begin % Push userdict on dict stack
+ /showpage { } def % Redefine showpage, { } = null proc
+ 0 setgray 0 setlinecap % Prepare graphics state
+ 1 setlinewidth 0 setlinejoin
+ 10 setmiterlimit [ ] 0 setdash newpath
+ /languagelevel where % If level not equal to 1 then
+ {pop languagelevel % set strokeadjust and
+ 1 ne % overprint to their defaults.
+ {false setstrokeadjust false setoverprint
+ } if
+ } if
+} bind def
+
+/EndEPSF { %def
+ count op_count sub {pop} repeat % Clean up stacks
+ countdictstack dict_count sub {end} repeat
+ b4_Inc_state restore
+} bind def
% llx lly urx ury URI
/mark_URI
(Hairpin
. (
(print-function . ,Hairpin::print)
+ (after-line-breaking-callback . ,Hairpin::after_line_breaking)
(thickness . 1.0)
(height . 0.6666)
(spacing-procedure . ,Spanner::set_spacing_rods)
;;;; (c) 2000--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
;;;; Jan Nieuwenhuizen <janneke@gnu.org>
+
;;; markup commands
;;; * each markup function should have a doc string with
;; syntax, description and example.
(url-expr (list 'url-link url `(quote ,xextent) `(quote ,yextent))))
(ly:stencil-add (ly:make-stencil url-expr xextent yextent) stil)))
+
+(define bbox-regexp
+ (make-regexp "%%BoundingBox: ([0-9-]+) ([0-9-]+) ([0-9-]+) ([0-9-]+)"))
+
+(define (get-postscript-bbox string)
+ "Extract the bbox from STRING, or return #f if not present."
+ (let*
+ ((match (regexp-exec bbox-regexp string)))
+
+ (if match
+ (map (lambda (x)
+ (string->number (match:substring match x)))
+ (cdr (iota 5)))
+
+ #f)))
+
+(def-markup-command (epsfile layout props file-name) (string?)
+ "Inline an EPS image. The image is scaled such that 10 PS units is
+one staff-space."
+
+ (if (ly:get-option 'safe)
+ (interpret-markup layout props "not allowed in safe")
+ (let*
+ ((contents (ly:gulp-file file-name))
+ (bbox (get-postscript-bbox contents))
+ (scaled-bbox
+ (if bbox
+ (map (lambda (x) (/ x 10)) bbox)
+ (begin
+ (ly:warn (_ "Could not find bounding box of `~a'")
+ file-name)
+ '()))))
+
+
+ (if bbox
+
+ (ly:make-stencil
+ (list
+ 'embedded-ps
+ (string-append
+
+ ; adobe 5002.
+ "BeginEPSF "
+ "0.1 0.1 scale "
+ (format "\n%%BeginDocument: ~a\n" file-name)
+ contents
+ "%%EndDocument\n"
+ "EndEPSF\n"
+ ))
+ (cons (list-ref scaled-bbox 0) (list-ref scaled-bbox 2))
+ (cons (list-ref scaled-bbox 1) (list-ref scaled-bbox 3)))
+
+ (ly:make-stencil "" '(0 . 0) '(0 . 0))))))
+
(def-markup-command (score layout props score) (ly:score?)
"Inline an image of music."
(let* ((systems (ly:score-embedded-format score layout)))
"%%BeginSetup\n"
(define-fonts paper)
(output-variables paper)
- "init-lilypond-parameters\n"
"%%EndSetup\n"))
(define-public (munge-lily-font-name name)
(filter string? font-names))))
pfas))
- (display (procset "music-drawing-routines.ps") port)
- (display (procset "lilyponddefs.ps") port)
(if load-fonts?
(for-each (lambda (f) (display f port)) (load-fonts paper)))
- (display (setup paper) port))
+ (display (setup paper) port)
+
+ ; adobe note 5002: should initialize variables before loading routines.
+ (display (procset "music-drawing-routines.ps") port)
+ (display (procset "lilyponddefs.ps") port)
+ (display "init-lilypond-parameters\n" port)
+
+ )
(define-public (output-framework basename book scopes fields)
(let* ((filename (format "~a.ps" basename))
(if (and (= 0.0 x)
(= 0.0 y))
- (format #f " /~a glyphshow " g)
- (format #f " ~a ~a rmoveto /~a glyphshow "
+ (format #f " /~a glyphshow\n" g)
+ (format #f " ~a ~a rmoveto /~a glyphshow\n"
x y g))))
x-y-named-glyphs))
))