summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--flower/parse-afm.cc32
-rw-r--r--lily/afm.cc6
-rw-r--r--lily/all-font-metrics.cc68
-rw-r--r--lily/font-metric.cc38
-rw-r--r--lily/include/afm.hh1
-rw-r--r--lily/include/all-font-metrics.hh19
-rw-r--r--lily/include/font-metric.hh10
-rw-r--r--lily/include/lily-proto.hh1
-rw-r--r--lily/include/modified-font-metric.hh4
-rw-r--r--lily/include/open-type-font.hh1
-rw-r--r--lily/include/pango-font.hh45
-rw-r--r--lily/modified-font-metric.cc25
-rw-r--r--lily/open-type-font.cc7
-rw-r--r--lily/pango-font.cc206
-rw-r--r--lily/text-item.cc11
-rw-r--r--make/lilypond.fedora.spec.in7
-rw-r--r--mf/GNUmakefile4
-rw-r--r--stepmake/aclocal.m416
19 files changed, 480 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index 1efe2f1937..42ce849f9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2004-12-24 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * lily/include/pango-font.hh: new file.
+
+ * lily/pango-font.cc: new file.
+
+ * lily/font-metric.cc (text_stencil): new routine
+
+ * lily/all-font-metrics.cc (find_pango_font): new routine.
+
+ * lily/include/font-metric.hh (struct Font_metric): add
+ text_stencil()
+
+ * configure.in (PKG_CONFIG_PATH): require PANGO_FT2
+
2004-12-22 Werner Lemberg <wl@gnu.org>
Prepare glyph shapes for mf2pt1 conversion.
diff --git a/flower/parse-afm.cc b/flower/parse-afm.cc
index 59f9bf012f..00c348e79f 100644
--- a/flower/parse-afm.cc
+++ b/flower/parse-afm.cc
@@ -79,6 +79,38 @@ Morten Welinder <terra@diku.dk> September 1999.
#include "warn.hh"
+/* your basic constants */
+#define TRUE 1
+#define FALSE 0
+#define EOL '\n' /* end-of-line indicator */
+#define MAX_NAME 4096 /* max length for identifiers */
+
+
+
+/* Flags that can be AND'ed together to specify exactly what
+ * information from the AFM file should be saved.
+ */
+#define P_G 0x01 /* 0000 0001 */ /* Global Font Info */
+#define P_W 0x02 /* 0000 0010 */ /* Character Widths ONLY */
+#define P_M 0x06 /* 0000 0110 */ /* All Char Metric Info */
+#define P_P 0x08 /* 0000 1000 */ /* Pair Kerning Info */
+#define P_T 0x10 /* 0001 0000 */ /* Track Kerning Info */
+#define P_C 0x20 /* 0010 0000 */ /* Composite Char Info */
+
+
+/* Commonly used flags
+ */
+#define P_GW\
+ (P_G | P_W)
+#define P_GM\
+ (P_G | P_M)
+#define P_GMP\
+ (P_G | P_M | P_P)
+#define P_GMK\
+ (P_G | P_M | P_P | P_T)
+#define P_GALL\
+ (P_G | P_M | P_P | P_T | P_C)
+
#define METATYPE1_BUG /* Parse Metatype1's (version unknown)
'Generated' global tag as comment. */
diff --git a/lily/afm.cc b/lily/afm.cc
index 27a284d0a6..3c2d84f105 100644
--- a/lily/afm.cc
+++ b/lily/afm.cc
@@ -183,3 +183,9 @@ Adobe_font_metric::coding_scheme () const
{
return font_info_->gfi->encodingScheme;
}
+
+String
+Adobe_font_metric::font_name () const
+{
+ return font_info_->gfi->fontName;
+}
diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc
index 1935cc5972..a59738536e 100644
--- a/lily/all-font-metrics.cc
+++ b/lily/all-font-metrics.cc
@@ -9,36 +9,78 @@
#include "all-font-metrics.hh"
#include "open-type-font.hh"
-#include "config.hh"
#include "main.hh"
#include "warn.hh"
#include "afm.hh"
#include "tfm.hh"
#include "scm-hash.hh"
#include "kpath.hh"
+#include "pango-font.hh"
static char const *default_font_str0_ = "cmr10";
All_font_metrics::All_font_metrics (String path)
{
- afm_p_dict_ = new Scheme_hash_table;
- tfm_p_dict_ = new Scheme_hash_table;
- otf_p_dict_ = new Scheme_hash_table;
+ afm_dict_ = new Scheme_hash_table;
+ tfm_dict_ = new Scheme_hash_table;
+ otf_dict_ = new Scheme_hash_table;
+
+#ifdef HAVE_PANGO16
+ PangoFontMap*pfm = pango_ft2_font_map_new ();
+
+ pango_ft2_fontmap_ =
+ G_TYPE_CHECK_INSTANCE_CAST(pfm,
+ PANGO_TYPE_FT2_FONT_MAP,
+ PangoFT2FontMap);
+ pango_dpi_ = 1200;
+ pango_ft2_font_map_set_resolution (pango_ft2_fontmap_,
+ pango_dpi_, pango_dpi_);
+
+ pango_dict_ = new Scheme_hash_table;
+#endif
search_path_.parse_path (path);
}
All_font_metrics::~All_font_metrics ()
{
- scm_gc_unprotect_object (afm_p_dict_->self_scm ());
- scm_gc_unprotect_object (tfm_p_dict_->self_scm ());
- scm_gc_unprotect_object (otf_p_dict_->self_scm ());
+ scm_gc_unprotect_object (afm_dict_->self_scm ());
+ scm_gc_unprotect_object (tfm_dict_->self_scm ());
+ scm_gc_unprotect_object (otf_dict_->self_scm ());
}
All_font_metrics::All_font_metrics (All_font_metrics const&)
{
}
+#ifdef HAVE_PANGO16
+Pango_font *
+All_font_metrics::find_pango_font (PangoFontDescription*description)
+{
+ gchar *fn = pango_font_description_to_filename (description);
+ SCM key = ly_symbol2scm (fn);
+
+ SCM val;
+ if (!pango_dict_->try_retrieve (key, &val))
+ {
+ if (verbose_global_b)
+ progress_indication ("[" + String (fn));
+ Pango_font *pf = new Pango_font (pango_ft2_fontmap_,
+ pango_dpi_,
+ RIGHT,
+ description);
+ val = pf->self_scm();
+ pango_dict_->set (key, val);
+ scm_gc_unprotect_object (val);
+
+ if (verbose_global_b)
+ progress_indication ("]");
+ }
+ g_free (fn);
+ return dynamic_cast<Pango_font*> (unsmob_metrics (val));
+}
+#endif
+
/*
TODO: our AFM handling is broken: the units in an AFM file are
relative to the design size (1000 units = 1 designsize). Hence we
@@ -52,7 +94,7 @@ All_font_metrics::find_afm (String name)
SCM sname = ly_symbol2scm (name.to_str0 ());
SCM name_string = scm_makfrom0str (name.to_str0 ());
SCM val;
- if (!afm_p_dict_->try_retrieve (sname, &val))
+ if (!afm_dict_->try_retrieve (sname, &val))
{
String file_name;
@@ -80,7 +122,7 @@ All_font_metrics::find_afm (String name)
if (verbose_global_b)
progress_indication ("]");
- afm_p_dict_->set (sname, val);
+ afm_dict_->set (sname, val);
scm_gc_unprotect_object (val);
Adobe_font_metric *afm
@@ -126,7 +168,7 @@ All_font_metrics::find_otf (String name)
SCM sname = ly_symbol2scm (name.to_str0 ());
SCM name_string = scm_makfrom0str (name.to_str0 ());
SCM val;
- if (!otf_p_dict_->try_retrieve (sname, &val))
+ if (!otf_dict_->try_retrieve (sname, &val))
{
String file_name;
@@ -146,7 +188,7 @@ All_font_metrics::find_otf (String name)
unsmob_metrics (val)->file_name_ = file_name;
unsmob_metrics (val)->description_ = scm_cons (name_string,
scm_make_real (1.0));
- otf_p_dict_->set (sname, val);
+ otf_dict_->set (sname, val);
scm_gc_unprotect_object (val);
}
@@ -159,7 +201,7 @@ All_font_metrics::find_tfm (String name)
SCM sname = ly_symbol2scm (name.to_str0 ());
SCM name_string = scm_makfrom0str (name.to_str0 ());
SCM val;
- if (!tfm_p_dict_->try_retrieve (sname, &val))
+ if (!tfm_dict_->try_retrieve (sname, &val))
{
String file_name;
@@ -188,7 +230,7 @@ All_font_metrics::find_tfm (String name)
unsmob_metrics (val)->file_name_ = file_name;
unsmob_metrics (val)->description_ = scm_cons (name_string,
scm_make_real (1.0));
- tfm_p_dict_->set (sname, val);
+ tfm_dict_->set (sname, val);
scm_gc_unprotect_object (val);
}
diff --git a/lily/font-metric.cc b/lily/font-metric.cc
index 3c29320258..1a6e215041 100644
--- a/lily/font-metric.cc
+++ b/lily/font-metric.cc
@@ -211,12 +211,12 @@ LY_DEFINE (ly_text_dimension, "ly:text-dimension",
Box b;
Modified_font_metric*fm = dynamic_cast<Modified_font_metric*>
(unsmob_metrics (font));
+
SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "modified font metric");
SCM_ASSERT_TYPE (scm_is_string (text), text, SCM_ARG2, __FUNCTION__, "string");
-
- b = fm->text_dimension (ly_scm2string (text));
-
- return scm_cons (ly_interval2scm (b[X_AXIS]), ly_interval2scm (b[Y_AXIS]));
+ Stencil stc (fm->text_stencil (ly_scm2string (text)));
+ return scm_cons (ly_interval2scm (stc.extent (X_AXIS)),
+ ly_interval2scm (stc.extent (Y_AXIS)));
}
LY_DEFINE (ly_font_file_name, "ly:font-file-name",
@@ -230,6 +230,12 @@ LY_DEFINE (ly_font_file_name, "ly:font-file-name",
return scm_car (fm->description_);
}
+String
+Font_metric::font_name () const
+{
+ String s ("unknown");
+ return s;
+}
#include "afm.hh"
@@ -242,12 +248,7 @@ LY_DEFINE (ly_font_name, "ly:font-name",
Font_metric *fm = unsmob_metrics (font);
SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
-
- if (Modified_font_metric* mfm = dynamic_cast<Modified_font_metric*> (fm))
- return ly_font_name (mfm->original_font ()->self_scm ());
- else if (Adobe_font_metric* afm = dynamic_cast<Adobe_font_metric*> (fm))
- return scm_makfrom0str (afm->font_info_->gfi->fontName);
- return SCM_BOOL_F;
+ return scm_makfrom0str (fm->font_name().to_str0 ());
}
LY_DEFINE (ly_font_magnification, "ly:font-magnification", 1, 0, 0,
@@ -327,3 +328,20 @@ Font_metric::sub_fonts () const
{
return SCM_EOL;
}
+
+Stencil
+Font_metric::text_stencil (String str) const
+{
+ SCM lst = scm_list_3 (ly_symbol2scm ("text"),
+ this->self_scm (),
+ scm_makfrom0str (str.to_str0 ()));
+
+ Box b = text_dimension (str);
+ return Stencil (b, lst);
+}
+
+Box
+Font_metric::text_dimension (String) const
+{
+ return Box (Interval (0,0), Interval (0,0));
+}
diff --git a/lily/include/afm.hh b/lily/include/afm.hh
index 9853cae98d..2c94f98aa3 100644
--- a/lily/include/afm.hh
+++ b/lily/include/afm.hh
@@ -35,6 +35,7 @@ public:
virtual String coding_scheme () const;
static SCM make_afm (AFM_Font_info*, unsigned, Real);
virtual Real design_size () const;
+ virtual String font_name () const;
protected:
AFM_CharMetricInfo const *find_char_metric (String name) const;
diff --git a/lily/include/all-font-metrics.hh b/lily/include/all-font-metrics.hh
index 0ea6294573..b0cdeff9d5 100644
--- a/lily/include/all-font-metrics.hh
+++ b/lily/include/all-font-metrics.hh
@@ -12,22 +12,35 @@
#include "file-path.hh"
#include "font-metric.hh"
+#include "config.hh"
+
+#ifdef HAVE_PANGO16
+#include <pango/pango.h>
+#include <pango/pangoft2.h>
+#endif
/**
Interface to all .afm files living in the filesystem.
*/
class All_font_metrics
{
- Scheme_hash_table *afm_p_dict_;
- Scheme_hash_table *tfm_p_dict_;
- Scheme_hash_table *otf_p_dict_;
+ Scheme_hash_table *afm_dict_;
+ Scheme_hash_table *tfm_dict_;
+ Scheme_hash_table *otf_dict_;
File_path search_path_;
+#ifdef HAVE_PANGO16
+ PangoFT2FontMap *pango_ft2_fontmap_;
+ Scheme_hash_table *pango_dict_;
+ int pango_dpi_;
+#endif
+
All_font_metrics (All_font_metrics const&);
public:
All_font_metrics (String search_path);
~All_font_metrics ();
+ Pango_font *find_pango_font (PangoFontDescription*description);
Adobe_font_metric *find_afm (String name);
Tex_font_metric *find_tfm (String);
Font_metric *find_font (String name);
diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh
index 183815d42d..cb20aa5f5e 100644
--- a/lily/include/font-metric.hh
+++ b/lily/include/font-metric.hh
@@ -1,11 +1,12 @@
-/*
+/*
+
font-metric.hh -- declare Font_metric
source file of the GNU LilyPond music typesetter
(c) 1999--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
- */
+*/
#ifndef FONT_METRIC_HH
#define FONT_METRIC_HH
@@ -19,7 +20,10 @@ struct Font_metric
public:
SCM description_;
String file_name_;
-
+
+ virtual Stencil text_stencil (String) const;
+ virtual Box text_dimension (String) const;
+ virtual String font_name () const;
virtual int count () const;
virtual Offset attachment_point (String) const;
virtual Offset get_indexed_wxwy (int) const;
diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh
index 1ceb002c6f..f9cb426eba 100644
--- a/lily/include/lily-proto.hh
+++ b/lily/include/lily-proto.hh
@@ -115,6 +115,7 @@ class Object_key_undumper;
class Open_type_font;
class Output_property;
class Page;
+class Pango_font;
class Paper_book;
class Paper_column;
class Paper_outputter;
diff --git a/lily/include/modified-font-metric.hh b/lily/include/modified-font-metric.hh
index 2d6215fc57..095115d27e 100644
--- a/lily/include/modified-font-metric.hh
+++ b/lily/include/modified-font-metric.hh
@@ -15,7 +15,8 @@
struct Modified_font_metric : public Font_metric
{
public:
- Box text_dimension (String);
+ virtual Box text_dimension (String) const;
+ virtual Stencil text_stencil (String) const;
static SCM make_scaled_font_metric (Font_metric *fm, Real magnification,
SCM font_encoding, SCM input_encoding);
@@ -40,6 +41,7 @@ protected:
Modified_font_metric (Font_metric *fm, Real magnification,
String font_encoding, String input_encoding);
virtual SCM sub_fonts () const;
+ virtual String font_name () const;
virtual Real design_size () const;
virtual void derived_mark () const;
virtual Box get_indexed_char (int) const;
diff --git a/lily/include/open-type-font.hh b/lily/include/open-type-font.hh
index cc1c377148..b730c560fc 100644
--- a/lily/include/open-type-font.hh
+++ b/lily/include/open-type-font.hh
@@ -32,6 +32,7 @@ public:
SCM get_char_table () const;
static SCM make_otf (String);
+ virtual String font_name () const;
virtual ~Open_type_font();
virtual Offset attachment_point (String) const;
virtual int count () const;
diff --git a/lily/include/pango-font.hh b/lily/include/pango-font.hh
new file mode 100644
index 0000000000..de97e0bf57
--- /dev/null
+++ b/lily/include/pango-font.hh
@@ -0,0 +1,45 @@
+
+/*
+ pango-font.hh -- declare Pango_font
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#ifndef PANGO_FONT_HH
+#define PANGO_FONT_HH
+
+#include "config.hh"
+
+#ifdef HAVE_PANGO16
+
+#include <pango/pango.h>
+#include <pango/pangoft2.h>
+#include "font-metric.hh"
+
+struct Pango_font : Font_metric
+{
+ PangoContext *context_;
+ PangoAttrList *attribute_list_;
+ Real scale_;
+public:
+ Stencil text_stencil (String) const;
+ Pango_font (PangoFT2FontMap *,
+ int dpi,
+ Direction leftright,
+ PangoFontDescription *);
+ ~Pango_font ();
+};
+PangoFontDescription*
+symbols_to_pango_font_description(SCM family,
+ SCM style,
+ SCM variant,
+ SCM weight,
+ SCM stretch,
+ SCM size);
+
+#endif
+#endif /* PANGO_FONT_HH */
+
diff --git a/lily/modified-font-metric.cc b/lily/modified-font-metric.cc
index a28ae42a60..2d618993fa 100644
--- a/lily/modified-font-metric.cc
+++ b/lily/modified-font-metric.cc
@@ -7,6 +7,7 @@
*/
#include "modified-font-metric.hh"
+#include "pango-font.hh"
#include <cctype>
@@ -237,8 +238,25 @@ Modified_font_metric::tex_kludge (String text) const
return Box (Interval (0, w), ydims);
}
+Stencil
+Modified_font_metric::text_stencil (String text) const
+{
+ Box b;
+ if (Pango_font * pf = dynamic_cast<Pango_font*> (orig_))
+ {
+ Stencil stc = pf->text_stencil (text);
+
+ Box b = stc.extent_box ();
+
+ b.scale (magnification_);
+ return Stencil (b, stc.expr());
+ }
+
+ return Font_metric::text_stencil (text);
+}
+
Box
-Modified_font_metric::text_dimension (String text)
+Modified_font_metric::text_dimension (String text) const
{
Box b;
if (input_encoding_ == "TeX")
@@ -339,3 +357,8 @@ Modified_font_metric::sub_fonts () const
return orig_->sub_fonts();
}
+String
+Modified_font_metric::font_name () const
+{
+ return original_font ()->font_name();
+}
diff --git a/lily/open-type-font.cc b/lily/open-type-font.cc
index 3b209c0a2c..03dfa0c6df 100644
--- a/lily/open-type-font.cc
+++ b/lily/open-type-font.cc
@@ -273,3 +273,10 @@ Open_type_font::get_global_table () const
{
return lily_global_table_;
}
+
+String
+Open_type_font::font_name () const
+{
+ return FT_Get_Postscript_Name (face_);
+}
+
diff --git a/lily/pango-font.cc b/lily/pango-font.cc
new file mode 100644
index 0000000000..d9944caaab
--- /dev/null
+++ b/lily/pango-font.cc
@@ -0,0 +1,206 @@
+/*
+ pango-font.cc -- implement Pango_font
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#include <pango/pangoft2.h>
+
+#include "pango-font.hh"
+#include "stencil.hh"
+
+PangoStyle
+symbol_to_pango_style (SCM style)
+{
+ PangoStyle pstyle = PANGO_STYLE_NORMAL;
+ if (style == ly_symbol2scm ("italic"))
+ {
+ pstyle = PANGO_STYLE_NORMAL;
+ }
+ else if (style == ly_symbol2scm ("oblique")
+ || style == ly_symbol2scm ("slanted")
+ )
+ {
+ pstyle = PANGO_STYLE_OBLIQUE;
+ }
+
+ return pstyle;
+}
+
+PangoVariant
+symbol_to_pango_variant (SCM variant)
+{
+ PangoVariant pvariant;
+ if (variant == ly_symbol2scm ("caps"))
+ {
+ pvariant = PANGO_VARIANT_SMALL_CAPS;
+ }
+ return pvariant;
+}
+
+
+PangoWeight
+symbol_to_pango_weight (SCM weight)
+{
+ PangoWeight pw = PANGO_WEIGHT_NORMAL;
+ if (weight == ly_symbol2scm ("bold"))
+ {
+ pw = PANGO_WEIGHT_BOLD;
+ }
+ if (weight == ly_symbol2scm ("heavy"))
+ {
+ pw = PANGO_WEIGHT_HEAVY;
+ }
+ if (weight == ly_symbol2scm ("ultrabold"))
+ {
+ pw = PANGO_WEIGHT_ULTRABOLD;
+ }
+ if (weight == ly_symbol2scm ("light"))
+ {
+ pw = PANGO_WEIGHT_LIGHT;
+ }
+ if (weight == ly_symbol2scm ("ultralight"))
+ {
+ pw = PANGO_WEIGHT_ULTRALIGHT;
+ }
+
+ return pw;
+}
+
+PangoStretch
+symbol_to_pango_stretch (SCM stretch)
+{
+ PangoStretch ps = PANGO_STRETCH_NORMAL;
+
+ /*
+ // TODO
+
+ PANGO_STRETCH_ULTRA_CONDENSED,
+ PANGO_STRETCH_EXTRA_CONDENSED,
+ PANGO_STRETCH_CONDENSED,
+ PANGO_STRETCH_SEMI_CONDENSED,
+
+ PANGO_STRETCH_SEMI_EXPANDED,
+ PANGO_STRETCH_EXPANDED,
+ PANGO_STRETCH_EXTRA_EXPANDED,
+ PANGO_STRETCH_ULTRA_EXPANDED
+ */
+ return ps;
+}
+
+
+
+PangoFontDescription*
+symbols_to_pango_font_description(SCM family,
+ SCM style,
+ SCM variant,
+ SCM weight,
+ SCM stretch,
+ SCM size)
+{
+ PangoFontDescription * description = pango_font_description_new ();
+
+ pango_font_description_set_family (description,
+ ly_symbol2string (family).to_str0 ());
+ pango_font_description_set_style (description,
+ symbol_to_pango_style (style));
+ pango_font_description_set_variant (description,
+ symbol_to_pango_variant (variant));
+ pango_font_description_set_weight (description,
+ symbol_to_pango_weight (weight));
+ pango_font_description_set_stretch (description,
+ symbol_to_pango_stretch (stretch));
+ pango_font_description_set_size (description,
+ gint (scm_to_double (size) * PANGO_SCALE));
+
+ return description;
+}
+
+Pango_font::Pango_font (PangoFT2FontMap *fontmap,
+ int resolution,
+ Direction dir,
+ PangoFontDescription * description)
+{
+ PangoDirection pango_dir = (dir==RIGHT)
+ ? PANGO_DIRECTION_LTR
+ : PANGO_DIRECTION_RTL;
+ context_ = pango_ft2_font_map_create_context (fontmap);
+ attribute_list_= pango_attr_list_new();
+ scale_ = PANGO_SCALE * resolution * 72.27;
+
+ pango_context_set_language (context_, pango_language_from_string ("en_US"));
+ pango_context_set_base_dir (context_, pango_dir);
+ pango_context_set_font_description (context_, description);
+}
+
+Pango_font::~Pango_font ()
+{
+ g_object_unref (context_);
+ pango_attr_list_unref (attribute_list_);
+}
+
+
+Stencil
+Pango_font::text_stencil (String str) const
+{
+ GList * items = pango_itemize (context_,
+ str.to_str0 (),
+ 0, str.length (), attribute_list_,
+ NULL);
+
+ const int GLYPH_NAME_LEN = 256;
+ char glyph_name[GLYPH_NAME_LEN];
+
+ Box dest_extent;
+ dest_extent.set_empty ();
+ GList * ptr = items;
+ SCM glyph_exprs = SCM_EOL;
+ while (ptr)
+ {
+ PangoItem *item = (PangoItem*) ptr->data;
+ PangoAnalysis *pa = &(item->analysis);
+ PangoGlyphString *pgs = pango_glyph_string_new();
+ pango_shape (str.to_str0 (), str.length (), pa, pgs);
+
+ PangoRectangle logical_rect;
+ pango_glyph_string_extents (pgs, pa->font, NULL, &logical_rect);
+
+ PangoFcFont * fcfont = G_TYPE_CHECK_INSTANCE_CAST(pa->font,
+ PANGO_TYPE_FC_FONT,
+ PangoFcFont);
+ FT_Face ftface = pango_fc_font_lock_face (fcfont);
+ Box b (Interval (0, logical_rect.width),
+ Interval (0, logical_rect.height));
+
+ b.translate (Offset (- logical_rect.x, -logical_rect.y));
+
+ b.scale (scale_);
+ dest_extent.unite (b);
+
+ for (int i = 0; i < pgs->num_glyphs; i++)
+ {
+ PangoGlyphInfo *pgi = pgs->glyphs + i;
+
+ PangoGlyph pg = pgi->glyph;
+ PangoGlyphGeometry ggeo = pgi->geometry;
+
+ FT_Get_Glyph_Name (ftface, pg, glyph_name, GLYPH_NAME_LEN);
+ glyph_exprs = scm_cons (scm_list_5 (ly_symbol2scm ("named-ps-glyph"),
+ scm_from_int (ggeo.x_offset),
+ scm_from_int (ggeo.y_offset),
+ scm_makfrom0str (glyph_name),
+ scm_makfrom0str (FT_Get_Postscript_Name (ftface))),
+ glyph_exprs);
+ }
+
+ ptr = ptr->next;
+ }
+
+ Stencil dest (dest_extent,
+ scm_cons (ly_symbol2scm ("combine-stencil"),
+ glyph_exprs));
+ return dest;
+}
diff --git a/lily/text-item.cc b/lily/text-item.cc
index 6c7b0eff8d..505b2ec7cd 100644
--- a/lily/text-item.cc
+++ b/lily/text-item.cc
@@ -29,9 +29,14 @@ Text_interface::interpret_string (SCM layout_smob,
__FUNCTION__, "Layout definition");
SCM_ASSERT_TYPE (scm_is_string (markup), markup, SCM_ARG3,
__FUNCTION__, "string");
+
+ String str = ly_scm2string (markup);
+
+#if 0
SCM_ASSERT_TYPE (input_encoding == SCM_EOL || scm_is_symbol (input_encoding),
input_encoding, SCM_ARG2, __FUNCTION__, "symbol");
+
String str = ly_scm2string (markup);
if (!scm_is_symbol (input_encoding))
{
@@ -62,6 +67,12 @@ Text_interface::interpret_string (SCM layout_smob,
}
return Stencil (b, lst).smobbed_copy ();
+#else
+
+
+ Font_metric *fm = select_encoded_font (layout, props, input_encoding);
+ return fm->text_stencil (str).smobbed_copy ();
+#endif
}
diff --git a/make/lilypond.fedora.spec.in b/make/lilypond.fedora.spec.in
index 1a793a31b4..f88b312b30 100644
--- a/make/lilypond.fedora.spec.in
+++ b/make/lilypond.fedora.spec.in
@@ -15,8 +15,11 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-root
Buildrequires: t1utils bison flex mftrace ImageMagick
-Buildrequires: texinfo >= 4.6
-Buildrequires: guile-devel >= 1.6.4-8
+Buildrequires: texinfo >= 4.7
+Buildrequires: guile-devel >= 1.6.4-8
+Buildrequires: freetype-devel >= 2.1
+Buildrequires: fontforge >= 20041211
+
Requires: tetex tetex-latex libstdc++ python tetex-dvips tetex-latex
Requires: guile >= 1.6.4-8 ec-fonts-mftraced >= 1.0.5
diff --git a/mf/GNUmakefile b/mf/GNUmakefile
index e8ee1857ad..0146acf149 100644
--- a/mf/GNUmakefile
+++ b/mf/GNUmakefile
@@ -70,8 +70,6 @@ $(outdir)/aybabtu.subfonts:
$(PE_SCRIPTS): $(buildscript-dir)/gen-bigcheese-scripts.py
$(PYTHON) $< --dir=$(outdir)
-include $(outdir)/bigcheese20.dep
-
ALL_FONTS = $(FETA_FONTS) $(SAUTER_FONTS)
PFA_FILES = $(ALL_FONTS:%=$(outdir)/%.pfa)
@@ -117,7 +115,7 @@ default: pfa_warning $(ALL_GEN_FILES) $(outdir)/bigcheese20.otf
pfa_warning:
ifneq ($(shell $(MFTRACE) --version | sed 's/ .*//'),mftrace)
- @echo ""
+ @echo ""
@echo "ERROR: mftrace not found"
@echo ""
@echo "For obtaining PFA fonts, either install mftrace "
diff --git a/stepmake/aclocal.m4 b/stepmake/aclocal.m4
index 2758563af2..3d8cc6f159 100644
--- a/stepmake/aclocal.m4
+++ b/stepmake/aclocal.m4
@@ -1134,3 +1134,19 @@ AC_DEFUN(STEPMAKE_PANGO, [
AC_SUBST(PANGO_LIBS)
fi
])
+
+
+AC_DEFUN(STEPMAKE_PANGO_FT2, [
+ PKG_CHECK_MODULES(PANGO_FT2, pangoft2 >= 1.6.0, have_pangoft2=true, true)
+ if $have_pangoft2 ; then
+ AC_DEFINE(HAVE_PANGO_FT2)
+ PANGO_FT2_CFLAGS="$PANGO_FT2_CFLAGS $GTK2_CFLAGS"
+ PANGO_FT2_LIBS="$PANGO_FT2_LIBS $GTK2_LIBS"
+ CPPFLAGS="$PANGO_FT2_CFLAGS $CPPFLAGS"
+ LIBS="$PANGO_FT2_LIBS $LIBS"
+ AC_CHECK_HEADERS([pango/pangoft2.h])
+ AC_CHECK_FUNCS([pango_ft2_font_map_create_context])
+ AC_SUBST(PANGO_FT2_CFLAGS)
+ AC_SUBST(PANGO_FT2_LIBS)
+fi
+])