[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Opinions: expressive text and markup sizes
From: |
Aaron Hill |
Subject: |
Re: Opinions: expressive text and markup sizes |
Date: |
Sun, 08 Jul 2018 15:11:20 -0700 |
User-agent: |
Roundcube Webmail/1.3.6 |
On 2018-07-08 12:54, Abraham Lee wrote:
Nothing special. Though I have dreamed of a function to do it
automatically, it just takes a bit of trial and error to find the right
size because each font has a different x-height. I almost never use an
absolute font size outside of the header. If the global staff size is
relatively small e.g. less than 16pt, then it wouldn’t hurt to make the
text size a little bit larger.
Here is a hack, which I suspect has holes that will need patching:
%%%%
\version "2.19.82"
#(define-markup-command (fontsize-x-height layout props size arg)
(number? markup?)
(let* ((y-extent (ly:stencil-extent
(ly:text-interface::interpret-markup layout props
(markup "x")) Y))
(scale-factor (* (/ size (cdr y-extent)) 1.125)))
(interpret-markup layout props #{ \markup \magnify #scale-factor
#arg #})))
\score {
<<
\new Voice { s1 }
\new Lyrics { \lyricmode {
\markup \roman \fontsize-x-height #1 "Oxy" 4
\markup \sans \fontsize-x-height #2 "Oxy" 4
\markup \typewriter \fontsize-x-height #3 "Oxy" 4
\markup \italic \fontsize-x-height #4 "Oxy" 4
} }
>>
\layout { \context { \Lyrics
% Force overlap with staff lines to use them as a ruler.
\override VerticalAxisGroup.nonstaff-relatedstaff-spacing =
#'((basic-distance . 2) (minimum-distance . 0)
(padding . -20) (stretchability . 0))
} }
}
%%%%
The principle seems sound. Use ly:stencil-extent to measure the height
of a single "x", compute the necessary scaling factor and \magnify.
However, there is something odd with the units returned. I
experimentally found that a fudge factor of 1.125 appeared to mostly
correct things, but I am almost certainly just overlooking something
important.
-- Aaron Hill
- Opinions: expressive text and markup sizes, Ben, 2018/07/08
- Re: Opinions: expressive text and markup sizes, Abraham Lee, 2018/07/08
- Re: Opinions: expressive text and markup sizes, Ben, 2018/07/08
- Re: Opinions: expressive text and markup sizes, Abraham Lee, 2018/07/08
- Re: Opinions: expressive text and markup sizes,
Aaron Hill <=
- Re: Opinions: expressive text and markup sizes, Urs Liska, 2018/07/09
- Re: Opinions: expressive text and markup sizes, Torsten Hämmerle, 2018/07/09
- Re: Opinions: expressive text and markup sizes, Aaron Hill, 2018/07/09
- Re: Opinions: expressive text and markup sizes, Torsten Hämmerle, 2018/07/09