]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/font-config.cc (init_fontconfig): add
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 6 Mar 2005 12:47:30 +0000 (12:47 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 6 Mar 2005 12:47:30 +0000 (12:47 +0000)
prefix/{otf,type1,mf/out} to fontconfig path.

* lily/main.cc: only look at one prefix directory, LILYPONDPREFIX
overrides all.

* configure.in (gui_b): remove ec mftrace check

* config.hh.in: use lilypond-Major.Minor as data directory.

12 files changed:
ChangeLog
VERSION
config.hh.in
config.make.in
configure.in
flower/file-path.cc
flower/include/file-path.hh
lily/font-config.cc
lily/include/main.hh
lily/main.cc
lily/pango-font.cc
stepmake/aclocal.m4

index 745c20789716b13c31e21bc81f1c5df837f753bf..9ec842e41600b9ce481945044d0490017d1dbcda 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2005-03-06  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/font-config.cc (init_fontconfig): add
+       prefix/{otf,type1,mf/out} to fontconfig path.
+
+       * lily/main.cc: only look at one prefix directory, LILYPONDPREFIX
+       overrides all. 
+
+       * config.make (package_suffix): use lilypond/MAJOR.MINOR as install
+       directory.
+
+       * configure.in (gui_b): remove ec mftrace check
+
+       * config.hh.in: use lilypond-Major.Minor as data directory.
+
        * scm/framework-ps.scm (dump-page): use output-units for landscape.
 
        * buildscripts/gen-emmentaler-scripts.py (i): lower case file
diff --git a/VERSION b/VERSION
index f2bd041d8b00b99ba720fe1b1f0df77f96f5d59f..b54a42ecf3f3d4d29b41ac46c9b07747d317b0ee 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,5 @@
 PACKAGE_NAME=LilyPond
+
 MAJOR_VERSION=2
 MINOR_VERSION=5
 PATCH_LEVEL=14
index e04b6d163e5cd57b6e0ea741cb8ce2eb395fe26c..dff59ec5b23590f1fba825e8087044e8cb4559e9 100644 (file)
@@ -2,18 +2,16 @@
 
 #define PACKAGE "@package@"
 
-#define TOPLEVEL_VERSION "@TOPLEVEL_VERSION@"
-
 /* datadir */
 #define DATADIR "@DATADIR@"
 
 /* LilyPond init and input base directory */
-#define PACKAGE_DATADIR DATADIR "/" PACKAGE
-#define LILYPOND_DATADIR PACKAGE_DATADIR
 
-/* LilyPond specific init and input directory */
-#define LOCAL_PACKAGE_DATADIR PACKAGE_DATADIR "/" TOPLEVEL_VERSION
-#define LOCAL_LILYPOND_DATADIR LOCAL_PACKAGE_DATADIR
+/*
+urg.
+*/
+/* #define PACKAGE_DATADIR DATADIR "/" PACKAGE "@TOPLEVEL_MAJOR_VERSION@.@TOPLEVEL_MINOR_VERSION@" @MAJOR_VERSION@
+#define LILYPOND_DATADIR PACKAGE_DATADIR */
 
 /* default lilypond locale dir */
 #define LOCALEDIR "@LOCALEDIR@"
index 61d3d45d6c23ce80ec94f376dc360cb3b11e3a1d..e8a36b5d5f54a059e5c2684448cb0818e39ba45d 100644 (file)
@@ -40,17 +40,18 @@ elispdir = $(datadir)/emacs/site-lisp
 # forced instead of $(datadir)/vim
 
 # move out of config.make.in?
-package_datadir = $(datadir)/$(package)
-package_infodir = $(infodir)/$(package)
-package_libdir = $(libdir)/$(package)
-package_docdir = $(docdir)/$(package)
-package_omfdir = $(omfdir)/$(package)
+package_suffix = $(package)$(MAJOR_VERSION).$(MINOR_VERSION)
+package_datadir = $(datadir)/$(package_suffix)
+package_infodir = $(infodir)/$(package_suffix)
+package_libdir = $(libdir)/$(package_suffix)
+package_docdir = $(docdir)/$(package_suffix)
+package_omfdir = $(omfdir)/$(package_suffix)
 
 
-local_package_datadir = $(lilypond_datadir)/$(TOPLEVEL_VERSION)
-local_package_libdir = $(lilypond_libdir)/$(TOPLEVEL_VERSION)
-local_package_docdir = $(lilypond_docdir)/$(TOPLEVEL_VERSION)
-local_package_omfdir = $(lilypond_omfdir)/$(TOPLEVEL_VERSION)
+local_package_datadir = $(lilypond_datadir)
+local_package_libdir = $(lilypond_libdir)
+local_package_docdir = $(lilypond_docdir)
+local_package_omfdir = $(lilypond_omfdir)
 
 vimdir = $(local_package_datadir)/vim
 
index cf7f73662158c11f6074c8b82724638d7cc76454..f9ba2e2fabbaa908228f73d6947f11b8b34d1715 100644 (file)
@@ -63,33 +63,13 @@ STEPMAKE_PATH_PROG(FONTFORGE, fontforge, REQUIRED, 20041208)
 
 AC_CHECK_HEADERS([assert.h libio.h sys/stat.h])
 AC_LANG_PUSH(C++)
-AC_CHECK_HEADERS([sstream])
+1AC_CHECK_HEADERS([sstream])
 AC_LANG_POP(C++)
 AC_HEADER_STAT
 AC_FUNC_MEMCMP
 AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([fopencookie funopen gettext isinf memmem snprintf vsnprintf])
 
-AC_MSG_CHECKING([for ec-fonts-mftraced])
-ecb10=`kpsewhich ecb10.pfa 2>/dev/null`
-if test -n "$ecb10"; then
-    AC_MSG_RESULT([$ecb10])
-else
-    AC_MSG_RESULT(no)
-    AC_MSG_CHECKING([for lmodern])
-    lmr10=`kpsewhich lmr10.pfb 2>/dev/null`
-    if test -n "$lmr10"; then
-       AC_MSG_RESULT([$lmr10])
-    else
-       STEPMAKE_ADD_ENTRY(REQUIRED, 'package ec-fonts-mftraced >= 1.0.5')
-       AC_MSG_CHECKING([for old version of ec-fonts-mftraced])
-       ecrm10=`kpsewhich ecrm10.pfa 2>/dev/null`
-       if test -n "$ecrm10"; then
-           AC_MSG_RESULT([$ecrm10])
-           AC_MSG_WARN([old version of ec-fonts-mftraced found, install 1.0.5 or newer])
-       fi
-    fi
-fi
 
 if test "$gui_b" = "yes"; then
     STEPMAKE_GTK2
@@ -120,7 +100,6 @@ if test "$optimise_b" = yes; then
     AC_DEFINE(STRINGS_UTILS_INLINED)
 fi
 
-AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, "${FULL_VERSION}")
 AC_DEFINE_UNQUOTED(FLOWER_VERSION, "${FULL_FLOWER_VERSION}")
 
 # Gather requirements and generate output.
index 0973275be42efd355d184a8cb70df5527f247412..fa113fad712e2e5bc400384e65d8b707fd8d3f02 100644 (file)
 #define PATHSEP ':'
 #endif
 
+Array<String>
+File_path::paths () const
+{
+  return *this;
+}
+
 void
 File_path::parse_path (String p)
 {
index 6a73ef37ad27f2bc9b82c87e7fec979c6995ecd6..9f0ef04c3c6e9d6719e2c5cc83139cdd77b0b1c1 100644 (file)
@@ -24,6 +24,7 @@
 class File_path : private Array<String>
 {
 public:
+  Array<String> paths () const;
   String find (String name) const;
   String find (String name, char const *extensions[]);
   String to_string () const;
index 0fde98731da633dbf58c919274abf48f82da8ffc..48b4fba100b95591e41ae71d0a92f0292c1f6390 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "main.hh"
 #include "warn.hh"
+#include "file-path.hh"
 
 void
 init_fontconfig ()
@@ -24,12 +25,18 @@ init_fontconfig ()
       error ("FontConfig failed to initialize"); 
     }
 
-  char const **dirs = prefix_directories;
-  for (; *dirs; dirs++)
+  FcConfig *fcc = FcConfigGetCurrent ();
+
+  
+  Array<String> dirs;
+  dirs.push (prefix_directory + "/otf/");
+  dirs.push (prefix_directory + "/mf/out/");
+  dirs.push (prefix_directory + "/type1/");
+  
+  for (int i = 0; i < dirs.size(); i++)
     {
-      String path = String (*dirs) + "/" + "otf";
-      
-      if (!FcConfigAppFontAddDir (0, (FcChar8*)path.to_str0 ()))
+      String path = dirs[i];
+      if (!FcConfigAppFontAddDir (fcc, (FcChar8*)path.to_str0 ()))
        {
          error (_f ("Failed to add lilypond directory %s", path.to_str0 ()));
        }
index e0038dd6dd327dbf9bf5a4b212aaac8a21bf5436..153c7a1b3c06650e022b2119effee8d0259e0d4f 100644 (file)
@@ -33,7 +33,7 @@ extern bool be_safe_global;
 extern bool be_verbose_global;
 extern bool do_internal_type_checking_global;
 extern bool is_pango_format_global;
-extern char const *prefix_directories[];
+extern String prefix_directory;
 
 /*
   todo: collect in Output_option struct? 
index d62189bcfb68e47106beea62fcb722c3b72741ba..2cc277b857dc76e24265ebede7b84151344b53ee 100644 (file)
@@ -30,6 +30,7 @@
 #include "kpath.hh"
 #include "lily-guile.hh"
 #include "lily-version.hh"
+#include "version.hh"
 #include "misc.hh"
 #include "output-def.hh"
 #include "warn.hh"
@@ -112,8 +113,8 @@ _i ("    This program is free software; you can redistribute it and/or\n"
 
 /* Where the init files live.  Typically:
    LILYPOND_DATADIR = /usr/share/lilypond
-   LOCAL_LILYPOND_DATADIR = /usr/share/lilypond/<VERSION> */
-char const *prefix_directories[] = {LILYPOND_DATADIR, LOCAL_LILYPOND_DATADIR, 0};
+*/
+String prefix_directory;
 
 /* The jail specification: USER,GROUP,JAIL,DIR. */
 String jail_spec;
@@ -157,13 +158,7 @@ static void
 dir_info (FILE *out)
 {
   fputs ("\n", out);
-  fprintf (out, "LILYPOND_DATADIR =\"%s\"\n", LILYPOND_DATADIR);
-  fprintf (out, "LOCAL_LILYPOND_DATADIR =\"\%s\"\n", LOCAL_LILYPOND_DATADIR);
-  fprintf (out, "LOCALEDIR =\"%s\"\n", LOCALEDIR);
-
-  char *lilypond_prefix = getenv ("LILYPONDPREFIX");
-  fprintf (out, "LILYPONDPREFIX =\"%s\"\n",
-          (lilypond_prefix ? lilypond_prefix : ""));
+  fprintf (out, "Directory prefix: \"%s\"\n", prefix_directory.to_str0());
 }
 
 static void
@@ -225,8 +220,9 @@ warranty ()
 static void
 setup_paths ()
 {
-  if (char const *lilypond_prefix = getenv ("LILYPONDPREFIX"))
-    prefix_directories[1] = lilypond_prefix;
+  prefix_directory = DATADIR "/lilypond/" MAJOR_VERSION "." MINOR_VERSION;
+  if (char const * env = getenv ("LILYPONDPREFIX"))
+    prefix_directory = env;
 
   global_path.append ("");
 
@@ -235,19 +231,18 @@ setup_paths ()
   char *suffixes[] = {"ly", "cff", "otf", "mf/out", "scm", "tfm", "ps", "svg",
                      0};
 
-  for (unsigned i = 0; prefix_directories[i]; i++)
-    for (char **s = suffixes; *s; s++)
-      {
-       String p = prefix_directories[i] + to_string ('/') + String (*s);
-       global_path.prepend (p);
+  for (char **s = suffixes; *s; s++)
+    {
+      String path = prefix_directory + to_string ('/') + String (*s);
+      global_path.prepend (path);
        
 #if !KPATHSEA
        /* Urg: GNU make's $ (word) index starts at 1 */
        int i  = 1;
-       while (global_path.try_append (p + to_string (".") + to_string (i)))
+       while (global_path.try_append (path + to_string (".") + to_string (i)))
          i++;
 #endif
-      }
+    }
 }
   
 static void
@@ -342,18 +337,15 @@ do_chroot_jail ()
       exit (3);
     }
 }
-
+void test_pango();
 static void
 main_with_guile (void *, int, char **)
 {
   /* Engravers use lily.scm contents, need to make Guile find it.
      Prepend onto GUILE %load-path, very ugh. */
-  for (unsigned i = 0; prefix_directories[i]; i++)
-    {
-      prepend_load_path (prefix_directories[i]);
-      /* Junk this.  We should make real modules iso. just loading files. */
-      prepend_load_path (String (prefix_directories[i]) + "/scm");
-    }
+
+  prepend_load_path (prefix_directory);
+  prepend_load_path (prefix_directory + "/scm");
 
   if (be_verbose_global)
     dir_info (stderr);
@@ -362,6 +354,8 @@ main_with_guile (void *, int, char **)
   call_constructors ();
   init_global_tweak_registry ();
   init_fontconfig ();
+  test_pango();
+  
   init_freetype ();
 
   is_pango_format_global = (output_backend_global != "tex"
index 1101a8d8d50f2c8dd84377e0c0a75cabdfe5ea4b..f314c23e5e448ddf2e06366f7dc4e3dbde030439 100644 (file)
@@ -222,3 +222,90 @@ Pango_font::font_file_name () const
 
 #endif
 
+
+
+
+void test_pango()
+{
+  int dpi = 1200;
+  
+  char * font_family = "Emmentaler";
+  PangoContext * pango_context =
+    pango_ft2_get_context (dpi, dpi);
+  PangoFontDescription *font_description;
+  font_description = pango_font_description_new ();
+  pango_font_description_set_family (font_description, g_strdup (font_family));
+  pango_font_description_set_style (font_description, (PangoStyle) 20);
+  pango_context_set_font_description (pango_context, font_description);
+
+
+  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;
+  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;
+
+      PangoFontDescription *descr = pango_font_describe (pa->font);
+      //      assert (font_description == descr);
+      printf ("font descr string '%s' fname '%s'",
+             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);
+
+      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),
+             pa->lang_engine, pa->font, pa->language, ftface);
+
+      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 );
+
+         char str[1024];
+         FT_Get_Glyph_Name (ftface, pg, str, 1024);
+         printf ("glyph %s\n", str);
+       }
+      printf ("\nPS name %s\n", FT_Get_Postscript_Name (ftface));
+
+      PangoRectangle r1;
+      PangoRectangle r2;
+      
+      pango_glyph_string_extents (pgs, pa->font, &r1, &r2);
+      
+      ptr = ptr->next;
+      printf ("\nnext item\n");
+    }
+
+}
index 4ac3545c4f39437c2c00b215ff952f590b056d20..5e5fd6c2c1bf8650fbda64ab9befd884b951f90d 100644 (file)
@@ -563,7 +563,7 @@ AC_DEFUN(STEPMAKE_INIT, [
     if test x$MY_PATCH_LEVEL != x; then
        FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
     fi
-
+    export MAJOR_VERSION MINOR_VERSION PATCH_LEVEL
     # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
     changequote(<<, >>)dnl
     PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
@@ -642,6 +642,9 @@ AC_DEFUN(STEPMAKE_INIT, [
     AC_SUBST(package)
     AC_SUBST(PACKAGE)
     AC_SUBST(PACKAGE_NAME)
+    AC_SUBST(MAJOR_VERSION)
+    AC_SUBST(MINOR_VERSION)
+    
     # We don't need the upper case variant,
     # so stick to macros are uppercase convention.
     # AC_DEFINE_UNQUOTED(package, ["${package}"])