From 349f599ad3c120db8c82e4d7139b0914f484ed19 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 5 Apr 2004 21:12:43 +0000 Subject: [PATCH] * lily/font-metric.cc (get_encoded_index): New function. * lily/include/font-metric.hh (coding_scheme): New method. --- ChangeLog | 6 ++ lily/afm.cc | 117 ++++++++++-------------- lily/all-font-metrics.cc | 87 ++++++++---------- lily/font-metric.cc | 89 ++++++++++-------- lily/includable-lexer.cc | 2 +- lily/include/afm.hh | 21 +++-- lily/include/font-metric.hh | 13 ++- lily/include/parse-scm.hh | 15 ++- lily/include/scaled-font-metric.hh | 11 ++- lily/include/source.hh | 20 ++-- lily/include/tfm-reader.hh | 6 +- lily/include/tfm.hh | 4 +- lily/include/virtual-font-metric.hh | 3 + lily/lily-guile.cc | 136 ++++++++++------------------ lily/paper-book.cc | 1 - lily/scaled-font-metric.cc | 19 ++-- lily/source.cc | 8 +- lily/tfm-reader.cc | 6 +- lily/tfm.cc | 83 ++++++++--------- lily/virtual-font-metric.cc | 48 ++++------ scm/define-markup-commands.scm | 6 +- scm/lily.scm | 14 +-- 22 files changed, 332 insertions(+), 383 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7e534ade1..ebd395ce1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2004-04-05 Jan Nieuwenhuizen + * lily/font-metric.cc (get_encoded_index): New function. + + * lily/include/font-metric.hh (coding_scheme): New method. + + * scm/encoding.scm: New file. + * mf/feta-beugel.mf: Better error message (WAS: `foobar'). 2004-04-05 Werner Lemberg diff --git a/lily/afm.cc b/lily/afm.cc index f24c80f7a8..2a84e60360 100644 --- a/lily/afm.cc +++ b/lily/afm.cc @@ -9,114 +9,102 @@ #include -#include "warn.hh" // error () +#include "warn.hh" #include "libc-extension.hh" #include "afm.hh" #include "stencil.hh" #include "dimensions.hh" -Adobe_font_metric::Adobe_font_metric (AFM_Font_info * fi) +Adobe_font_metric::Adobe_font_metric (AFM_Font_info *fi) { checksum_ = 0; - font_inf_ = fi; - + font_info_ = fi; design_size_ = 1.0; - for (int i= 256 >? fi->numOfChars; i--;) + for (int i = 256 >? fi->numOfChars; i--;) ascii_to_metric_idx_.push (-1); for (int i=0; i < fi->numOfChars; i++) { AFM_CharMetricInfo * c = fi->cmi + i; - /* - Some TeX afm files contain code = -1. We don't know why, let's - ignore it. - - */ + /* Some TeX afm files contain code = -1. We don't know why, + let's ignore it. */ if (c->code >= 0) ascii_to_metric_idx_[c->code] = i; name_to_metric_dict_[c->name] = i; } } +Adobe_font_metric::~Adobe_font_metric () +{ + AFM_free (font_info_); +} SCM Adobe_font_metric::make_afm (AFM_Font_info *fi, unsigned int checksum, Real design_size) { - Adobe_font_metric * fm = new Adobe_font_metric (fi); + Adobe_font_metric *fm = new Adobe_font_metric (fi); fm->checksum_ = checksum; fm->design_size_ = design_size; return fm->self_scm (); } - -AFM_CharMetricInfo const * +AFM_CharMetricInfo const* Adobe_font_metric::find_ascii_metric (int a) const { if (ascii_to_metric_idx_[a] >=0) { int code = ascii_to_metric_idx_[a]; - if (code>=0) - { - return font_inf_->cmi + code; - } + if (code >= 0) + return font_info_->cmi + code; } - return 0; } - - -AFM_CharMetricInfo const * +AFM_CharMetricInfo const* Adobe_font_metric::find_char_metric (String nm) const { int idx = name_to_index (nm); if (idx >= 0) - return font_inf_->cmi+ idx; - else - return 0; + return font_info_->cmi + idx; + return 0; } int -Adobe_font_metric::name_to_index (String nm)const +Adobe_font_metric::name_to_index (String name) const { - std::map::const_iterator ai = name_to_metric_dict_.find (nm); - + std::map::const_iterator ai = name_to_metric_dict_.find (name); if (ai == name_to_metric_dict_.end ()) return -1; - else - return (*ai).second; + return (*ai).second; } int Adobe_font_metric::count () const { - return font_inf_->numOfChars ; + return font_info_->numOfChars; } Box Adobe_font_metric::get_ascii_char (int code) const { - AFM_CharMetricInfo const - * c = find_ascii_metric (code); - Box b (Interval (0,0),Interval (0,0)); + AFM_CharMetricInfo const *c = find_ascii_metric (code); + Box b (Interval (0, 0), Interval (0, 0)); if (c) - b = afm_bbox_to_box (c->charBBox); - + b = afm_bbox_to_box (c->charBBox); return b; } - Box Adobe_font_metric::get_indexed_char (int code) const { - if (code>= 0) - return afm_bbox_to_box (font_inf_->cmi[code].charBBox); + if (code >= 0) + return afm_bbox_to_box (font_info_->cmi[code].charBBox); else - return Box (Interval (0,0),Interval (0,0)); + return Box (Interval (0, 0), Interval (0, 0)); } SCM @@ -135,18 +123,14 @@ read_afm_file (String nm) { fgets (s, sizeof (s), f); if (strncmp (s, check_key, strlen (check_key)) == 0) - { - sscanf (s + strlen (check_key), "%ud", &cs); - } + sscanf (s + strlen (check_key), "%ud", &cs); else if (strncmp (s, size_key, strlen (size_key)) == 0) - { - sscanf (s + strlen (size_key), "%lf", &ds); - } + sscanf (s + strlen (size_key), "%lf", &ds); } rewind (f); - AFM_Font_info * fi; + AFM_Font_info *fi; int ok = AFM_parseFile (f, &fi, ~1); if (ok) @@ -160,10 +144,8 @@ read_afm_file (String nm) } -/* - actually, AFMs will be printers point, usually, but our .py script dumps - real points. - */ +/* Actually, AFMs will be printers point, usually, but our .py script dumps + real points. */ Box afm_bbox_to_box (AFM_BBox bb) { @@ -173,19 +155,12 @@ afm_bbox_to_box (AFM_BBox bb) } Offset -Adobe_font_metric::get_indexed_wxwy (int k)const +Adobe_font_metric::get_indexed_wxwy (int k) const { - AFM_CharMetricInfo const *mi = font_inf_->cmi+ k; + AFM_CharMetricInfo const *mi = font_info_->cmi+ k; return 1/1000.0 PT * Offset (mi->wx, mi->wy); } - - -Adobe_font_metric::~Adobe_font_metric () -{ - AFM_free (font_inf_); -} - /* return a stencil, without fontification */ @@ -196,22 +171,18 @@ Adobe_font_metric::find_by_name (String s) const if (!cm) { - /* - Why don't we return empty? - */ - + /* FIXME: Why don't we return empty? */ Stencil m; m.set_empty (false); return m; } - - SCM at = (scm_list_n (ly_symbol2scm ("char"), - scm_int2num (cm->code), - SCM_UNDEFINED)); - - // at= fontify_atom ((Font_metric*)this, at); - Box b = afm_bbox_to_box (cm->charBBox); + SCM at = (scm_list_2 (ly_symbol2scm ("char"), scm_int2num (cm->code))); + +#if 0 + at = fontify_atom ((Font_metric*) this, at); +#endif + Box b = afm_bbox_to_box (cm->charBBox); return Stencil (b, at); } @@ -220,3 +191,9 @@ Adobe_font_metric::design_size () const { return design_size_; } + +String +Adobe_font_metric::coding_scheme () const +{ + return font_info_->gfi->encodingScheme; +} diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index 8015be782f..b961a7cc5d 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -19,7 +19,7 @@ #include "scm-hash.hh" #include "kpath.hh" -static const char * default_font_str0_ = "cmr10"; +static const char *default_font_str0_ = "cmr10"; All_font_metrics::All_font_metrics (String path) { @@ -38,68 +38,65 @@ All_font_metrics::~All_font_metrics () /* TODO: our AFM handling is broken: the units in an AFM file are relative to the design size (1000 units = 1 designsize). Hence we - should include design size when generating an AFM metric. + should include design size when generating an AFM metric. + + ugr: copied from find_tfm. */ Adobe_font_metric * All_font_metrics::find_afm (String name) { SCM sname = ly_symbol2scm (name.to_str0 ()); - SCM name_string = scm_makfrom0str (name.to_str0 ()); - SCM val; - if (!afm_p_dict_->try_retrieve (sname, &val)) { - String path; + String filename; - if (path.is_empty ()) - path = search_path_.find (name + ".afm"); + if (filename.is_empty ()) + filename = search_path_.find (name + ".afm"); - if (path.is_empty ()) + if (filename.is_empty ()) { String p = kpathsea_find_afm (name.to_str0 ()); if (p.length ()) - path = p; + filename = p; } - if (path.is_empty ()) + if (filename.is_empty ()) return 0; if (verbose_global_b) - progress_indication ("[" + path); - val = read_afm_file (path); - unsmob_metrics (val)->path_ = path; + progress_indication ("[" + filename); + val = read_afm_file (filename); + unsmob_metrics (val)->filename_ = filename; - unsmob_metrics (val)->description_ = gh_cons (name_string, gh_double2scm (1.0)); + unsmob_metrics (val)->description_ = gh_cons (name_string, + gh_double2scm (1.0)); if (verbose_global_b) progress_indication ("]"); - afm_p_dict_->set (sname,val); - + afm_p_dict_->set (sname, val); scm_gc_unprotect_object (val); - Adobe_font_metric *afm = dynamic_cast (unsmob_metrics (val)); - /* - only check checksums if there is one. We take the risk that - some file has valid checksum 0 - */ + /* Only check checksums if there is one. We take the risk that + some file has valid checksum 0 */ if (afm->checksum_) { Tex_font_metric * tfm = find_tfm (name); /* FIXME: better warning message - (maybe check upon startup for feta16.afm, feta16.tfm?) - */ + (maybe check upon startup for feta16.afm, feta16.tfm?) */ if (tfm && tfm->info_.checksum != afm->checksum_) { + // FIXME: broken sentence String s = _f ("checksum mismatch for font file: `%s'", - path.to_str0 ()); - s += " " + _f ("does not match: `%s'", tfm->path_.to_str0 ()); // FIXME + filename.to_str0 ()); + s += " " + _f ("does not match: `%s'", + tfm->filename_.to_str0 ()); s += "\n"; s += " TFM: " + to_string ((int) tfm->info_.checksum); s += " AFM: " + to_string ((int) afm->checksum_); @@ -120,57 +117,53 @@ All_font_metrics::find_afm (String name) } -Tex_font_metric * +Tex_font_metric* All_font_metrics::find_tfm (String name) { SCM sname = ly_symbol2scm (name.to_str0 ()); SCM name_string = scm_makfrom0str (name.to_str0 ()); - SCM val; if (!tfm_p_dict_->try_retrieve (sname, &val)) { - String path; + String filename; - if (path.is_empty ()) + if (filename.is_empty ()) { String p = kpathsea_find_tfm (name.to_str0 ()); if (p.length ()) - path = p; + filename = p; } - if (path.is_empty ()) - path = search_path_.find (name + ".tfm"); - if (path.is_empty ()) + if (filename.is_empty ()) + filename = search_path_.find (name + ".tfm"); + if (filename.is_empty ()) return 0; if (verbose_global_b) - progress_indication ("[" + path); + progress_indication ("[" + filename); - val = Tex_font_metric::make_tfm (path); + val = Tex_font_metric::make_tfm (filename); if (verbose_global_b) progress_indication ("]"); - unsmob_metrics (val)->path_ = path; - unsmob_metrics (val)->description_ = gh_cons (name_string, gh_double2scm (1.0)); + unsmob_metrics (val)->filename_ = filename; + unsmob_metrics (val)->description_ = gh_cons (name_string, + gh_double2scm (1.0)); tfm_p_dict_->set (sname, val); - scm_gc_unprotect_object (val); } - return - dynamic_cast (unsmob_metrics (val)); + return dynamic_cast (unsmob_metrics (val)); } - - -Font_metric * +Font_metric* All_font_metrics::find_font (String name) { if ((name.left_string (4) == "feta") || (name.left_string (8) == "parmesan")) { - Font_metric * f = find_afm (name); + Font_metric *f = find_afm (name); if (f) return f; else @@ -184,9 +177,9 @@ All_font_metrics::find_font (String name) if (f) return f; else - f =find_afm (name); + f = find_afm (name); if (f) - return f ; + return f; } warning (_f ("can't find font: `%s'", name.to_str0 ())); diff --git a/lily/font-metric.cc b/lily/font-metric.cc index 222bd5b240..65ecc6cc6c 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -24,6 +24,12 @@ Font_metric::design_size () const return 1.0; } +String +Font_metric::coding_scheme () const +{ + return "FontSpecific"; +} + Box Font_metric::text_dimension (String text) const { @@ -75,17 +81,12 @@ Font_metric::text_dimension (String text) const } } if (ydims.is_empty ()) - ydims = Interval (0,0); + ydims = Interval (0, 0); return Box (Interval (0, w), ydims); } - -Font_metric::~Font_metric () -{ -} - Font_metric::Font_metric () { description_ = SCM_EOL; @@ -97,6 +98,11 @@ Font_metric::Font_metric (Font_metric const &) { } + +Font_metric::~Font_metric () +{ +} + int Font_metric::count () const { @@ -106,7 +112,7 @@ Font_metric::count () const Box Font_metric::get_ascii_char (int) const { - return Box (Interval (0,0),Interval (0,0)); + return Box (Interval (0, 0), Interval (0, 0)); } Box @@ -115,7 +121,6 @@ Font_metric::get_indexed_char (int k) const return get_ascii_char (k); } - int Font_metric::name_to_index (String) const { @@ -125,20 +130,18 @@ Font_metric::name_to_index (String) const Offset Font_metric::get_indexed_wxwy (int )const { - return Offset (0,0); + return Offset (0, 0); } void Font_metric::derived_mark ()const { - } SCM Font_metric::mark_smob (SCM s) { - Font_metric * m = (Font_metric*) SCM_CELL_WORD_1 (s); - + Font_metric *m = (Font_metric*) SCM_CELL_WORD_1 (s); m->derived_mark (); return m->description_; } @@ -164,11 +167,12 @@ IMPLEMENT_TYPE_P (Font_metric, "ly:font-metric?"); Stencil Font_metric::find_by_name (String) const { - Stencil m ; + Stencil m; return m; } -LY_DEFINE (ly_find_glyph_by_name, "ly:find-glyph-by-name", 2 , 0, 0, +LY_DEFINE (ly_find_glyph_by_name, "ly:find-glyph-by-name", + 2, 0, 0, (SCM font, SCM name), "This function retrieves a Stencil for the glyph named @var{name} " "in " @@ -180,18 +184,17 @@ LY_DEFINE (ly_find_glyph_by_name, "ly:find-glyph-by-name", 2 , 0, 0, SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); SCM_ASSERT_TYPE (gh_string_p (name), name, SCM_ARG2, __FUNCTION__, "string"); - Stencil m = fm->find_by_name (ly_scm2string (name)); + Stencil m = fm->find_by_name (ly_scm2string (name)); - /* - TODO: make optional argument for default if not found. - */ + /* TODO: make optional argument for default if not found. */ return m.smobbed_copy (); } -LY_DEFINE (ly_get_glyph, "ly:get-glyph", 2 , 0, 0, +LY_DEFINE (ly_get_glyph, "ly:get-glyph", + 2, 0, 0, (SCM font, SCM index), - "This function retrieves a Stencil for the glyph numbered @var{index} in " -"@var{font}. ") + "Retrieve a Stencil for the glyph numbered @var{index} " + "in @var{font}.") { Font_metric *fm = unsmob_metrics (font); SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); @@ -200,11 +203,12 @@ LY_DEFINE (ly_get_glyph, "ly:get-glyph", 2 , 0, 0, return fm->get_ascii_char_stencil (gh_scm2int (index)).smobbed_copy (); } -LY_DEFINE (ly_text_dimension,"ly:text-dimension", 2 , 0, 0, +LY_DEFINE (ly_text_dimension,"ly:text-dimension", + 2, 0, 0, (SCM font, SCM text), - "Given the font metric in @var{font} and the string @var{text}, compute " -"the extents of that text in that font. The return value is a pair of " -"number-pairs.") + "Given the font metric in @var{font} and the string @var{text}, " + "compute the extents of that text in that font. " + "The return value is a pair of number-pairs.") { Box b; Font_metric *fm = unsmob_metrics (font); @@ -216,9 +220,11 @@ LY_DEFINE (ly_text_dimension,"ly:text-dimension", 2 , 0, 0, return gh_cons (ly_interval2scm (b[X_AXIS]), ly_interval2scm (b[Y_AXIS])); } -LY_DEFINE (ly_font_name,"ly:font-name", 1 , 0, 0, - (SCM font), - "Given the font metric @var{font}, return the corresponding file name. ") +LY_DEFINE (ly_font_name,"ly:font-name", + 1, 0, 0, + (SCM font), + "Given the font metric @var{font}, " + "return the corresponding file name.") { Font_metric *fm = unsmob_metrics (font); SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); @@ -242,26 +248,37 @@ LY_DEFINE (ly_font_design_size,"ly:font-design-size", 1 , 0, 0, { Font_metric *fm = unsmob_metrics (font); SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); - return gh_double2scm (fm->design_size ()); + return gh_double2scm (fm->design_size ()); } - Stencil -Font_metric::get_ascii_char_stencil (int code) const +Font_metric::get_ascii_char_stencil (int code) const { - SCM at = scm_list_n (ly_symbol2scm ("char"), gh_int2scm (code), - SCM_UNDEFINED); + SCM at = scm_list_2 (ly_symbol2scm ("char"), gh_int2scm (code)); at = fontify_atom (this, at); Box b = get_ascii_char (code); return Stencil (b, at); } Stencil -Font_metric::get_indexed_char_stencil (int code) const +Font_metric::get_indexed_char_stencil (int code) const { - SCM at = scm_list_n (ly_symbol2scm ("char"), gh_int2scm (code), - SCM_UNDEFINED); + SCM at = scm_list_2 (ly_symbol2scm ("char"), gh_int2scm (code)); at = fontify_atom (this, at); Box b = get_indexed_char (code); return Stencil (b, at); } + +int +/*Font_metric::*/ +get_encoded_index (Font_metric *m, String input_coding, int code) +{ + String font_coding = m->coding_scheme (); + if (font_coding == input_coding) + return code; + SCM s = scm_call_3 (ly_scheme_function ("encoded-index"), + scm_makfrom0str (input_coding.to_str0 ()), + scm_makfrom0str (font_coding.to_str0 ()), + scm_int2num (code)); + return gh_scm2int (s); +} diff --git a/lily/includable-lexer.cc b/lily/includable-lexer.cc index aab8fd9fcd..299e72a638 100644 --- a/lily/includable-lexer.cc +++ b/lily/includable-lexer.cc @@ -56,7 +56,7 @@ Includable_lexer::new_input (String s, Sources * global_sources) { String msg = _f ("can't find file: `%s'", s); msg += "\n"; - msg += _f ("(search path: `%s')", global_sources->path_C_->to_string ().to_str0 ()); + msg += _f ("(search path: `%s')", global_sources->path_->to_string ().to_str0 ()); msg += "\n"; LexerError (msg.to_str0 ()); diff --git a/lily/include/afm.hh b/lily/include/afm.hh index 96be58284a..64a7d3ea71 100644 --- a/lily/include/afm.hh +++ b/lily/include/afm.hh @@ -19,38 +19,39 @@ #include "font-metric.hh" #include "parse-afm.hh" -struct Adobe_font_metric : Simple_font_metric +class Adobe_font_metric : public Simple_font_metric { - AFM_Font_info * font_inf_; +public: + AFM_Font_info *font_info_; + unsigned int checksum_; + Real design_size_; + + ~Adobe_font_metric (); virtual int name_to_index (String) const; virtual int count () const; virtual Box get_ascii_char (int) const; virtual Box get_indexed_char (int) const; virtual Offset get_indexed_wxwy (int) const; + virtual String coding_scheme () const; AFM_CharMetricInfo const *find_char_metric (String name) const; AFM_CharMetricInfo const *find_ascii_metric (int) const; String to_string () const; - ~Adobe_font_metric (); static SCM make_afm (AFM_Font_info*, unsigned, Real); virtual Real design_size () const; - unsigned int checksum_; - Real design_size_; protected: Array ascii_to_metric_idx_; std::map name_to_metric_dict_; - virtual Stencil find_by_name (String) const; - Adobe_font_metric (AFM_Font_info*); + virtual Stencil find_by_name (String) const; }; -SCM read_afm_file (String fn); -Box afm_bbox_to_box (AFM_BBox bb); +SCM read_afm_file (String); +Box afm_bbox_to_box (AFM_BBox); - #endif /* AFM_HH */ diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh index acf05d5d1a..10da37bb72 100644 --- a/lily/include/font-metric.hh +++ b/lily/include/font-metric.hh @@ -20,7 +20,7 @@ struct Font_metric { public: SCM description_; - String path_; + String filename_; virtual int count () const; virtual Offset get_indexed_wxwy (int) const; @@ -31,17 +31,24 @@ public: virtual Real design_size () const; virtual Stencil find_by_name (String) const; virtual Stencil get_indexed_char_stencil (int k) const; - virtual Stencil get_ascii_char_stencil (int k) const; + virtual Stencil get_ascii_char_stencil (int k) const; + virtual String coding_scheme () const; + //static int get_encoded_index (Font_metric *m, String input_coding, int code); DECLARE_SMOBS (Font_metric,); + private: - Font_metric (Font_metric const&); // no copy. + /* No copying, no implicit copy constructor. */ + Font_metric (Font_metric const&); + protected: virtual void derived_mark () const; Font_metric (); }; +int get_encoded_index (Font_metric *m, String input_coding, int code); + struct Simple_font_metric : public Font_metric { public: diff --git a/lily/include/parse-scm.hh b/lily/include/parse-scm.hh index 3d0158fab8..b53fe8949c 100644 --- a/lily/include/parse-scm.hh +++ b/lily/include/parse-scm.hh @@ -1,6 +1,14 @@ +/* + lily-guile.hh encapsulate guile -#ifndef PARSE_SCM -#define PARSE_SCM + source file of the GNU LilyPond music typesetter + + (c) 2004 Han-Wen Nienhuys + +*/ + +#ifndef PARSE_SCM_HH +#define PARSE_SCM_HH #include "input.hh" #include "lily-guile.hh" @@ -16,7 +24,6 @@ struct Parse_start SCM catch_protected_parse_body (void *); SCM protected_ly_parse_scm (Parse_start *, bool); - SCM ly_parse_scm (char const *, int *, Input, bool); -#endif +#endif /* PARSE_SCM_HH */ diff --git a/lily/include/scaled-font-metric.hh b/lily/include/scaled-font-metric.hh index dc3f344a72..a8c5b0a630 100644 --- a/lily/include/scaled-font-metric.hh +++ b/lily/include/scaled-font-metric.hh @@ -12,9 +12,7 @@ #include "font-metric.hh" -/* - Perhaps junk this, and move this to paper_def as interface? - */ +/* Perhaps junk this, and move this to paper_def as interface? */ struct Scaled_font_metric : public Font_metric { virtual Box text_dimension (String) const; @@ -23,6 +21,8 @@ struct Scaled_font_metric : public Font_metric virtual int count () const; virtual Offset get_indexed_wxwy (int) const; virtual int name_to_index (String) const; + virtual String coding_scheme () const; + protected: virtual Real design_size () const; virtual Box get_indexed_char (int)const; @@ -30,6 +30,7 @@ protected: Font_metric *orig_; Real magnification_; - Scaled_font_metric (Font_metric*,Real); + Scaled_font_metric (Font_metric*, Real); }; -#endif + +#endif /* SCALED_FONT_METRIC_HH */ diff --git a/lily/include/source.hh b/lily/include/source.hh index 55f5e4e2e2..5c0774c834 100644 --- a/lily/include/source.hh +++ b/lily/include/source.hh @@ -9,28 +9,26 @@ #include "cons.hh" #include "flower-proto.hh" -/* - a set of sourcefiles. - */ +/* A set of sourcefiles. */ class Sources { Sources (Sources const&) {} + Cons *sourcefile_list_; + bool is_binary_; + public: Sources (); ~Sources (); - Source_file * get_file (String &filename ); - Source_file* get_sourcefile (char const* str0 ); + Source_file *get_file (String &filename ); + Source_file *get_sourcefile (char const*); void add (Source_file* sourcefile ); - void set_path (File_path*p); + void set_path (File_path*); void set_binary (bool); - const File_path * path_C_; -private: - Cons *sourcefile_list_; - bool is_binary_ ; + const File_path *path_; }; -#endif // SOURCE_HH // +#endif /* SOURCE_HH */ diff --git a/lily/include/tfm-reader.hh b/lily/include/tfm-reader.hh index ddf42d6b23..f7e80e35a4 100644 --- a/lily/include/tfm-reader.hh +++ b/lily/include/tfm-reader.hh @@ -27,21 +27,19 @@ private: void read_char_metrics (); Tex_font_char_metric read_char_metric (Char_code code); Tex_font_char_metric read_char (); - void read_lig_kern_program (Array* ligatures, Array * kerns); - + void read_lig_kern_program (Array* ligatures, + Array * kerns); Binary_source_file input_; public: Tex_font_metric_reader ( String name); - Tfm_info info_; Tfm_header header_; Array char_metrics_; Array ascii_to_metric_idx_; }; - #endif /* TFM_READER_HH */ diff --git a/lily/include/tfm.hh b/lily/include/tfm.hh index 2906149f9b..b8a7818b40 100644 --- a/lily/include/tfm.hh +++ b/lily/include/tfm.hh @@ -131,7 +131,7 @@ struct Tfm_kern struct Tex_font_char_metric { - bool exists_b_; + bool exists_; Char_code code_; Real width_, height_, depth_, italic_correction_; Fix width_fix_, height_fix_, depth_fix_, italic_correction_fix_; @@ -153,6 +153,7 @@ public: virtual int count () const; virtual Box get_ascii_char (int) const; virtual Real design_size () const; + virtual String coding_scheme () const; Tex_font_char_metric const *find_ascii (int ascii, bool warn=true) const; @@ -162,6 +163,7 @@ public: Tfm_header header_; Array char_metrics_; Array ascii_to_metric_idx_; + private: Tex_font_metric (); }; diff --git a/lily/include/virtual-font-metric.hh b/lily/include/virtual-font-metric.hh index 181c00820f..200c1ff02b 100644 --- a/lily/include/virtual-font-metric.hh +++ b/lily/include/virtual-font-metric.hh @@ -16,6 +16,7 @@ source file of the GNU LilyPond music typesetter class Virtual_font_metric : public Font_metric { SCM font_list_; + public: SCM get_font_list () const; Virtual_font_metric (SCM namelist); @@ -28,6 +29,8 @@ public: virtual Offset get_indexed_wxwy (int) const; virtual int name_to_index (String)const; virtual Stencil find_by_name (String) const; + virtual String coding_scheme () const; + protected: virtual void derived_mark () const; }; diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index d9dc08382b..5a259137fd 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -16,17 +16,17 @@ #include #include "lily-proto.hh" +#include "version.hh" -/* macosx fix: - +/* MacOS S fix: + source-file.hh includes cmath which undefines isinf and isnan - source-file.hh includes cmath which undefines isinf and isnan + FIXME: #ifdef MACOS_X? */ inline int my_isinf (Real r) { return isinf (r); } inline int my_isnan (Real r) { return isnan (r); } - #include "libc-extension.hh" #include "lily-guile.hh" #include "main.hh" @@ -104,7 +104,7 @@ gulp_file_to_string (String fn) LY_DEFINE (ly_gulp_file, "ly:gulp-file", 1, 0, 0, (SCM name), - "Read the file @var{name}, and return its contents in a string. " + "Read the file @var{name}, and return its contents in a string. " "The file is looked up using the search path.") { return scm_makfrom0str (gulp_file_to_string (ly_scm2string (name)).to_str0 ()); @@ -241,47 +241,39 @@ is_axis (SCM s) return false; } - Direction to_dir (SCM s) { - return SCM_INUMP (s) ? (Direction) gh_scm2int (s) : CENTER; + return SCM_INUMP (s) ? (Direction) gh_scm2int (s) : CENTER; } Interval ly_scm2interval (SCM p) { - return Interval (gh_scm2double (ly_car (p)), - gh_scm2double (ly_cdr (p))); + return Interval (gh_scm2double (ly_car (p)), gh_scm2double (ly_cdr (p))); } Drul_array ly_scm2realdrul (SCM p) { - return Drul_array (gh_scm2double (ly_car (p)), - gh_scm2double (ly_cdr (p))); + return Drul_array (gh_scm2double (ly_car (p)), + gh_scm2double (ly_cdr (p))); } SCM ly_interval2scm (Drul_array i) { - return gh_cons (gh_double2scm (i[LEFT]), - gh_double2scm (i[RIGHT])); + return gh_cons (gh_double2scm (i[LEFT]), gh_double2scm (i[RIGHT])); } - - - bool to_boolean (SCM s) { return gh_boolean_p (s) && gh_scm2bool (s); } -/* - Appendable list L: the cdr contains the list, the car the last cons - in the list. - */ +/* Appendable list L: the cdr contains the list, the car the last cons + in the list. */ SCM appendable_list () { @@ -353,22 +345,21 @@ LY_DEFINE (ly_number2string, "ly:number->string", static void * greet_sweep (void *dummy1, void *dummy2, void *dummy3) { - fprintf (stderr, "entering sweep\n"); + fprintf (stderr, "entering sweep\n"); } static void * wave_sweep_goodbye (void *dummy1, void *dummy2, void *dummy3) { - fprintf (stderr, "leaving sweep\n"); + fprintf (stderr, "leaving sweep\n"); } #endif -#include "version.hh" LY_DEFINE (ly_version, "ly:version", 0, 0, 0, (), "Return the current lilypond version as a list, e.g. @code{(1 3 127 uu1)}. ") { - char const* vs = "\'(" MAJOR_VERSION " " MINOR_VERSION " " PATCH_LEVEL " " MY_PATCH_LEVEL ")" ; + char const* vs = "\'(" MAJOR_VERSION " " MINOR_VERSION " " PATCH_LEVEL " " MY_PATCH_LEVEL ")" ; return gh_eval_str ((char*)vs); } @@ -403,22 +394,17 @@ SCM ly_deep_copy (SCM src) { if (gh_pair_p (src)) - { - return gh_cons (ly_deep_copy (ly_car (src)), ly_deep_copy (ly_cdr (src))); - } + return gh_cons (ly_deep_copy (ly_car (src)), ly_deep_copy (ly_cdr (src))); else if (gh_vector_p (src)) { - int l = SCM_VECTOR_LENGTH (src); - SCM nv = scm_c_make_vector (l, SCM_UNDEFINED); - for (int i =0 ; i< l ; i++) + int len = SCM_VECTOR_LENGTH (src); + SCM nv = scm_c_make_vector (len, SCM_UNDEFINED); + for (int i =0 ; i < len ; i++) { SCM si = gh_int2scm (i); scm_vector_set_x (nv, si, ly_deep_copy (scm_vector_ref (src, si))); } } - else - return src; - return src; } @@ -462,43 +448,36 @@ corresponds to call SCM ly_assoc_cdr (SCM key, SCM alist) { - if (gh_pair_p (alist)) { + if (gh_pair_p (alist)) + { SCM trykey = ly_caar (alist); - if (gh_pair_p (trykey) && to_boolean (scm_equal_p (key,ly_cdr (trykey)))) - return ly_car (alist); + if (gh_pair_p (trykey) && to_boolean (scm_equal_p (key, ly_cdr (trykey)))) + return ly_car (alist); else - return ly_assoc_cdr (key, ly_cdr (alist)); + return ly_assoc_cdr (key, ly_cdr (alist)); } - else - return SCM_BOOL_F; + return SCM_BOOL_F; } -/* - LIST has the form "sym1 sym2 sym3\nsym4\nsym5" - - i.e. \n and ' ' can be used interchangeably as separators. - */ +/* LST has the form "sym1 sym2 sym3\nsym4\nsym5" + i.e. \n and ' ' can be used interchangeably as separators. */ SCM -parse_symbol_list (const char * list) +parse_symbol_list (char const *lst) { - char * s = strdup (list); + char *s = strdup (lst); char *orig = s; SCM create_list = SCM_EOL; char * e = s + strlen (s) - 1; while (e >= s && isspace (*e)) - *e -- = 0; + *e-- = 0; for (char * p = s; *p; p++) - { - if (*p == '\n') - *p = ' ' ; - } + if (*p == '\n') + *p = ' '; - if (!s[0] ) + if (!s[0]) s = 0; - - while (s) { @@ -514,37 +493,32 @@ parse_symbol_list (const char * list) return create_list; } - SCM -ly_truncate_list (int k, SCM l ) +ly_truncate_list (int k, SCM lst) { if (k == 0) - { - l = SCM_EOL; - } + lst = SCM_EOL; else { - SCM s = l; + SCM s = lst; k--; for (; gh_pair_p (s) && k--; s = ly_cdr (s)) ; if (gh_pair_p (s)) - { - gh_set_cdr_x (s, SCM_EOL); - } + gh_set_cdr_x (s, SCM_EOL); } - return l; + return lst; } - String print_scm_val (SCM val) { String realval = ly_scm2string (ly_write2scm (val)); if (realval.length () > 200) - realval = realval.left_string (100) + "\n :\n :\n" + realval.right_string (100); - + realval = realval.left_string (100) + + "\n :\n :\n" + + realval.right_string (100); return realval; } @@ -643,9 +617,8 @@ ly_snoc (SCM s, SCM list) return gh_append2 (list, scm_list_n (s, SCM_UNDEFINED)); } - /* Split list at member s, removing s. - Return (BEFORE . AFTER) */ + Return (BEFORE . AFTER) */ SCM ly_split_list (SCM s, SCM list) { @@ -696,32 +669,23 @@ int_list_to_slice (SCM l) Slice s; s.set_empty (); for (; gh_pair_p (l); l = gh_cdr (l)) - { - if (gh_number_p (gh_car (l))) - s.add_point (gh_scm2int (gh_car (l))); - } - + if (gh_number_p (gh_car (l))) + s.add_point (gh_scm2int (gh_car (l))); return s; } - -/* - Return I-th element, or last elt L. If I < 0, then we take the first - element. - - PRE: length (L) > 0 - */ +/* Return I-th element, or last elt L. If I < 0, then we take the first + element. + + PRE: length (L) > 0 */ SCM robust_list_ref (int i, SCM l) { while (i-- > 0 && gh_pair_p (gh_cdr (l))) l = gh_cdr (l); - return gh_car (l); } - - Real robust_scm2double (SCM k, double x) { @@ -754,21 +718,17 @@ robust_scm2offset (SCM k, Offset o) { if (is_number_pair (k)) o = ly_scm2offset (k); - return o; } - int robust_scm2int (SCM k, int o) { if (scm_integer_p (k) == SCM_BOOL_T) o = gh_scm2int (k); - return o; } - SCM alist_to_hashq (SCM alist) { diff --git a/lily/paper-book.cc b/lily/paper-book.cc index 4ad319e120..af4eaf1d61 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -103,7 +103,6 @@ Page::Page (Paper_def *paper, int number) header_ = scm_call_2 (make_header, paper_->self_scm (), scm_int2num (number_)); - // FIXME: why does this (generates Stencil) not trigger font load? if (get_header ()) get_header ()->align_to (Y_AXIS, UP); diff --git a/lily/scaled-font-metric.cc b/lily/scaled-font-metric.cc index f719592974..e6cd06f88b 100644 --- a/lily/scaled-font-metric.cc +++ b/lily/scaled-font-metric.cc @@ -1,5 +1,5 @@ -/* - scaled-font-metric.cc -- declare Scaled_font_metric +/* + scaled-font-metric.cc -- declare Scaled_font_metric source file of the GNU LilyPond music typesetter @@ -25,9 +25,9 @@ Scaled_font_metric::Scaled_font_metric (Font_metric* m, Real magn) } SCM -Scaled_font_metric::make_scaled_font_metric (Font_metric*m, Real s) +Scaled_font_metric::make_scaled_font_metric (Font_metric *m, Real s) { - Scaled_font_metric *sfm = new Scaled_font_metric (m,s); + Scaled_font_metric *sfm = new Scaled_font_metric (m, s); return sfm->self_scm (); } @@ -44,8 +44,7 @@ Scaled_font_metric::find_by_name (String s) const Box b = m.extent_box (); b.scale (magnification_); Stencil q (b,fontify_atom ((Font_metric*) this, m.get_expr ())); - - return q ; + return q; } Box @@ -68,7 +67,6 @@ Box Scaled_font_metric::text_dimension (String t) const { Box b (orig_->text_dimension (t)); - b.scale (magnification_); return b; } @@ -91,3 +89,10 @@ Scaled_font_metric::name_to_index (String s)const { return orig_->name_to_index (s); } + +String +Scaled_font_metric::coding_scheme () const +{ + return orig_->coding_scheme (); +} + diff --git a/lily/source.cc b/lily/source.cc index da6ce5339d..927469cc28 100644 --- a/lily/source.cc +++ b/lily/source.cc @@ -19,7 +19,7 @@ Sources::Sources () { sourcefile_list_ = 0; - path_C_= 0; + path_= 0; is_binary_ = false; } @@ -32,7 +32,7 @@ Sources::set_binary (bool bo) void Sources::set_path (File_path *f) { - path_C_ = f; + path_ = f; } /** @@ -46,9 +46,9 @@ Sources::set_path (File_path *f) Source_file* Sources::get_file (String &file_string) //UGH { - if ((file_string != "-") && path_C_) + if ((file_string != "-") && path_) { - String file_string_o = path_C_->find (file_string); + String file_string_o = path_->find (file_string); if ((file_string_o == "") && (file_string != "")) return 0; file_string = file_string_o; diff --git a/lily/tfm-reader.cc b/lily/tfm-reader.cc index 2e3b1148c9..08b6995f67 100644 --- a/lily/tfm-reader.cc +++ b/lily/tfm-reader.cc @@ -164,7 +164,7 @@ Tex_font_metric_reader::read_char_metrics () for (int i = info_.first_charcode; i <= info_.last_charcode; i++) { Tex_font_char_metric tfm_char = read_char_metric (i); - if (tfm_char.exists_b_) + if (tfm_char.exists_) ascii_to_metric_idx_[tfm_char.code_] = char_metrics_.size (); char_metrics_.push (tfm_char); } @@ -191,7 +191,7 @@ Tex_font_metric_reader::read_char_metric (Char_code code) /* Read the character. */ tfm_char = read_char (); - if (tfm_char.exists_b_) + if (tfm_char.exists_) tfm_char.code_ = code; return tfm_char; @@ -239,7 +239,7 @@ Tex_font_metric_reader::read_char () the first and last character codes given in the header. We've already assumed that's true (or we couldn't be positioned at a `char_info_word'). */ - tfm_char.exists_b_ = width_index != 0; + tfm_char.exists_ = width_index != 0; if (tag == 1) { diff --git a/lily/tfm.cc b/lily/tfm.cc index 5193af2978..9d385184e5 100644 --- a/lily/tfm.cc +++ b/lily/tfm.cc @@ -4,7 +4,6 @@ source file of the GNU LilyPond music typesetter (c) 1999--2004 Jan Nieuwenhuizen - some code shamelessly copied from GNU fontutils-0.6/tfm/tfm_input.c */ @@ -16,10 +15,26 @@ #include "warn.hh" #include "dimensions.hh" +static Tex_font_char_metric dummy_static_char_metric; + +Tex_font_char_metric::Tex_font_char_metric () +{ + exists_ = false; + code_ = 0;; + width_ = 0; + height_ = 0; + depth_ = 0; + italic_correction_ = 0; + width_fix_ = 0; + height_fix_ = 0; + depth_fix_ = 0; + italic_correction_fix_ = 0; +} + Box Tex_font_char_metric::dimensions () const { - if (!exists_b_) + if (!exists_) { Box b; b.set_empty (); @@ -35,28 +50,15 @@ Tex_font_char_metric::dimensions () const (d >? height_)*point_constant)); } -Tex_font_char_metric::Tex_font_char_metric () -{ - exists_b_ = false; - code_ = 0;; - width_ = 0; - height_ = 0; - depth_ = 0; - italic_correction_ = 0; - width_fix_ = 0; - height_fix_ = 0; - depth_fix_ = 0; - italic_correction_fix_ = 0; -} - -#define APPEND_CHAR_METRIC_ELT(k) outstr += ::to_string (#k) + " " + ::to_string (k ## _) + "; " +#define APPEND_CHAR_METRIC_ELT(k) \ + outstr += ::to_string (#k) + " " + ::to_string (k ## _) + "; " String Tex_font_char_metric::to_string () const { - String outstr ; + String outstr; - APPEND_CHAR_METRIC_ELT (exists_b); + APPEND_CHAR_METRIC_ELT (exists); APPEND_CHAR_METRIC_ELT (code); APPEND_CHAR_METRIC_ELT (width); APPEND_CHAR_METRIC_ELT (height); @@ -70,40 +72,31 @@ Tex_font_metric::Tex_font_metric () { } - -static Tex_font_char_metric dummy_static_char_metric; - Tex_font_char_metric const * Tex_font_metric::find_ascii (int ascii, bool warn) const { - if (ascii >= 0 && ascii < ascii_to_metric_idx_.size () && ascii_to_metric_idx_[ascii] >= 0) + if (ascii >= 0 && ascii < ascii_to_metric_idx_.size () + && ascii_to_metric_idx_[ascii] >= 0) return & char_metrics_[ascii_to_metric_idx_ [ascii]]; else if (warn) - { - warning (_f ("can't find ascii character: %d", ascii)); - } + warning (_f ("can't find ascii character: %d", ascii)); return &dummy_static_char_metric; } - -/* - UGH: glyphs need not be consecutive in TFM. - */ +/* UGH: glyphs need not be consecutive in TFM. */ int Tex_font_metric::count () const { for (int i = ascii_to_metric_idx_.size (); i--;) - { - if (ascii_to_metric_idx_[i] != -1) - return i + 1; - } + if (ascii_to_metric_idx_[i] != -1) + return i + 1; return 0; } Box Tex_font_metric::get_ascii_char (int a) const { - Box b = find_ascii (a)->dimensions () ; + Box b = find_ascii (a)->dimensions (); return b; } @@ -113,29 +106,31 @@ Tex_font_metric::to_string () const String outstr; for (int i=0; i < char_metrics_.size (); i++) outstr += char_metrics_[i].to_string (); - return outstr; } - - - SCM -Tex_font_metric::make_tfm (String fn) +Tex_font_metric::make_tfm (String filename) { - Tex_font_metric * tfm = new Tex_font_metric; - Tex_font_metric_reader reader (fn); + Tex_font_metric *tfm = new Tex_font_metric; + Tex_font_metric_reader reader (filename); tfm->info_ = reader.info_; tfm->header_ = reader.header_; tfm->char_metrics_ = reader.char_metrics_; tfm->ascii_to_metric_idx_ = reader.ascii_to_metric_idx_; - + return tfm->self_scm (); } Real -Tex_font_metric::design_size ()const +Tex_font_metric::design_size () const { return info_.design_size; } + +String +Tex_font_metric::coding_scheme () const +{ + return info_.coding_scheme; +} diff --git a/lily/virtual-font-metric.cc b/lily/virtual-font-metric.cc index f34c1de032..9c679e6ade 100644 --- a/lily/virtual-font-metric.cc +++ b/lily/virtual-font-metric.cc @@ -28,15 +28,14 @@ Virtual_font_metric::Virtual_font_metric (SCM font_list) for (SCM s = font_list; gh_pair_p (s); s = gh_cdr (s)) { - if (Font_metric*fm = unsmob_metrics (gh_car (s))) + if (Font_metric *fm = unsmob_metrics (gh_car (s))) { *tail = scm_cons (gh_car (s),SCM_EOL); tail = SCM_CDRLOC (*tail); if (!gh_number_p (mag)) - { - mag = gh_cdr (fm->description_); // ugh. - } + /* Ugh. */ + mag = gh_cdr (fm->description_); *name_tail = scm_cons (gh_car (fm->description_), SCM_EOL); name_tail = SCM_CDRLOC (*name_tail); @@ -52,7 +51,6 @@ Virtual_font_metric::design_size () const return unsmob_metrics (gh_car (font_list_))-> design_size (); } - void Virtual_font_metric::derived_mark ()const { @@ -64,10 +62,7 @@ Virtual_font_metric::count () const { int k = 0; for (SCM s = font_list_; gh_pair_p (s); s = gh_cdr (s)) - { - k+= unsmob_metrics (gh_car (s))->count (); - } - + k += unsmob_metrics (gh_car (s))->count (); return k; } @@ -82,8 +77,6 @@ Virtual_font_metric::find_by_name (String glyph) const return m; } - - Box Virtual_font_metric::get_ascii_char (int) const @@ -99,22 +92,17 @@ Virtual_font_metric::get_ascii_char_stencil (int ) const return Stencil (); } - Offset Virtual_font_metric::get_indexed_wxwy (int code) const { int total = 0; for (SCM s = font_list_; gh_pair_p (s); s = gh_cdr (s)) { - Font_metric* fm = unsmob_metrics (gh_car (s)); + Font_metric *fm = unsmob_metrics (gh_car (s)); if (code < total + fm->count ()) - { - return fm->get_indexed_wxwy (code - total); - } + return fm->get_indexed_wxwy (code - total); total += fm->count (); } - - return Offset (0,0); } @@ -124,19 +112,14 @@ Virtual_font_metric::get_indexed_char (int code) const int total = 0; for (SCM s = font_list_; gh_pair_p (s); s = gh_cdr (s)) { - Font_metric* fm = unsmob_metrics (gh_car (s)); + Font_metric *fm = unsmob_metrics (gh_car (s)); if (code < total + fm->count ()) - { - return fm->get_indexed_char (code - total); - } + return fm->get_indexed_char (code - total); total += fm->count (); } - - return Box (); } - int Virtual_font_metric::name_to_index (String glyph) const { @@ -151,10 +134,8 @@ Virtual_font_metric::name_to_index (String glyph) const total += m->count (); } - return -1; } - Stencil Virtual_font_metric::get_indexed_char_stencil (int code) const @@ -164,15 +145,15 @@ Virtual_font_metric::get_indexed_char_stencil (int code) const for (SCM s = font_list_; gh_pair_p (s); s = gh_cdr (s)) { - Font_metric* fm = unsmob_metrics (gh_car (s)); + Font_metric *fm = unsmob_metrics (gh_car (s)); if (code < total + fm->count ()) { - m = fm->get_indexed_char_stencil (code - total); // ugh. + /* Ugh. */ + m = fm->get_indexed_char_stencil (code - total); break; } total += fm->count (); } - return m; } @@ -191,3 +172,10 @@ LY_DEFINE (ly_make_virtual_font, "ly:make-virtual-font", 0, 0, 1, return scm_gc_unprotect_object (fm->self_scm ()); } + +String +Virtual_font_metric::coding_scheme () const +{ + Font_metric *fm = unsmob_metrics (gh_car (font_list_)); + return fm->coding_scheme (); +} diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 046dee06f6..ea281bb770 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -21,9 +21,9 @@ (interpret-markup paper props (make-word-markup str))) -; todo: use font recoding. -; (make-line-markup -; (map make-word-markup (string-tokenize str))))) +;; TODO: use font recoding. +;; (make-line-markup +;; (map make-word-markup (string-tokenize str))))) (define-public empty-markup (make-simple-markup "")) diff --git a/scm/lily.scm b/scm/lily.scm index 7528e0efee..c6ebdfb2e1 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -101,22 +101,14 @@ ;;;;;;;;;;;;;;;; ; alist -(define (uniqued-alist alist acc) - (if (null? alist) acc - (if (assoc (caar alist) acc) - (uniqued-alist (cdr alist) acc) - (uniqued-alist (cdr alist) (cons (car alist) acc))))) - - (define-public (assoc-get key alist . default) "Return value if KEY in ALIST, else DEFAULT (or #f if not specified)." (let ((entry (assoc key alist))) (if (pair? entry) (cdr entry) - (if (pair? default) (car default) #f) - ))) + (if (pair? default) (car default) #f)))) -(define-public (uniqued-alist alist acc) +(define-public (uniqued-alist alist acc) (if (null? alist) acc (if (assoc (caar alist) acc) (uniqued-alist (cdr alist) acc) @@ -434,12 +426,12 @@ L1 is copied, L2 not. "clef.scm" "slur.scm" "font.scm" + "encoding.scm" "define-markup-commands.scm" "define-grob-properties.scm" "define-grobs.scm" "define-grob-interfaces.scm" - "page-layout.scm" "paper.scm" )) -- 2.39.2