From: Han-Wen Nienhuys Date: Sun, 20 Feb 2005 17:51:07 +0000 (+0000) Subject: * lily/pfb.cc (LY_DEFINE): ly:ttf->pfa, new function. X-Git-Tag: release/2.5.14~121 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6e9040684ec18353e138194d7a1d557acf791748;p=lilypond.git * lily/pfb.cc (LY_DEFINE): ly:ttf->pfa, new function. * THANKS: add Steve D --- diff --git a/ChangeLog b/ChangeLog index ed5f2de7b4..2c67c691b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2005-02-20 Han-Wen Nienhuys + + * lily/pfb.cc (LY_DEFINE): ly:ttf->pfa, new function. + + * THANKS: add Steve D + + * ttftool/*.c: add TTF -> Type42 conversion library. + +2005-02-20 Tatsuya Ono + + * mf/parmesan-heads.mf: "0harmonic" -> "s0harmonic" + to show harmonic notes + * scm/define-markup-commands.scm: in \markup-by-number + "dots-dot" -> "dots.dot" to show dotted notes + +2005-02-20 Han-Wen Nienhuys + + * flower/include/memory-stream.hh (class Memory_out_stream): new file. + + * flower/memory-stream.cc (writer): new file. + + * configure.in: add endian test. + 2005-02-19 Jürgen Reuter * Documentation/user/examples.itely: small diff --git a/Documentation/user/lilypond-book.itely b/Documentation/user/lilypond-book.itely index f2eba932e2..6b49e68dcf 100644 --- a/Documentation/user/lilypond-book.itely +++ b/Documentation/user/lilypond-book.itely @@ -239,18 +239,18 @@ defined by the user. @cindex fetachar To include feta symbols (such as flat, segno, etc) in a LaTeX -document, use @code{\input{titledefs} +document, use @code{\input@{titledefs@}} @example -\documentclass[a4paper]{article} +\documentclass[a4paper]@{article@} -\input{titledefs} +\input@{titledefs@} -\begin{document} +\begin@{document@} \fetachar\fetasharp -\end{document} +\end@{document@} @end example The font symbol names are defined in the file feta20.tex; to find diff --git a/Documentation/user/notation.itely b/Documentation/user/notation.itely index 95cdceb774..564169a733 100644 --- a/Documentation/user/notation.itely +++ b/Documentation/user/notation.itely @@ -5431,7 +5431,7 @@ key. For example, when entering music for a B-flat trumpet which begins on concert D, one would write @example -\transpose c bes { e4 @dots{} } +\transpose c bes @{ e4 @dots{} @} @end example To print this music in B-flat again (ie producing a trumpet part, @@ -5439,7 +5439,7 @@ instead of a concert pitch conductor's score) you would wrap the existing music with another @code{transpose} @example -\transpose bes c { \transpose c bes { e4 @dots{} } } +\transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @} @end example @@ -5472,7 +5472,7 @@ The transposition is entered after the keyword @code{\transposition} This command sets the property @code{instrumentTransposition}. The value of this property is used for MIDI output and quotations. It does not affect how notes are printed in the current staff. To change the printed -output, see @ref{transpose}. +output, see @ref{Transpose}. The pitch to use for @code{\transposition} should correspond to the transposition of the notes. For example, when entering a score in diff --git a/GNUmakefile.in b/GNUmakefile.in index 881fb2c692..be27d48200 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -10,7 +10,7 @@ depth = . # SUBDIRS = buildscripts python scripts \ elisp \ - flower lily \ + flower ttftool lily \ mf ly tex ps scm \ po make \ cygwin debian stepmake \ diff --git a/THANKS b/THANKS index bbae33962f..8201418494 100644 --- a/THANKS +++ b/THANKS @@ -11,21 +11,23 @@ Graham Percival - Documentation Editor CONTRIBUTORS +Andreas Scherer +Arno Waschk Bertalan Fodor +Carl Sorensen Christian Hitz Erlend Aasland -Arno Waschk -Carl Sorensen Heikki Junes -Werner Lemberg -Andreas Scherer +Juergen Reuter +Mats Bengtsson Nicolas Sceaux Tatsuya Ono -Mats Bengtsson +Werner Lemberg SPONSORS Jonathan Walther +Steve Doonan BUG HUNTERS/SUGGESTIONS diff --git a/configure.in b/configure.in index d2b8289cad..8959d684e7 100644 --- a/configure.in +++ b/configure.in @@ -19,6 +19,12 @@ AC_CONFIG_SRCDIR([lily/main.cc]) # Move to aclocal.m4? AC_CONFIG_HEADER([$CONFIGFILE.hh:config.hh.in]) +AC_C_BIGENDIAN(CFLAGS="$CFLAGS -DBIGENDIAN", + CFLAGS="$CFLAGS -DSMALLENDIAN") + + + + # Uncomment the configuration options your package needs. diff --git a/flower/include/memory-stream.hh b/flower/include/memory-stream.hh new file mode 100644 index 0000000000..822c4470d2 --- /dev/null +++ b/flower/include/memory-stream.hh @@ -0,0 +1,44 @@ +/* + memory-stream.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 2005 Han-Wen Nienhuys + +*/ + +#ifndef MEMORY_STREAM_HH +#define MEMORY_STREAM_HH + +#include +#include + + +/* + TODO: read support as well. + */ +class Memory_out_stream +{ + char *buffer_; + ssize_t size_; + int buffer_blocks_; + FILE *file_; + + static cookie_io_functions_t functions_; + static const int block_size_; + + static ssize_t reader (void*, char*, size_t); + static ssize_t writer (void*, const char*, size_t); + static int seeker (void*, off64_t *, int whence); + static int cleaner (void*); + + +public: + ~Memory_out_stream (); + Memory_out_stream (); + FILE *get_file () const; + char const *get_string() const; + ssize_t get_length () const; +}; + +#endif /* MEMORY_STREAM_HH */ diff --git a/flower/memory-stream.cc b/flower/memory-stream.cc new file mode 100644 index 0000000000..d73e808ee2 --- /dev/null +++ b/flower/memory-stream.cc @@ -0,0 +1,116 @@ +/* + memory-stream.cc -- implement Memory_out_stream + + source file of the GNU LilyPond music typesetter + + (c) 2005 Han-Wen Nienhuys + +*/ + +#include +#include +#include +#include +#include "memory-stream.hh" + +const int Memory_out_stream::block_size_ = 1024; + +cookie_io_functions_t +Memory_out_stream::functions_ = { + Memory_out_stream::reader, + Memory_out_stream::writer, + Memory_out_stream::seeker, + Memory_out_stream::cleaner +}; + +int +Memory_out_stream::cleaner (void *cookie) +{ + Memory_out_stream *stream = (Memory_out_stream*) cookie; + + stream->file_ = 0; + return 0; +} + +Memory_out_stream::Memory_out_stream () +{ + size_ = 0; + buffer_ = 0; + buffer_blocks_ = 0; + file_ = fopencookie ((void*) this, "w", functions_); +} + +Memory_out_stream::~Memory_out_stream() +{ + if (file_) + fclose (file_); + + free (buffer_); +} + +FILE* +Memory_out_stream::get_file () const +{ + return file_; +} + +ssize_t +Memory_out_stream::get_length () const +{ + return size_; +} + +const char * +Memory_out_stream::get_string () const +{ + return buffer_; +} + + +ssize_t +Memory_out_stream::writer (void *cookie, + const char *buffer, + size_t size) +{ + Memory_out_stream * stream = (Memory_out_stream*) cookie; + + ssize_t newsize = stream->size_ + size; + + bool change = false; + while (newsize > stream->buffer_blocks_ * block_size_) + { + stream->buffer_blocks_ *= 2; + stream->buffer_blocks_ += 1; + change = true; + } + + if (change) + stream->buffer_ = (char*) realloc (stream->buffer_, stream->buffer_blocks_ * block_size_); + + memcpy (stream->buffer_ + stream->size_, buffer, size); + stream->size_ = newsize; + + return size; +} + + +ssize_t +Memory_out_stream::reader (void *cookie, + char *buffer, + size_t size) +{ + (void) cookie; + (void) buffer; + (void) size; + + assert (false); +} + + +int +Memory_out_stream::seeker (void*, off64_t *, int whence) +{ + assert (false); + (void)whence; + return 0; +} diff --git a/input/regression/utf8.ly b/input/regression/utf8.ly index 89e5f76d50..4bb9a5802e 100644 --- a/input/regression/utf8.ly +++ b/input/regression/utf8.ly @@ -31,8 +31,8 @@ will render Japanese, Hebrew and Cyrillic. japanese = \lyricsto "melody" \new Lyrics { いろはにほへど ちりぬるを - わがよたれぞ つねならむ - うゐのおくやまけふこえて + わがよたれぞ つねならむ + うゐのおくや まけふこえて あさきゆめみじ ゑひもせず } @@ -59,6 +59,6 @@ hebrew = \lyricsto "melody" \new Lyrics { %% no support for TTF yet. -% \japanese + \japanese >> diff --git a/lily/GNUmakefile b/lily/GNUmakefile index 24c14b1ec8..e5c1fccb02 100644 --- a/lily/GNUmakefile +++ b/lily/GNUmakefile @@ -4,8 +4,8 @@ depth = .. NAME = lilypond SUBDIRS = include -MODULE_LIBS=$(depth)/flower -MODULE_INCLUDES= $(depth)/flower/include +MODULE_LIBS=$(depth)/flower $(depth)/ttftool +MODULE_INCLUDES= $(depth)/flower/include $(depth)/ttftool/include MODULE_CXXFLAGS= diff --git a/lily/pfb.cc b/lily/pfb.cc index e35bc01b2f..5ca2341a11 100644 --- a/lily/pfb.cc +++ b/lily/pfb.cc @@ -12,6 +12,8 @@ #include #include "source-file.hh" +#include "memory-stream.hh" +#include "ttftool.h" char * pfb2pfa (Byte const * pfb, int length) @@ -22,7 +24,7 @@ pfb2pfa (Byte const * pfb, int length) Byte const * p = pfb; while (p < pfb + length) { - if (*p++ != 128) + if (*p++ != 128) break; Byte type = *p++; @@ -86,4 +88,26 @@ LY_DEFINE(ly_pfb_to_pfa, "ly:pfb->pfa", delete str; return pfa_scm; } + + +LY_DEFINE(ly_ttf_to_pfa, "ly:ttf->pfa", + 1, 0, 0, (SCM ttf_path), + "Convert the contents of a TTF file to Type42 PFA, returning it as " + " a string." + ) +{ + SCM_ASSERT_TYPE(scm_is_string (ttf_path), ttf_path, + SCM_ARG1, __FUNCTION__, "string"); + + String path = ly_scm2string (ttf_path); + + Memory_out_stream stream; + create_type42(path.to_str0 (), + stream.get_file()); + SCM asscm = scm_from_locale_stringn (stream.get_string (), + stream.get_length ()); + + return asscm; +} + diff --git a/mf/parmesan-heads.mf b/mf/parmesan-heads.mf index a61c8e1159..095c4c9c0f 100644 --- a/mf/parmesan-heads.mf +++ b/mf/parmesan-heads.mf @@ -189,7 +189,7 @@ fet_endchar; % fet_beginchar("Harmonic notehead (Neo-mensural open)", - "0harmonic") + "s0harmonic") draw_neomensural_open_head (1.3 staff_space#, 1.3 noteheight#); charwx := head_width#; diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index b6425764ec..9492d14b27 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -487,7 +487,7 @@ and/or @code{extra-offset} properties. " (cons (min stemy attachy) (max stemy attachy)) (/ stem-thickness 3)))) - (dot (ly:font-get-glyph font "dots-dot")) + (dot (ly:font-get-glyph font "dots.dot")) (dotwid (interval-length (ly:stencil-extent dot X))) (dots (and (> dot-count 0) (apply ly:stencil-add diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 1c26d8a863..b11aa79f66 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -228,9 +228,11 @@ (a-file-name (ly:kpathsea-find-file aname)) (b-file-name (ly:kpathsea-find-file bname))) (cond - (bare-file-name (if (string-match "\\.pfb" bare-file-name) - (ly:pfb->pfa bare-file-name) - (cached-file-contents bare-file-name))) + ((and bare-file-name (string-match "\\.pfb" bare-file-name)) + (ly:pfb->pfa bare-file-name)) + ((and bare-file-name (string-match "\\.ttf" bare-file-name)) + (ly:ttf->pfa bare-file-name)) + (bare-file-name (cached-file-contents bare-file-name)) (cff-file-name (cached-file-contents cff-file-name)) (a-file-name (ps-embed-pfa (cached-file-contents a-file-name) x 0)) (b-file-name (ps-embed-pfa (ly:pfb->pfa b-file-name) x 0))