lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fonts for TextScripts


From: Aaron Hill
Subject: Re: Fonts for TextScripts
Date: Fri, 26 Jun 2020 03:49:06 -0700
User-agent: Roundcube Webmail/1.4.2

On 2020-06-26 3:33 am, Aaron Hill wrote:
On 2020-06-26 3:05 am, Aberforth D - Instrumentals wrote:
Hello,

I have a problem obtaining the correct font for TextScripts. When I type
the following command:

c4^\markup \italic "legato"

it shows up all right in Frescobaldi but the svg file does not produce the correct font. Indeed, the source-code of the svg file only states "serif"
as font.

I cannot reproduce this behavior.  Here is my MWE for reference:

%%%%
\version "2.20.0"
{ b'4 ^\markup \italic "Hello" }
%%%%

The relevant excerpt from the SVG file:
====
<text transform="translate(17.2358, 1.6730)" font-family="serif"
font-style="italic" font-size="2.2001" text-anchor="start"
fill="currentColor">
<tspan>Hello</tspan>
</text>
====

Oh, wait. I thought you meant the \italic was not working. It looks like you were instead talking about the font family, not the style.

This behavior appears to be intended. The default font names for \roman, \sans, and \typewriter are "serif", "sans-serif", and "monospace" respectively. The SVG output engine simply embeds the general font family name rather than consulting the current font-config. Theoretically, this should end up mapping to the same actual font, unless the SVG viewer uses a different font-config such as when running on a different system.

If you need to specify the actual font, just set it in \paper:

%%%%
\version "2.20.0"

\paper {
  #(define fonts
    (set-global-fonts
      #:roman "Times New Roman"
      #:factor (/ staff-height pt 20)))
}

{ b'4 ^\markup \italic "Hello" }
%%%%

====
<text transform="translate(17.2358, 1.5023)" font-family="Times New Roman" font-style="italic" font-size="2.2001" text-anchor="start" fill="currentColor">
<tspan>Hello</tspan>
</text>
====


-- Aaron Hill



reply via email to

[Prev in Thread] Current Thread [Next in Thread]