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.
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
PACKAGE_NAME=LilyPond
+
MAJOR_VERSION=2
MINOR_VERSION=5
PATCH_LEVEL=14
#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@"
# 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
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
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.
#define PATHSEP ':'
#endif
+Array<String>
+File_path::paths () const
+{
+ return *this;
+}
+
void
File_path::parse_path (String p)
{
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;
#include "main.hh"
#include "warn.hh"
+#include "file-path.hh"
void
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 ()));
}
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?
#include "kpath.hh"
#include "lily-guile.hh"
#include "lily-version.hh"
+#include "version.hh"
#include "misc.hh"
#include "output-def.hh"
#include "warn.hh"
/* 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;
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
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 ("");
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
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);
call_constructors ();
init_global_tweak_registry ();
init_fontconfig ();
+ test_pango();
+
init_freetype ();
is_pango_format_global = (output_backend_global != "tex"
#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");
+ }
+
+}
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]'`
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}"])