From: Han-Wen Nienhuys Date: Sun, 6 Mar 2005 14:46:28 +0000 (+0000) Subject: * mf/GNUmakefile: generate .commonff to not confuse fontconfig. X-Git-Tag: release/2.5.14~19 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0e433931d31d0dd88cb8a127f72ef55303ff5b2c;p=lilypond.git * mf/GNUmakefile: generate .commonff to not confuse fontconfig. * ly/generate-embedded-cff.ly: capitalize. * lily/pango-select.cc (select_pango_font): use ::find_pango_font, so as to register the pango font. * lily/main.cc: only look at one prefix directory, LILYPONDPREFIX overrides all. * scm/framework-ps.scm (dump-page): use output-units for landscape. --- diff --git a/ChangeLog b/ChangeLog index 5ce25a2d5d..e5283499d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-03-06 Han-Wen Nienhuys + * mf/GNUmakefile: generate .commonff to not confuse fontconfig. + + * ly/generate-embedded-cff.ly: capitalize. + * lily/pango-select.cc (select_pango_font): use ::find_pango_font, so as to register the pango font. diff --git a/lily/main.cc b/lily/main.cc index a843ca4f24..3ad0b6645e 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -337,7 +337,9 @@ do_chroot_jail () exit (3); } } + void test_pango(); + static void main_with_guile (void *, int, char **) { @@ -394,7 +396,6 @@ main_with_guile (void *, int, char **) SCM result = scm_call_1 (ly_lily_module_constant ("lilypond-main"), files); (void) result; - /* Unreachable. */ exit (0); } @@ -425,7 +426,6 @@ add_output_format (String format) output_format_global += format; } - static void parse_argv (int argc, char **argv) { diff --git a/lily/pango-font.cc b/lily/pango-font.cc index f314c23e5e..92fe8aea50 100644 --- a/lily/pango-font.cc +++ b/lily/pango-font.cc @@ -128,15 +128,40 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con FcPattern *fcpat = fcfont->font_pattern; char *filename = 0; FcPatternGetString(fcpat, FC_FILE, 0, (FcChar8 **) &filename); - char const *ps_name = FT_Get_Postscript_Name (ftface); + char const *ps_name_str0 = FT_Get_Postscript_Name (ftface); + - if (ps_name) + /* + UGH: kludge a PS name for OTF fonts. + */ + String ps_name; + if (!ps_name_str0 + && filename + && String (filename).index (".otf") >= 0) + { + String name = filename; + name = name.left_string (name.length () - name.index (".otf")); + + int slash_idx = name.index_last ('/'); // UGh. What's happens on windows? + if (slash_idx >= 0) + name = name.right_string (name.length() - slash_idx); + + 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), + scm_makfrom0str (ps_name.to_str0 ()), scm_from_double (size), ly_quote_scm (glyph_exprs)); @@ -189,11 +214,13 @@ Pango_font::text_stencil (String str) const /* For Pango based backends, we take a shortcut. */ + char *descr_string = pango_font_description_to_string (pango_description_); SCM exp = scm_list_3 (ly_symbol2scm ("utf8-string"), - scm_makfrom0str (pango_font_description_to_string (pango_description_)), + scm_makfrom0str (descr_string), scm_makfrom0str (str.to_str0 ())); + g_free (descr_string); Box b (Interval (0, 0), Interval (0, 0)); b.unite (dest.extent_box ()); @@ -224,7 +251,7 @@ Pango_font::font_file_name () const - +#if 0 void test_pango() { int dpi = 1200; @@ -309,3 +336,4 @@ void test_pango() } } +#endif diff --git a/lily/pango-select.cc b/lily/pango-select.cc index ae3e86cdb5..2d7538306d 100644 --- a/lily/pango-select.cc +++ b/lily/pango-select.cc @@ -58,7 +58,7 @@ select_pango_font (Output_def *layout, SCM chain) char * str = pango_font_description_to_string (pfd); SCM scm_str = scm_makfrom0str (str); - gfree (str); + g_free (str); return find_pango_font (layout, scm_str, 1.0); } diff --git a/ly/generate-embedded-cff.ly b/ly/generate-embedded-cff.ly index b0f1cf1d32..1d7882ad5f 100644 --- a/ly/generate-embedded-cff.ly +++ b/ly/generate-embedded-cff.ly @@ -11,12 +11,12 @@ out-port) )) -#(write-cff "emmentaler-26" "emmentaler-26.cff") -#(write-cff "emmentaler-23" "emmentaler-23.cff") -#(write-cff "emmentaler-20" "emmentaler-20.cff") -#(write-cff "emmentaler-18" "emmentaler-18.cff") -#(write-cff "emmentaler-16" "emmentaler-16.cff") -#(write-cff "emmentaler-14" "emmentaler-14.cff") -#(write-cff "emmentaler-13" "emmentaler-13.cff") -#(write-cff "emmentaler-11" "emmentaler-11.cff") -#(write-cff "aybabtu" "aybabtu.cff") +#(write-cff "Emmentaler-26" "emmentaler-26.commonff") +#(write-cff "Emmentaler-23" "emmentaler-23.commonff") +#(write-cff "Emmentaler-20" "emmentaler-20.commonff") +#(write-cff "Emmentaler-18" "emmentaler-18.commonff") +#(write-cff "Emmentaler-16" "emmentaler-16.commonff") +#(write-cff "Emmentaler-14" "emmentaler-14.commonff") +#(write-cff "Emmentaler-13" "emmentaler-13.commonff") +#(write-cff "Emmentaler-11" "emmentaler-11.commonff") +#(write-cff "aybabtu" "aybabtu.commonff") diff --git a/mf/GNUmakefile b/mf/GNUmakefile index 988d61a402..8082c40058 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -26,7 +26,7 @@ OTF_TABLES = $(addsuffix .otf-table, $(addprefix $(outdir)/feta, $(STAFF_SIZES)) $(BRACES:%=$(outdir)/feta-braces-%.otf-table) FETA_FONTS = $(FETA_MF_FILES:.mf=) SVG_FILES = $(OTF_FILES:%.otf=%.svg) $(ALL_FONTS:%=$(outdir)/%.svg) -CFF_FILES = $(OTF_FILES:%.otf=%.cff) +COMMONFF_FILES = $(OTF_FILES:%.otf=%.commonff) CFF_PS_FILES = $(OTF_FILES:%.otf=%.cff.ps) @@ -59,10 +59,11 @@ foe: echo $(TEXMF) kpsewhich exbase.mf -$(outdir)/%.cff $(outdir)/%.otf $(outdir)/%.svg: $(outdir)/%.pe - (cd $(outdir) && fontforge -script $(notdir $<)) +$(outdir)/%.commonff $(outdir)/%.otf $(outdir)/%.svg: $(outdir)/%.pe + (cd $(outdir) && fontforge -script $(notdir $<) \ + && mv $(notdir $(basename $<)).cff $(notdir $(basename $<)).commonff) -$(CFF_PS_FILES): $(CFF_FILES) +$(CFF_PS_FILES): $(COMMONFF_FILES) cd $(outdir) && $(builddir)/lily/$(outconfbase)/lilypond --verbose $(abs-srcdir)/ly/generate-embedded-cff $(outdir)/%.otf-table: $(outdir)/%.lisp $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) @@ -90,7 +91,7 @@ ALL_GEN_FILES= $(TFM_FILES) $(TEXTABLES) $(TFM_FILES) $(LOG_FILES) $(ENC_FILES) INSTALLATION_DIR=$(local_lilypond_datadir)/fonts/source INSTALLATION_FILES=$(MF_FILES) $(AF_FILES) -INSTALLATION_OUT_SUFFIXES=1 2 3 4 5 6 7 8 9 +INSTALLATION_OUT_SUFFIXES=1 2 3 4 5 6 7 9 INSTALLATION_OUT_DIR1=$(local_lilypond_datadir)/tex INSTALLATION_OUT_FILES1=$(TEXTABLES) @@ -105,7 +106,6 @@ INSTALLATION_OUT_FILES3=$(TFM_FILES) INSTALLATION_OUT_DIR4=$(local_lilypond_datadir)/ps INSTALLATION_OUT_FILES4=$(CFF_PS_FILES) - INSTALLATION_OUT_DIR5=$(local_lilypond_datadir)/fonts/type1 INSTALLATION_OUT_FILES5=$(PFA_FILES) @@ -115,10 +115,6 @@ INSTALLATION_OUT_FILES6=$(outdir)/lilypond.map INSTALLATION_OUT_DIR7=$(local_lilypond_datadir)/ps/ INSTALLATION_OUT_FILES7=$(ENC_FILES) -# install in fonts/cff or ps/ directory? -INSTALLATION_OUT_DIR8=$(local_lilypond_datadir)/cff -INSTALLATION_OUT_FILES8=$(CFF_FILES) - INSTALLATION_OUT_DIR9=$(local_lilypond_datadir)/svg INSTALLATION_OUT_FILES9=$(SVG_FILES) diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 4019a3469d..63d63488b2 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -237,7 +237,6 @@ ((and bare-file-name (string-match "\\.otf" bare-file-name)) - (display "HOI\n") (cached-file-contents (string-regexp-substitute "otf" "cff.ps" bare-file-name))) ((and bare-file-name (string-match "\\.ttf" bare-file-name)) (ly:ttf->pfa bare-file-name))