2004-11-21 Jan Nieuwenhuizen <janneke@gnu.org>
+ * 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.
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):
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
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 */
#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)
}
-/*
- 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");
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));
}
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);
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);
}
#include <libc-extension.hh> // 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"
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);
dim_.translate (o);
origin_ += o;
}
-
+
void
Stencil::translate_axis (Real x, Axis a)
{
return;
SCM head = scm_car (expr);
-
+
if (head == ly_symbol2scm ("translate-stencil"))
{
o += ly_scm2offset (scm_cadr (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]),
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))
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_;
#(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)))
("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")
(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)))