From: Han-Wen Nienhuys Date: Sun, 6 Mar 2005 12:47:30 +0000 (+0000) Subject: * lily/font-config.cc (init_fontconfig): add X-Git-Tag: release/2.5.14~21 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=4982743be15a9272d3130ff9124be1d284b0df9c;p=lilypond.git * 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. * configure.in (gui_b): remove ec mftrace check * config.hh.in: use lilypond-Major.Minor as data directory. --- diff --git a/ChangeLog b/ChangeLog index 745c207897..9ec842e416 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2005-03-06 Han-Wen Nienhuys + * 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 f2bd041d8b..b54a42ecf3 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,5 @@ PACKAGE_NAME=LilyPond + MAJOR_VERSION=2 MINOR_VERSION=5 PATCH_LEVEL=14 diff --git a/config.hh.in b/config.hh.in index e04b6d163e..dff59ec5b2 100644 --- a/config.hh.in +++ b/config.hh.in @@ -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@" diff --git a/config.make.in b/config.make.in index 61d3d45d6c..e8a36b5d5f 100644 --- a/config.make.in +++ b/config.make.in @@ -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 diff --git a/configure.in b/configure.in index cf7f736621..f9ba2e2fab 100644 --- a/configure.in +++ b/configure.in @@ -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. diff --git a/flower/file-path.cc b/flower/file-path.cc index 0973275be4..fa113fad71 100644 --- a/flower/file-path.cc +++ b/flower/file-path.cc @@ -27,6 +27,12 @@ #define PATHSEP ':' #endif +Array +File_path::paths () const +{ + return *this; +} + void File_path::parse_path (String p) { diff --git a/flower/include/file-path.hh b/flower/include/file-path.hh index 6a73ef37ad..9f0ef04c3c 100644 --- a/flower/include/file-path.hh +++ b/flower/include/file-path.hh @@ -24,6 +24,7 @@ class File_path : private Array { public: + Array paths () const; String find (String name) const; String find (String name, char const *extensions[]); String to_string () const; diff --git a/lily/font-config.cc b/lily/font-config.cc index 0fde98731d..48b4fba100 100644 --- a/lily/font-config.cc +++ b/lily/font-config.cc @@ -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 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 ())); } diff --git a/lily/include/main.hh b/lily/include/main.hh index e0038dd6dd..153c7a1b3c 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -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? diff --git a/lily/main.cc b/lily/main.cc index d62189bcfb..2cc277b857 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -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/ */ -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" diff --git a/lily/pango-font.cc b/lily/pango-font.cc index 1101a8d8d5..f314c23e5e 100644 --- a/lily/pango-font.cc +++ b/lily/pango-font.cc @@ -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"); + } + +} diff --git a/stepmake/aclocal.m4 b/stepmake/aclocal.m4 index 4ac3545c4f..5e5fd6c2c1 100644 --- a/stepmake/aclocal.m4 +++ b/stepmake/aclocal.m4 @@ -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}"])