From 029137c21a30934db946d7ac4d3d5e187484e269 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 21 Nov 2004 14:43:57 +0000 Subject: [PATCH] * scm/encoding.scm (coding-alist): * scm/font.scm (add-ec-fonts): * ly/paper-defaults.ly: Use actual name for EC fontencoding: Extended-TeX-Font-Encoding---Latin. * lily/side-position-interface.cc (general_side_position): Add actual offset to error message (avoid constant error messages). * scm/encoding.scm (coding-alist): Add fetaDynamic. (read-encoding-file): Bugfix: do not require space after bracket. * scm/font.scm (add-cork-lm-fonts): Remove lmbxi8 and lmbxi14, these do not exist. --- ChangeLog | 8 ++++++ buildscripts/mf-to-table.py | 2 +- lily/afm.cc | 12 +++------ lily/include/dimensions.hh | 43 ++++++++++++++++----------------- lily/side-position-interface.cc | 29 +++++++++------------- lily/stencil.cc | 27 ++++++++++++--------- ly/paper-defaults.ly | 2 +- scm/encoding.scm | 2 +- scm/font.scm | 2 +- 9 files changed, 63 insertions(+), 64 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79261d7325..d5fdde86aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2004-11-21 Jan Nieuwenhuizen + * scm/encoding.scm (coding-alist): + * scm/font.scm (add-ec-fonts): + * ly/paper-defaults.ly: Use actual name for EC fontencoding: + Extended-TeX-Font-Encoding---Latin. + + * lily/side-position-interface.cc (general_side_position): Add + actual offset to error message (avoid constant error messages). + * lily/all-font-metrics.cc (find_font): Add "lm" to try-AFM-first block. diff --git a/buildscripts/mf-to-table.py b/buildscripts/mf-to-table.py index 6dc4c268a7..d624262462 100644 --- a/buildscripts/mf-to-table.py +++ b/buildscripts/mf-to-table.py @@ -130,7 +130,7 @@ def write_afm_char_metric (file, charmetric): charmetric['wx'] * f, charmetric['wy'] * f) - file.write ('C %d ; N %s ; B %d %d %d %d ; W %d %d ;\n'% tup) + file.write ('C %d ; N %s ; B %d %d %d %d ; W %d %d ;\n' % tup) def write_afm_header (file): diff --git a/lily/afm.cc b/lily/afm.cc index ccb0562c1e..155bfa96f6 100644 --- a/lily/afm.cc +++ b/lily/afm.cc @@ -149,22 +149,18 @@ read_afm_file (String nm) return Adobe_font_metric::make_afm (fi, cs, ds); } - -/* Actually, AFMs will be printers point, usually, but our .py script dumps - real points. */ Box afm_bbox_to_box (AFM_BBox bb) { - return Box (Interval (bb.llx, bb.urx)* (1/1000.0) PT, - Interval (bb.lly, bb.ury)* (1/1000.0) PT); - + return Box (Interval (bb.llx, bb.urx) * 0.001 PT, + Interval (bb.lly, bb.ury) * 0.001 PT); } Offset Adobe_font_metric::get_indexed_wxwy (int k) const { - AFM_CharMetricInfo const *mi = font_info_->cmi+ k; - return 1/1000.0 PT * Offset (mi->wx, mi->wy); + AFM_CharMetricInfo const *mi = font_info_->cmi + k; + return Offset (mi->wx, mi->wy) * 0.001 PT; } Real diff --git a/lily/include/dimensions.hh b/lily/include/dimensions.hh index a72361a6f4..13eab8db9f 100644 --- a/lily/include/dimensions.hh +++ b/lily/include/dimensions.hh @@ -5,41 +5,40 @@ class String; -const Real INCH_TO_PT=72.270; -const Real CM_TO_PT=(INCH_TO_PT/2.54); -const Real MM_TO_PT=(CM_TO_PT/10); -const Real PT_TO_PT =1.0; +const Real INCH_TO_PT = 72.270; +const Real CM_TO_PT = (INCH_TO_PT / 2.54); +const Real MM_TO_PT = (CM_TO_PT / 10); +const Real PT_TO_PT = 1.0; const Real INCH_TO_BP = 72; -const Real BIGPOINT_TO_POINT = (INCH_TO_PT/ INCH_TO_BP); -const Real CHAR_TO_PT =1.0; -const Real PT_TO_MM = (1.0/MM_TO_PT); +const Real BIGPOINT_TO_POINT = (INCH_TO_PT / INCH_TO_BP); +const Real CHAR_TO_PT = 1.0; +const Real PT_TO_MM = (1.0 / MM_TO_PT); #ifdef POINTS -#define PT *PT_TO_PT -#define MM *MM_TO_PT -#define CM *CM_TO_PT -#define INCH *INCH_TO_PT -#define BIGPOINT *BIGPOINT_TO_POINT -#define CHAR *CHAR_TO_PT - - #define INTERNAL_UNIT "pt" +#define PT * (PT_TO_PT) +#define MM * (MM_TO_PT) +#define CM * (CM_TO_PT) +#define INCH * (INCH_TO_PT) +#define BIGPOINT * (BIGPOINT_TO_POINT) +#define CHAR * (CHAR_TO_PT) + #else // mm -#define PT *PT_TO_PT *PT_TO_MM -#define MM *MM_TO_PT *PT_TO_MM -#define CM *CM_TO_PT *PT_TO_MM -#define INCH *INCH_TO_PT *PT_TO_MM -#define BIGPOINT *BIGPOINT_TO_POINT *PT_TO_MM -#define CHAR *CHAR_TO_PT *PT_TO_MM #define INTERNAL_UNIT "mm" +#define PT * (PT_TO_PT * PT_TO_MM) +#define MM * (MM_TO_PT * PT_TO_MM) +#define CM * (CM_TO_PT *PT_TO_MM) +#define INCH * (INCH_TO_PT * PT_TO_MM) +#define BIGPOINT * (BIGPOINT_TO_POINT * PT_TO_MM) +#define CHAR * (CHAR_TO_PT * PT_TO_MM) #endif String print_dimen (Real); -#endif // DIMENSIONS_HH +#endif /* DIMENSIONS_HH */ diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index ec15be6641..d40648c751 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -19,6 +19,7 @@ #include "group-interface.hh" #include "directional-element-interface.hh" #include "staff-symbol-referencer.hh" +#include "string-convert.hh" void Side_position_interface::add_support (Grob*me, Grob*e) @@ -62,12 +63,10 @@ Side_position_interface::aligned_on_support_extents (SCM element_smob, SCM axis) } -/* - Puts the element next to the support, optionally taking in - account the extent of the support. -*/ +/* Put the element next to the support, optionally taking in + account the extent of the support. */ SCM -Side_position_interface::general_side_position (Grob * me, Axis a, bool use_extents) +Side_position_interface::general_side_position (Grob *me, Axis a, bool use_extents) { Real ss = Staff_symbol_referencer::staff_space (me); SCM support = me->get_property ("side-support-elements"); @@ -86,7 +85,7 @@ Side_position_interface::general_side_position (Grob * me, Axis a, bool use_exte for (SCM s = support; s != SCM_EOL; s = scm_cdr (s)) { - Grob * e = unsmob_grob (scm_car (s)); + Grob *e = unsmob_grob (scm_car (s)); if (e) if (use_extents) dim.unite (e->extent (common, a)); @@ -98,14 +97,12 @@ Side_position_interface::general_side_position (Grob * me, Axis a, bool use_exte } if (dim.is_empty ()) - { - dim = Interval (0,0); - } + dim = Interval (0, 0); Direction dir = Side_position_interface::get_direction (me); - Real off = me->get_parent (a)->relative_coordinate (common, a); - Real minimum_space = ss * robust_scm2double (me->get_property ("minimum-space"), -1); + Real off = me->get_parent (a)->relative_coordinate (common, a); + Real minimum_space = ss * robust_scm2double (me->get_property ("minimum-space"), -1); Real total_off = dim.linear_combination (dir) - off; total_off += dir * ss * robust_scm2double (me->get_property ("padding"), 0); @@ -113,15 +110,11 @@ Side_position_interface::general_side_position (Grob * me, Axis a, bool use_exte if (minimum_space >= 0 && dir && total_off * dir < minimum_space) - { - total_off = minimum_space * dir; - } + total_off = minimum_space * dir; + /* FIXME: 100CM should relate to paper size. */ if (fabs (total_off) > 100 CM) - programming_error ("Huh ? Improbable staff side dim."); - - - + programming_error (String_convert::form_string ("Improbable offset for grob %s: %f%s", me->name (), total_off, INTERNAL_UNIT)); return scm_make_real (total_off); } diff --git a/lily/stencil.cc b/lily/stencil.cc index b1ac31b705..b07ed7bb08 100644 --- a/lily/stencil.cc +++ b/lily/stencil.cc @@ -13,8 +13,9 @@ #include // isinf #include "input-smob.hh" -#include "font-metric.hh" +#include "font-metric.hh" #include "dimensions.hh" +#include "string-convert.hh" #include "warn.hh" #include "ly-smobs.icc" @@ -87,10 +88,13 @@ Stencil::translate (Offset o) Axis a = X_AXIS; while (a < NO_AXES) { + /* FIXME: 100CM should relate to paper size. */ if (abs (o[a]) > 100 CM || isinf (o[a]) || isnan (o[a])) { - programming_error ("Improbable offset for translation: setting to zero"); + programming_error (String_convert::form_string ("Improbable offset for stencil: %f%s", o[a], INTERNAL_UNIT) + + "\n" + + "Setting to zero."); o[a] = 0.0; } incr (a); @@ -103,7 +107,7 @@ Stencil::translate (Offset o) dim_.translate (o); origin_ += o; } - + void Stencil::translate_axis (Real x, Axis a) { @@ -202,7 +206,7 @@ interpret_stencil_expression (SCM expr, return; SCM head = scm_car (expr); - + if (head == ly_symbol2scm ("translate-stencil")) { o += ly_scm2offset (scm_cadr (expr)); @@ -217,16 +221,15 @@ interpret_stencil_expression (SCM expr, else if (head == ly_symbol2scm ("grob-cause")) { SCM grob = scm_cadr (expr); - + (*func) (func_arg, scm_list_2 (head, grob)); interpret_stencil_expression (scm_caddr (expr), func, func_arg, o); (*func) (func_arg, scm_list_1 (ly_symbol2scm ("no-origin"))); - - return ; + return; } else { - (*func) (func_arg, + (*func) (func_arg, scm_list_4 (ly_symbol2scm ("placebox"), scm_make_real (o[X_AXIS]), scm_make_real (o[Y_AXIS]), @@ -249,7 +252,7 @@ find_font_function (void *fs, SCM x) if (scm_car (x) == ly_symbol2scm ("placebox")) { - SCM args = scm_cdr (x); + SCM args = scm_cdr (x); SCM what = scm_caddr (args); if (scm_is_pair (what)) @@ -267,10 +270,10 @@ SCM find_expression_fonts (SCM expr) { Font_list fl; - + fl.fonts_ = SCM_EOL; - - interpret_stencil_expression (expr, &find_font_function, + + interpret_stencil_expression (expr, &find_font_function, (void*) &fl, Offset (0,0)); return fl.fonts_; diff --git a/ly/paper-defaults.ly b/ly/paper-defaults.ly index 05726b3921..9b61589f21 100644 --- a/ly/paper-defaults.ly +++ b/ly/paper-defaults.ly @@ -69,7 +69,7 @@ #(define text-font-defaults `((font-encoding . ,(if (and (not (ly:kpathsea-find-file "ecrm10.pfa")) - (ly:kpathsea-find-file "cork-lm.enc")) 'cork-lm 'ec)) + (ly:kpathsea-find-file "cork-lm.enc")) 'cork-lm 'Extended-TeX-Font-Encoding---Latin)) (baseline-skip . 2) (word-space . 0.6))) diff --git a/scm/encoding.scm b/scm/encoding.scm index 8498ef69cd..13970ef5b6 100644 --- a/scm/encoding.scm +++ b/scm/encoding.scm @@ -88,7 +88,7 @@ vector of symbols." ("T1" . "tex256.enc") ("adobe" . "8a.enc") ;; EC-fonts-mftraced - ("ec" . "EC.enc") + ("Extended-TeX-Font-Encoding---Latin" . "EC.enc") ;; lmodern, encoding flavour latin1 ("cork-lm" . "cork-lm.enc") diff --git a/scm/font.scm b/scm/font.scm index 921cddeb06..76690df798 100644 --- a/scm/font.scm +++ b/scm/font.scm @@ -291,7 +291,7 @@ (define-public (add-ec-fonts node factor) (for-each (lambda (x) (add-font node - `((font-encoding . ec) + `((font-encoding . Extended-TeX-Font-Encoding---Latin) (font-series . ,(vector-ref (car x) 2)) (font-shape . ,(vector-ref (car x) 1)) (font-family . ,(vector-ref (car x) 0))) -- 2.39.2