From 3503b76b73e03f30e4d10aa5594db328332739ff Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 30 Nov 2005 14:45:55 +0000 Subject: [PATCH] (pad-to-box): new markup command. --- ChangeLog | 2 ++ Documentation/topdocs/NEWS.tely | 6 ++++-- input/regression/font-kern.ly | 22 ++++++++++++++++++++++ scm/define-markup-commands.scm | 17 ++++++++++++++++- scm/output-ps.scm | 15 ++++----------- 5 files changed, 48 insertions(+), 14 deletions(-) create mode 100644 input/regression/font-kern.ly diff --git a/ChangeLog b/ChangeLog index 473c816d3a..a2e78e0343 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-11-30 Han-Wen Nienhuys + * scm/define-markup-commands.scm (pad-to-box): new markup command. + * scm/define-grobs.scm (all-grob-descriptions): set thickness to 1.0. (all-grob-descriptions): don't shift RehearsalMark arbitrarily. diff --git a/Documentation/topdocs/NEWS.tely b/Documentation/topdocs/NEWS.tely index 18627dcea3..c2a91473b2 100644 --- a/Documentation/topdocs/NEWS.tely +++ b/Documentation/topdocs/NEWS.tely @@ -45,9 +45,11 @@ This document is also available in @uref{NEWS.pdf,PDF}. @itemize @bullet +@item Texts set in a TrueType font are now kerned. -@item LilyPond does no longer link to kpathsea for the @TeX{} backend. -This makes the @TeX{} backend more easily usable on various systems. +@item Using the @TeX{} no longer requires linking or dynamically +opening the kpathsea library, making the backend more easily usable on +various systems. This fix was sponsored by Christian Ebert. diff --git a/input/regression/font-kern.ly b/input/regression/font-kern.ly new file mode 100644 index 0000000000..8cc4ea0631 --- /dev/null +++ b/input/regression/font-kern.ly @@ -0,0 +1,22 @@ +\version "2.7.20" + +\header { + texidoc = "Text set in TrueType Fonts that contain kerning tables, are kerned. " +} + +\markup { +% \override #'(font-name . "VeraSerif") + \override #'(padding . 0) + \override #'(thickness . 0.00001) + \override #'(box-padding . 0.0) + \column { + \line { \pad-to-box #'(0 . 50) #'(0 . 2) \line { With kerning: } + \override #'(font-size . 12) + \box { VAVAVA } } + \line { + \pad-to-box #'(0 . 50) #'(0 . 2) \line { Without kerning: } + \override #'(font-size . 12) + \override #'(word-space . 0.0) \line { \box V \box A \box V \box A \box V \box A } } + } +} + diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 3597686ef8..6f1cf2b256 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -97,6 +97,7 @@ the PDF backend." "Draw a box round @var{arg}. Looks at @code{thickness}, @code{box-padding} and @code{font-size} properties to determine line thickness and padding around the markup." + (let* ((th (chain-assoc-get 'thickness props 0.1)) (size (chain-assoc-get 'font-size props 0)) (pad (* (magstep size) @@ -391,7 +392,6 @@ determines the space between each markup in @var{args}." (text-dir (chain-assoc-get 'text-direction props RIGHT)) ) - (if (= text-dir LEFT) (set! stencils (reverse stencils))) @@ -687,6 +687,21 @@ alignment accordingly." x y))) +(def-markup-command (pad-to-box layout props x-ext y-ext arg) (number-pair? number-pair? markup?) + "Make @var{arg} take at least @var{x-ext}, @var{y-ext} space" + + (let* + ((m (interpret-markup layout props arg)) + (x (ly:stencil-extent m X)) + (y (ly:stencil-extent m Y))) + + + (ly:make-stencil (ly:stencil-expr m) + (interval-union x-ext x) + (interval-union y-ext y)))) + + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; property ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 74e1d01b61..67431321ff 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -138,13 +138,12 @@ size cid? w-x-y-named-glyphs) - (format #f "gsave 1 output-scale div 1 output-scale div scale - /~a ~a ~a scalefont setfont\n~a grestore" + (format #f "gsave + /~a ~a ~a output-scale div scalefont setfont\n~a grestore" postscript-font-name (if cid? " /CIDFont findresource " " findfont") - size (apply string-append @@ -156,14 +155,8 @@ (g (cadddr item)) (prefix (if (string? g) "/" ""))) - (if (and (= 0.0 x) - (= 0.0 y)) - (format #f " ~a~a glyphshow\n" prefix g) -;; (format #f " gsave ~a~a glyphshow grestore ~a 0 rmoveto \n" prefix g w) - (format #f " ~a ~a rmoveto ~a~a glyphshow\n" - x y - prefix - g)))) + (format #f " gsave ~a~a glyphshow grestore ~a ~a rmoveto \n" prefix g (+ w x) y) + )) w-x-y-named-glyphs)))) (define (grob-cause offset grob) -- 2.39.2