Re: Scale fonts types (serif/sans/typewriter) globally
Werner LEMBERG <[email protected]>
| Newsgroups | gmane.comp.gnu.lilypond.general |
|---|---|
| Message-ID | <[email protected]> |
>> in below example, I have replaced the text fonts. Now other fonts
>> typically have a different size than the default Emmenthaler
>> font. In below example, to match the default fonts size, I'd like
>> to scale the serif and sans font by a factor of, say, x1.23. Only
>> those two types. Not any global scaling like
>> "set-global-staff-size" which would scale everything else as
>> well... Any idea how this could be achieved?
>
> I would implement proper font matching. [...]
This is a very nice solution, thanks! However, such an automated way
doesn't cater for all solutions, namely to find compromises for the
size harmonization. Additionally, the scale is the same horizontally
and vertically – as can be seen in the attached output, this makes for
*very* wide typewriter fonts.
> The attached code uses a string-transformer to scale all text to
> match Lilypond’s default fonts either by lining height or x-height.
If you replace the line
```
(make-scale-markup (cons scale scale) input-string)
```
in Tina's `match-fonts.ly` with
```
(make-scale-markup (cons 1 scale) input-string)
```
to only scale vertically you get the second attached image. IMHO, the
'real thing' for the user is somewhere between these two extreme
results. Tina, if you add such an additional scaling argument I could
put your code to the Wiki, if you like.
* * *
I would like to have a framework in LilyPond that does the following.
Below, I use an ad-hoc, non-Scheme syntax that should be adapted
accordingly.
* Provide a function to register a font for reference.
* Provide a function to register (and unregister) a font (or multiple
fonts) for scaling with a 'mode', using the reference font for
deriving the scaling values. This 'mode' would have the form
<scaling-method>[@<axis>]@(<x-scaling>, <y-scaling>)
with <scaling-method> being one of the following
none use the font unchanged
x harmonize x-height with reference font
C harmonize capital height with reference font
<axis> is either `x` or `y`, indicating whether to restrict the
scaling to one axis instead of two.
<x-scaling> and <y-scaling> are applied after aligning with the
reference font.
Examples:
none@(1, 1.2) Scale font vertically with a factor of 1.2.
x@y Align font by x-height with reference font and
apply scaling only vertically.
x@y@(1.1 1) The same, but also increase the width a little
bit.
C@(0.9, 1) Align font by capital height with reference font
and slightly reduce the width.
We should also consider OpenType features that can assist with some
of the outlined tasks.
* We should probably also think about providing a user framework to
add and remove functions from `string-transformers` (which currently
isn't really documented). Alternatively, the font harmonization
stuff it could be integrated into the text markup commands directly
so that we don't clutter this property.
Werner
match-fonts-original.png
(image/png, 72.9 KB) - not displayed
match-fonts-only-y-axis.png
(image/png, 72.8 KB) - not displayed