]> git.donarmstrong.com Git - lilypond.git/commitdiff
* stepmake/aclocal.m4 (STEPMAKE_KPATHSEA): Do not include
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 6 Mar 2005 18:27:55 +0000 (18:27 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 6 Mar 2005 18:27:55 +0000 (18:27 +0000)
KPATHSEA_LIBS in LIBS.
(STEPMAKE_DLOPEN): New function.

* lily/font-config.cc (init_fontconfig): Use dir for directory,
not path.

* flower/file-path.cc (directories): Rename from paths, as this
return an array of directories (a single path).

ChangeLog
config.make.in
configure.in
flower/file-path.cc
flower/include/file-path.hh
lily/font-config.cc
lily/include/kpath-private.hh
lily/main.cc
lily/pango-font.cc
stepmake/aclocal.m4

index 08ae07518ccdde9113f852c016da120f45b20b0a..d3409d655a09a3dc69d0e47f5516b7b7ad09b446 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2005-03-06  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       Drop run-time dependency on teTeX.
+
+       * lily/kpath.cc (initialize_kpathsea): dlopen libkpathsea.
+
+       * stepmake/aclocal.m4 (STEPMAKE_KPATHSEA): Do not include
+       KPATHSEA_LIBS in LIBS.
+       (STEPMAKE_DLOPEN): New function.
+
+       * lily/font-config.cc (init_fontconfig): Use dir for directory,
+       not path.
+
+       * flower/file-path.cc (directories): Rename from paths, as this
+       return an array of directories (a single path).
+
 2005-03-06  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
        * lily/GNUmakefile (MODULE_LIBS): link with kpath-guile
index e8a36b5d5f54a059e5c2684448cb0818e39ba45d..553f291aa93b2e39259b3181de332340f93eb1ff 100644 (file)
@@ -7,6 +7,9 @@ MISSING_REQUIRED = @REQUIRED@
 
 package-depth = @package_depth@
 
+#Alternative for dlopen
+#KPATHSEA_LIBS = @KPATHSEA_LIBS@
+
 USER_CFLAGS = @CPPFLAGS@ @CFLAGS@ @GUILE_CFLAGS@ @PANGO_FT2_CFLAGS@ @FREETYPE2_CFLAGS@
 USER_CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ @GUILE_CFLAGS@ @PANGO_FT2_CFLAGS@ @FREETYPE2_CFLAGS@
 USER_LDFLAGS = @LDFLAGS@ @GUILE_LDFLAGS@
index f9ba2e2fabbaa908228f73d6947f11b8b34d1715..9e207fed523d74ebcb5d7c2986238855a38b5469 100644 (file)
@@ -42,6 +42,7 @@ STEPMAKE_CXX(REQUIRED)
 STEPMAKE_GXX(REQUIRED, 3.0.5)
 STEPMAKE_CXXTEMPLATE
 STEPMAKE_LIB(REQUIRED)
+STEPMAKE_DLOPEN
 # Do not use bison 1.50 and 1.75.
 # 1.29 is required fr %locations, but I'm not sure it's enough --ns
 STEPMAKE_BISON(REQUIRED, 1.29)
index fa113fad712e2e5bc400384e65d8b707fd8d3f02..88ccd59e17fdf5ee28edb480d4fd52dc3a4e668b 100644 (file)
@@ -28,7 +28,7 @@
 #endif
 
 Array<String>
-File_path::paths () const
+File_path::directories () const
 {
   return *this;
 }
index 9f0ef04c3c6e9d6719e2c5cc83139cdd77b0b1c1..5f5549cb19dfcbf4c5ac49dbdcddb341c36e351e 100644 (file)
@@ -24,7 +24,7 @@
 class File_path : private Array<String>
 {
 public:
-  Array<String> paths () const;
+  Array<String> directories () const;
   String find (String name) const;
   String find (String name, char const *extensions[]);
   String to_string () const;
index 4871c583032484225c36121b63e3d41f93bb53a2..ff2cb3f9ab46e28fa7ce2f6a8b3e2c1de08594f7 100644 (file)
 
 #include <fontconfig/fontconfig.h>
 
+#include "file-path.hh"
 #include "main.hh"
 #include "warn.hh"
-#include "file-path.hh"
 
 void
 init_fontconfig ()
 {
-  if (!FcInit())
-    {
-      error ("FontConfig failed to initialize"); 
-    }
+  if (!FcInit ())
+    error (_ ("FontConfig failed to initialize"));
 
   FcConfig *fcc = FcConfigGetCurrent ();
 
-  
   Array<String> dirs;
   dirs.push (prefix_directory + "/otf/");
   dirs.push (prefix_directory + "/mf/out/");
   dirs.push (prefix_directory + "/type1/");
   dirs.push (prefix_directory + "/cff/");
   
-  for (int i = 0; i < dirs.size(); i++)
+  for (int i = 0; i < dirs.size (); i++)
     {
-      String path = dirs[i];
-      if (!FcConfigAppFontAddDir (fcc, (FcChar8*)path.to_str0 ()))
-       {
-         error (_f ("Failed to add lilypond directory %s", path.to_str0 ()));
-       }
+      String dir = dirs[i];
+      if (!FcConfigAppFontAddDir (fcc, (FcChar8*)dir.to_str0 ()))
+       error (_f ("Failed to add lilypond directory %s", dir));
     }     
 }
 
 #else
 
-void init_fontconfig() {}
+void
+init_fontconfig ()
+{
+}
 #endif
index d8fa199e665cd05453dcb378c16726c2e271aa9f..0814b5c6d68b6d944b61a1a4c5fa1924a7c86d69 100644 (file)
 #ifndef KPATH_PRIVATE_HH
 #define KPATH_PRIVATE_HH
 
+#include "config.hh"
+
+#define popen KPATHSEA_HAS_POPEN_PROTOTYPE_PROBLEM
+#define pclose KPATHSEA_HAS_PCLOSE_PROTOTYPE_PROBLEM
+#define getopt KPATHSEA_HAS_GETOPT_PROTOTYPE_PROBLEM
+
+#if HAVE_KPATHSEA_KPATHSEA_H
+extern "C" {
+  #include <kpathsea/kpathsea.h>
+  #include <kpathsea/tex-file.h>
+  extern void *kpathsea_handle;
+  extern char *(*dl_kpse_find_file) (char const*, kpse_file_format_type,
+                                    boolean);
+  extern char const *(*dl_kpse_init_format) (kpse_file_format_type);
+  extern void (*dl_kpse_maketex_option) (char const*, boolean);
+  extern void (*dl_kpse_set_program_name) (char const*);
+  extern char *(*dl_kpse_var_expand) (char const*);
+  extern kpse_format_info_type (*dl_kpse_format_info)[kpse_last_format];
+}
+#endif
+
 kpse_file_format_type kpathsea_find_format (String name);
 
 #endif /* KPATH_PRIVATE_HH */
index 52e2c277109888f3e56e58d5ce765d7dafd37e0e..291a9c8cc9ddaedcbe9d43d7d1ed048dfe952c5e 100644 (file)
 
 #include "all-font-metrics.hh"
 #include "file-name.hh"
+#include "freetype.hh"
 #include "getopt-long.hh"
 #include "global-ctor.hh"
-#include "kpath.hh"
 #include "lily-guile.hh"
 #include "lily-version.hh"
-#include "version.hh"
 #include "misc.hh"
 #include "output-def.hh"
-#include "warn.hh"
-#include "freetype.hh"
 #include "string-convert.hh"
+#include "version.hh"
+#include "warn.hh"
 
 /*
  * Global options that can be overridden through command line.
@@ -437,7 +436,7 @@ add_output_format (String format)
 static void
 parse_argv (int argc, char **argv)
 {
-  bool help_b = false;
+  bool show_help = false;
   option_parser = new Getopt_long (argc, argv, options_static);
   while (Long_option_init const *opt = (*option_parser) ())
     {
@@ -499,7 +498,7 @@ parse_argv (int argc, char **argv)
          init_name_global = option_parser->optional_argument_str0_;
          break;
        case 'h':
-         help_b = true;
+         show_help = true;
          break;
        case 'V':
          be_verbose_global = true;
@@ -518,7 +517,7 @@ parse_argv (int argc, char **argv)
        }
     }
 
-  if (help_b)
+  if (show_help)
     {
       identify (stdout);
       usage ();
index 5770a7e14f5af9d7f5651979934da47b6ac61f32..88c719c7f3fe1d850d03cb654917edf40717b6ce 100644 (file)
@@ -19,7 +19,7 @@
 #include "warn.hh"
 
 #if HAVE_PANGO_FT2
-#include "stencil.hh" 
+#include "stencil.hh"
 
 
 Pango_font::Pango_font (PangoFT2FontMap *fontmap,
@@ -31,14 +31,14 @@ Pango_font::Pango_font (PangoFT2FontMap *fontmap,
   PangoDirection pango_dir = (dir == RIGHT)
     ? PANGO_DIRECTION_LTR
     : PANGO_DIRECTION_RTL;
-  context_ =
-    pango_ft2_get_context (PANGO_RESOLUTION, PANGO_RESOLUTION);
+  context_
+    pango_ft2_get_context (PANGO_RESOLUTION, PANGO_RESOLUTION);
 
   pango_description_ = pango_font_description_copy (description);
-  //  context_ = pango_ft2_font_map_create_context (fontmap);  
+  //  context_ = pango_ft2_font_map_create_context (fontmap);
   attribute_list_= pango_attr_list_new();
 
-  
+
   /*
     urgh. I don't understand this. Why isn't this 1/(scale *
     resolution * output_scale)
@@ -63,11 +63,11 @@ Pango_font::~Pango_font ()
 }
 
 void
-Pango_font::register_font_file (String filename, String ps_name) 
+Pango_font::register_font_file (String filename, String ps_name)
 {
   scm_hash_set_x (physical_font_tab_,
-                 scm_makfrom0str (ps_name.to_str0()),
-                 scm_makfrom0str (filename.to_str0()));
+                 scm_makfrom0str (ps_name.to_str0 ()),
+                 scm_makfrom0str (filename.to_str0 ()));
 }
 
 void
@@ -78,7 +78,7 @@ Pango_font::derived_mark () const
 
 Stencil
 Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) const
-{      
+{
   const int GLYPH_NAME_LEN = 256;
   char glyph_name[GLYPH_NAME_LEN];
   PangoAnalysis *pa = &(item->analysis);
@@ -90,17 +90,17 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con
   PangoRectangle logical_rect;
   PangoRectangle ink_rect;
   pango_glyph_string_extents (pgs, pa->font, &ink_rect, &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 (PANGO_LBEARING(ink_rect),
-                  PANGO_RBEARING(ink_rect)),
-        Interval (-PANGO_DESCENT(ink_rect),
-                  PANGO_ASCENT(ink_rect)));
-            
+  Box b (Interval (PANGO_LBEARING (ink_rect),
+                  PANGO_RBEARING (ink_rect)),
+        Interval (-PANGO_DESCENT (ink_rect),
+                  PANGO_ASCENT (ink_rect)));
+
   b.scale (scale_);
 
   SCM glyph_exprs = SCM_EOL;
@@ -108,7 +108,7 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con
   for (int i = 0; i < pgs->num_glyphs; i++)
     {
       PangoGlyphInfo *pgi = pgs->glyphs + i;
-         
+
       PangoGlyph pg = pgi->glyph;
       PangoGlyphGeometry ggeo = pgi->geometry;
 
@@ -124,14 +124,14 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con
   PangoFontDescription *descr = pango_font_describe (pa->font);
   Real size = pango_font_description_get_size (descr)
     /  (Real (PANGO_SCALE));
-      
+
   FcPattern *fcpat = fcfont->font_pattern;
   char *filename = 0;
-  FcPatternGetString(fcpat, FC_FILE, 0, (FcChar8 **) &filename);
+  FcPatternGetString (fcpat, FC_FILE, 0, (FcChar8 **) &filename);
   char const *ps_name_str0 = FT_Get_Postscript_Name (ftface);
-  
+
   if (!ps_name_str0)
-    warning (_f ("No PS font name for font `%s'", filename)); 
+    warning (_f ("No PS font name for font `%s'", filename));
 
   String ps_name;
   if (!ps_name_str0
@@ -142,7 +142,7 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con
 
       /*
        UGH: kludge a PS name for OTF/CFF fonts.
-    
+
       */
 
       String name = filename;
@@ -151,24 +151,24 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con
 
       name = name.left_string (idx);
 
-      int slash_idx = name.index_last ('/');   // UGh. What's happens on windows?  
+      int slash_idx = name.index_last ('/');   // UGh. What's happens on windows?
       if (slash_idx >=  0)
        name = name.right_string (name.length() - slash_idx - 1);
 
-      String initial = name.cut_string (0,1);
-      initial.to_upper();
-      name = name.nomid_string (0,1);
-      name.to_lower();
+      String initial = name.cut_string (0, 1);
+      initial.to_upper ();
+      name = name.nomid_string (0, 1);
+      name.to_lower ();
       ps_name = initial + name;
     }
   else if (ps_name_str0)
     ps_name = ps_name_str0;
-  
+
   if (ps_name.length ())
     {
       ((Pango_font *) this)->register_font_file (filename, ps_name);
       pango_fc_font_unlock_face (fcfont);
-      
+
       SCM expr = scm_list_4 (ly_symbol2scm ("glyph-string"),
                             scm_makfrom0str (ps_name.to_str0 ()),
                             scm_from_double (size),
@@ -178,7 +178,7 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con
     }
   else
     {
-      warning (_ ("FreeType face has no PostScript font name."));      
+      warning (_ ("FreeType face has no PostScript font name."));
       return Stencil();
     }
 }
@@ -196,7 +196,7 @@ Pango_font::text_stencil (String str) const
                                str.to_str0 (),
                                0, str.length (), attribute_list_,
                                NULL);
-  
+
   GList *ptr = items;
   Stencil dest;
   Real x = 0.0;
@@ -207,10 +207,10 @@ Pango_font::text_stencil (String str) const
       Stencil item_stencil = pango_item_string_stencil (item, str, x);
 
       x = item_stencil.extent (X_AXIS)[RIGHT];
-      
+
       dest.add_stencil (item_stencil);
-      
-      ptr = ptr->next;      
+
+      ptr = ptr->next;
     }
 
   /*
@@ -235,12 +235,12 @@ Pango_font::text_stencil (String str) const
       b.unite (dest.extent_box ());
       return Stencil (b, exp);
     }
-  
+
 #if 0
   // check extents.
   if (!dest.extent_box ()[X_AXIS].is_empty ())
     {
-      Stencil frame = Lookup::frame (dest.extent_box(), 0.1, 0.1);
+      Stencil frame = Lookup::frame (dest.extent_box (), 0.1, 0.1);
       dest.add_stencil (frame);
     }
 #endif
@@ -249,7 +249,7 @@ Pango_font::text_stencil (String str) const
 }
 
 
-SCM 
+SCM
 Pango_font::font_file_name () const
 {
   return SCM_BOOL_F;
@@ -261,10 +261,10 @@ Pango_font::font_file_name () const
 
 
 #if 0
-void test_pango()
+void test_pango ()
 {
   int dpi = 1200;
-  
+
   char * font_family = "Emmentaler";
   PangoContext * pango_context =
     pango_ft2_get_context (dpi, dpi);
@@ -277,16 +277,16 @@ void test_pango()
 
   PangoAttrList *attr_list = pango_attr_list_new();
   char *str = "sfz";
-  GList * items = pango_itemize (pango_context, str, 0, strlen(str),
-                                attr_list, NULL);
-  
-  
-  GList * ptr = items;
+  GList *items = pango_itemize (pango_context, str, 0, strlen (str),
+                               attr_list, NULL);
+
+
+  GList *ptr = items;
   while (ptr)
     {
       PangoItem *item = (PangoItem*)ptr->data;
       printf( "off %d len %d num %d\n", item->offset, item->length, item->num_chars);
-      
+
       PangoAnalysis paobj = item->analysis;
       PangoAnalysis * pa = &paobj;
 
@@ -296,36 +296,36 @@ void test_pango()
              pango_font_description_to_string (descr),
              pango_font_description_to_filename (descr)
              );
-      
-      printf ("type name %s\n", g_type_name (G_TYPE_FROM_INSTANCE(pa->font)));
-      PangoFcFont * fcfont = G_TYPE_CHECK_INSTANCE_CAST(pa->font,
-                                                       PANGO_TYPE_FC_FONT,
-                                                       PangoFcFont);
+
+      printf ("type name %s\n", g_type_name (G_TYPE_FROM_INSTANCE (pa->font)));
+      PangoFcFont * fcfont = G_TYPE_CHECK_INSTANCE_CAST (pa->font,
+                                                        PANGO_TYPE_FC_FONT,
+                                                        PangoFcFont);
 
       FcPattern *fcpat = fcfont->font_pattern;
       FcPatternPrint (fcpat);
       char *retval ="bla";
-      
+
       FcPatternGetString(fcpat, FC_FILE, 0, (FcChar8 **) &retval);
       printf ("retval %s\n", retval);
 
       FT_Face ftface = pango_fc_font_lock_face (fcfont);
 
       printf ("shape %ux %s lang %ux font %ux languagae %ux\nft face %ux\n", pa->shape_engine,
-             G_OBJECT_TYPE_NAME(pa->shape_engine),
+             G_OBJECT_TYPE_NAME (pa->shape_engine),
              pa->lang_engine, pa->font, pa->language, ftface);
 
-      PangoGlyphString *pgs = pango_glyph_string_new();
-      pango_shape (str, strlen(str), pa, pgs); 
+      PangoGlyphString *pgs = pango_glyph_string_new ();
+      pango_shape (str, strlen (str), pa, pgs);
 
       int i;
       for (i = 0; i < pgs->num_glyphs; i++)
        {
          PangoGlyphInfo *pgi = pgs->glyphs + i;
-         
+
          PangoGlyph pg = pgi->glyph;
          PangoGlyphGeometry ggeo = pgi->geometry;
-         
+
          printf ("c %d w %d x %d y %d\n", pg, ggeo.width, ggeo.x_offset,
                  ggeo.y_offset );
 
@@ -337,12 +337,11 @@ void test_pango()
 
       PangoRectangle r1;
       PangoRectangle r2;
-      
+
       pango_glyph_string_extents (pgs, pa->font, &r1, &r2);
-      
+
       ptr = ptr->next;
       printf ("\nnext item\n");
     }
-
 }
 #endif
index 5e5fd6c2c1bf8650fbda64ab9befd884b951f90d..2373646886a10467f906d5920bc20d3cd2a0c723 100644 (file)
@@ -545,6 +545,11 @@ AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
 ])
 
 
+AC_DEFUN(STEPMAKE_DLOPEN, [
+    AC_CHECK_LIB(dl, dlopen)
+    AC_CHECK_FUNCS(dlopen)
+])
+
 AC_DEFUN(STEPMAKE_GXX, [
     if test "$GXX" = "yes"; then
         STEPMAKE_CHECK_VERSION(CXX, $1, $2)
@@ -769,6 +774,7 @@ AC_DEFUN(STEPMAKE_KPATHSEA, [
     [  --with-kpathsea         use kpathsea lib.  Default: on],
     [kpathsea_b=$with_kpathsea])
 
+    save_LIBS="$LIBS"
     if test "$kpathsea_b" != "no"; then        
        AC_CHECK_HEADERS([kpathsea/kpathsea.h],,kpathsea_b=no)
        AC_CHECK_LIB(kpathsea, kpse_find_file)
@@ -784,6 +790,8 @@ AC_DEFUN(STEPMAKE_KPATHSEA, [
            STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
        fi
     fi
+    KPATHSEA_LIBS="$LIBS"
+    LIBS="$save_LIBS"
     AC_MSG_CHECKING(whether to use kpathsea)
     if test "$kpathsea_b" != no; then
         AC_MSG_RESULT(yes)
@@ -794,6 +802,7 @@ AC_DEFUN(STEPMAKE_KPATHSEA, [
     fi
 
     AC_SUBST(KPATHSEA)
+    AC_SUBST(KPATHSEA_LIBS)
     AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
 ])