]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/include/pango-font.hh: new file.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 24 Dec 2004 19:50:12 +0000 (19:50 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 24 Dec 2004 19:50:12 +0000 (19:50 +0000)
* 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()

19 files changed:
ChangeLog
flower/parse-afm.cc
lily/afm.cc
lily/all-font-metrics.cc
lily/font-metric.cc
lily/include/afm.hh
lily/include/all-font-metrics.hh
lily/include/font-metric.hh
lily/include/lily-proto.hh
lily/include/modified-font-metric.hh
lily/include/open-type-font.hh
lily/include/pango-font.hh [new file with mode: 0644]
lily/modified-font-metric.cc
lily/open-type-font.cc
lily/pango-font.cc [new file with mode: 0644]
lily/text-item.cc
make/lilypond.fedora.spec.in
mf/GNUmakefile
stepmake/aclocal.m4

index 1efe2f193758feaa71a4f088f803d76cf20f2c01..42ce849f9c24e227843459b00cc342de9f6c6904 100644 (file)
--- 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.
index 59f9bf012f8005e08ebd5be117befbff89ef4506..00c348e79f361ddb083b9a4ba85847192249e800 100644 (file)
@@ -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. */
 
index 27a284d0a699b950f7ca541a845d407cfb5555c9..3c2d84f10537171bfe3b648b9ac4278f59fbff80 100644 (file)
@@ -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;
+}
index 1935cc5972a097a8fa059070232e7bdef91429bd..a59738536ec31319cfa91c237a08ce1e3a9dc937 100644 (file)
@@ -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);
     }
 
index 3c29320258d3cc6ac26dea45d9736cf6ff4a658e..1a6e215041df7b8e390263a4c275773c559defc7 100644 (file)
@@ -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));
+}
index 9853cae98dc8a2922f8dc818dbf97fe214fff803..2c94f98aa31003e423a53409956383f1356218dc 100644 (file)
@@ -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;
index 0ea6294573f749efb652539aa07e3559511c2780..b0cdeff9d51bbd0f1239c4cd032e1df1d79b076f 100644 (file)
 
 #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);  
index 183815d42dacb061c07aa8f411d574ee4370ad55..cb20aa5f5e22200ab2713e454a8625d03209aaef 100644 (file)
@@ -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;
index 1ceb002c6f21012b518db7397e83e378610fabd8..f9cb426eba1926f9a472f43525070742d9181435 100644 (file)
@@ -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;
index 2d6215fc571fc4be0d85f18a30e2e4c287ebc3f7..095115d27eb9d375384ec234edce3ce361a88493 100644 (file)
@@ -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;
index cc1c377148d4c907d2f88d725e96f46180b591c5..b730c560fc99ea78d9cc1b24bf2049c50b65c023 100644 (file)
@@ -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 (file)
index 0000000..de97e0b
--- /dev/null
@@ -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 */
+
index a28ae42a601fe4bd85c6643d0b8044b8dd730b0a..2d618993fafb8f39a943421785b015688a463d4f 100644 (file)
@@ -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();
+}
index 3b209c0a2c104e61f4429cd437f733f697a06850..03dfa0c6dfb0d7b25239cbe2ffb0af627091be8b 100644 (file)
@@ -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 (file)
index 0000000..d9944ca
--- /dev/null
@@ -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;
+}
index 6c7b0eff8dd8727da67a2496dae1e7fbb10d45f2..505b2ec7cd66448c88ef66e422daa66002706843 100644 (file)
@@ -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
 }
 
 
index 1a793a31b443798fcf0074a60c4b114325c13311..f88b312b30c3bb909fe8015b4bf99be49f6a695c 100644 (file)
@@ -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
 
index e8ee1857ad494ac8e84098d1e407c902da0d8d78..0146acf149371d08eccc6adba134bae5bb34820e 100644 (file)
@@ -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 "
index 2758563af29e81ae663d45ad753591c36cc3ed9b..3d8cc6f15925916666ff11c8248ab5d36da5326b 100644 (file)
@@ -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
+])