CVSROOT: /cvsroot/lilypond
Module name: lilypond
Branch:
Changes by: Han-Wen Nienhuys <[EMAIL PROTECTED]> 05/05/08 13:17:15
Modified files:
. : ChangeLog lexer-gcc-3.1.sh
lily : open-type-font.cc pfb.cc
lily/include : open-type-font.hh
scm : framework-ps.scm
Log message:
* scm/framework-ps.scm (write-preamble): embed CFFs if file name
matches .otf
* lily/pfb.cc (Module): new function ly:otf->cff
* lily/open-type-font.cc (get_otf_table): use ::get_otf_table
(get_otf_table): new function.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3562&tr2=1.3563&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lexer-gcc-3.1.sh.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/open-type-font.cc.diff?tr1=1.37&tr2=1.38&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/pfb.cc.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/open-type-font.hh.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/framework-ps.scm.diff?tr1=1.97&tr2=1.98&r1=text&r2=text
Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3562 lilypond/ChangeLog:1.3563
--- lilypond/ChangeLog:1.3562 Fri May 6 17:23:28 2005
+++ lilypond/ChangeLog Sun May 8 13:17:15 2005
@@ -1,3 +1,18 @@
+2005-05-08 Han-Wen Nienhuys <[EMAIL PROTECTED]>
+
+ * scm/framework-ps.scm (write-preamble): embed CFFs if file name
+ matches .otf
+
+ * lily/pfb.cc (Module): new function ly:otf->cff
+
+ * lily/open-type-font.cc (get_otf_table): use ::get_otf_table
+ (get_otf_table): new function.
+
+2005-05-07 Han-Wen Nienhuys <[EMAIL PROTECTED]>
+
+ * scm/backend-library.scm (postscript->png): call lilypond-ps2png
+ iso. ps2png.
+
2005-05-06 Heikki Junes <[EMAIL PROTECTED]>
* po/fi.po: apply second round of update.
Index: lilypond/lexer-gcc-3.1.sh
diff -u lilypond/lexer-gcc-3.1.sh:1.3 lilypond/lexer-gcc-3.1.sh:1.4
--- lilypond/lexer-gcc-3.1.sh:1.3 Wed Jul 30 20:50:27 2003
+++ lilypond/lexer-gcc-3.1.sh Sun May 8 13:17:15 2005
@@ -8,7 +8,7 @@
if [ -z "$FLEXLEXER" ]; then
-includes="$HOME/usr/include /usr/local/include /usr/include"
+includes="$HOME/usr/include $PREFIX/include /usr/local/include /usr/include"
for i in $includes; do
file=$i/FlexLexer.h
@@ -43,9 +43,9 @@
echo -n "Copying and fixing $file... "
mkdir -p lily/$outdir
rm -f lily/$outdir/FlexLexer.h
-sed -e 's/iostream.h/iostream/' \
- -e 's/\<istream\>/std::istream/' \
- -e 's/\<ostream\>/std::ostream/' \
+perl -p -e 's/iostream.h/iostream/g;' \
+ -e 's/\bistream\b/std::istream/g;' \
+ -e 's/\bostream\b/std::ostream/' \
$file > lily/$outdir/FlexLexer.h
echo "done"
@@ -58,9 +58,9 @@
make conf=$CONF -C lily $outdir/lexer.cc > /dev/null 2>&1 || true
mv $file $file.orig
- sed -e 's/\<cin\>/std::cin/g' \
- -e 's/\<cout\>/std::cout/g' \
- -e 's/\<cerr\>/std::cerr/g' \
+ perl -p -e 's/\bcin\b/std::cin/g;' \
+ -e 's/\bcout\b/std::cout/g;' \
+ -e 's/\bcerr\b/std::cerr/g' \
$file.orig > $file
echo "done"
fi
Index: lilypond/lily/include/open-type-font.hh
diff -u lilypond/lily/include/open-type-font.hh:1.17
lilypond/lily/include/open-type-font.hh:1.18
--- lilypond/lily/include/open-type-font.hh:1.17 Mon May 2 22:27:25 2005
+++ lilypond/lily/include/open-type-font.hh Sun May 8 13:17:15 2005
@@ -44,13 +44,10 @@
virtual unsigned index_to_charcode (int) const;
virtual void derived_mark () const;
virtual SCM sub_fonts () const;
-#if 0
- virtual int count () const;
- virtual int index_to_ascii (int) const;
- virtual Box get_ascii_char (int) const;
- virtual Offset get_indexed_wxwy (int) const;
-#endif
virtual Real design_size () const;
};
+String get_otf_table (FT_Face face, String tag);
+FT_Face open_ft_face (String str);
+
#endif /* OPEN_TYPE_FONT_HH */
Index: lilypond/lily/open-type-font.cc
diff -u lilypond/lily/open-type-font.cc:1.37
lilypond/lily/open-type-font.cc:1.38
--- lilypond/lily/open-type-font.cc:1.37 Mon May 2 23:49:18 2005
+++ lilypond/lily/open-type-font.cc Sun May 8 13:17:15 2005
@@ -42,13 +42,11 @@
return 0;
}
+
String
Open_type_font::get_otf_table (String tag) const
{
- FT_ULong len;
- FT_Byte *tab = load_table (tag.to_str0 (), face_, &len);
-
- return String (tab, len);
+ return ::get_otf_table (face_, tag);
}
SCM
@@ -87,8 +85,21 @@
FT_Done_Face (face_);
}
-SCM
-Open_type_font::make_otf (String str)
+
+/*
+ UGH fix naming
+*/
+String
+get_otf_table (FT_Face face, String tag)
+{
+ FT_ULong len;
+ FT_Byte *tab = load_table (tag.to_str0 (), face, &len);
+
+ return String (tab, len);
+}
+
+FT_Face
+open_ft_face (String str)
{
FT_Face face;
int error_code = FT_New_Face (freetype2_library, str.to_str0 (), 0, &face);
@@ -98,7 +109,13 @@
else if (error_code)
error (_f ("unknown error: %d reading font file: %s", error_code,
str.to_str0 ()));
+ return face;
+}
+SCM
+Open_type_font::make_otf (String str)
+{
+ FT_Face face = open_ft_face (str);
Open_type_font *otf = new Open_type_font (face);
return otf->self_scm ();
Index: lilypond/lily/pfb.cc
diff -u lilypond/lily/pfb.cc:1.9 lilypond/lily/pfb.cc:1.10
--- lilypond/lily/pfb.cc:1.9 Thu Mar 10 14:36:13 2005
+++ lilypond/lily/pfb.cc Sun May 8 13:17:15 2005
@@ -13,6 +13,7 @@
#include "source-file.hh"
#include "memory-stream.hh"
#include "ttftool.h"
+#include "open-type-font.hh"
char *
pfb2pfa (Byte const *pfb, int length)
@@ -104,3 +105,24 @@
return asscm;
}
+
+
+
+LY_DEFINE (ly_otf_to_pfa, "ly:otf->cff",
+ 1, 0, 0, (SCM otf_file_name),
+ "Convert the contents of a OTF file to CFF file, returning it as "
+ " a string.")
+{
+ SCM_ASSERT_TYPE (scm_is_string (otf_file_name), otf_file_name,
+ SCM_ARG1, __FUNCTION__, "string");
+
+ String file_name = ly_scm2string (otf_file_name);
+
+ FT_Face face = open_ft_face (file_name);
+ String table = get_otf_table (face, "CFF ");
+
+ SCM asscm = scm_from_locale_stringn (table.get_bytes (),
+ table.length ());
+
+ return asscm;
+}
Index: lilypond/scm/framework-ps.scm
diff -u lilypond/scm/framework-ps.scm:1.97 lilypond/scm/framework-ps.scm:1.98
--- lilypond/scm/framework-ps.scm:1.97 Tue May 3 01:00:25 2005
+++ lilypond/scm/framework-ps.scm Sun May 8 13:17:15 2005
@@ -231,7 +231,7 @@
(define (write-preamble paper load-fonts? port)
-
+
(define (load-font font-name-filename)
(let* ((font (car font-name-filename))
(name (cadr font-name-filename))
@@ -246,9 +246,13 @@
((and bare-file-name (string-match "\\.pfb" bare-file-name))
(ly:pfb->pfa bare-file-name))
+
((string-match "([eE]mmentaler|[Aa]ybabtu)" file-name)
(cached-file-contents
(format "~a.pfa" (munge-lily-font-name file-name))))
+
+ ((and bare-file-name (string-match "\\.otf" bare-file-name))
+ (ps-embed-cff (ly:otf->cff bare-file-name) name 0))
((and bare-file-name (string-match "\\.ttf" bare-file-name))
(ly:ttf->pfa bare-file-name))
_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs