+2005-05-08 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * 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 <hanwen@xs4all.nl>
+
+ * scm/backend-library.scm (postscript->png): call lilypond-ps2png
+ iso. ps2png.
+
2005-05-06 Heikki Junes <hjunes@cc.hut.fi>
* po/fi.po: apply second round of update.
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
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"
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
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 */
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
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);
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 ();
#include "source-file.hh"
#include "memory-stream.hh"
#include "ttftool.h"
+#include "open-type-font.hh"
char *
pfb2pfa (Byte const *pfb, int length)
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;
+}
(define (write-preamble paper load-fonts? port)
-
+
(define (load-font font-name-filename)
(let* ((font (car font-name-filename))
(name (cadr font-name-filename))
((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))