\markup \sans ... does not always give sans-serif output in svgs in 2.19.36

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

\markup \sans ... does not always give sans-serif output in svgs in 2.19.36

Paul Morris
\version “2.18.2"
\markup \sans {"This is sans-serif in svg output everywhere I view it."}


\version “2.19.36"
\markup \sans {"This is _not_ sans-serif in svg output in firefox, chromium, or mac os preview."}



However, strangely, the 2.19 svg does have sans-serif text in inkscape and the frescobaldi svg viewer.

-Paul
_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: \markup \sans ... does not always give sans-serif output in svgs in 2.19.36

Paul Morris
Looking closer at the SVG files produced...  In 2.18 we have this:

  <text … font-family="sans-serif” … > some text </text>


Whereas in 2.19 we have this:

  <text … font-family="LilyPond Sans Serif” … > some text </text>


And when I manually edit the 2.19 svg file so it has font-family="sans-serif” then that fixes it and the text appears as sans-serif.  Elsewhere in the svg files I see that:

2.18 svg has:  font-family="Century Schoolbook L”
2.19 svg has:  font-family="LilyPond Serif"

From this thread:
http://lists.gnu.org/archive/html/lilypond-devel/2015-06/msg00175.html

and this commit:
http://git.savannah.gnu.org/gitweb/?p=lilypond.git;a=commit;h=28f58ecc2271956e9377dc61e5135ce3ade4abbd

we see that “LilyPond Sans Serif” and “LilyPond Serif” are aliases.  So it appears that the code that produces the svgs is including the alias names for “font-family" rather than what the alias refers to (e.g. “sans-serif” or "Century Schoolbook L”).

-Paul
_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Exporting fonts as outlines in SVG (was: \markup \sans ... does not always give sans-serif output in svgs in 2.19.36)

Urs Liska
Slightly OT but still related:
would it be possible to (optionally) export text fonts as outlines in
the SVG?
As it is SVG is only properly displayed if the fonts are installed on
the viewer's machine - something you can't expect when producing for web
display (which should be a major target for the SVG backend).

Urs

Am 13.02.2016 um 21:50 schrieb Paul Morris:

> Looking closer at the SVG files produced...  In 2.18 we have this:
>
>   <text … font-family="sans-serif” … > some text </text>
>
>
> Whereas in 2.19 we have this:
>
>   <text … font-family="LilyPond Sans Serif” … > some text </text>
>
>
> And when I manually edit the 2.19 svg file so it has font-family="sans-serif” then that fixes it and the text appears as sans-serif.  Elsewhere in the svg files I see that:
>
> 2.18 svg has:  font-family="Century Schoolbook L”
> 2.19 svg has:  font-family="LilyPond Serif"
>
> From this thread:
> http://lists.gnu.org/archive/html/lilypond-devel/2015-06/msg00175.html
>
> and this commit:
> http://git.savannah.gnu.org/gitweb/?p=lilypond.git;a=commit;h=28f58ecc2271956e9377dc61e5135ce3ade4abbd
>
> we see that “LilyPond Sans Serif” and “LilyPond Serif” are aliases.  So it appears that the code that produces the svgs is including the alias names for “font-family" rather than what the alias refers to (e.g. “sans-serif” or "Century Schoolbook L”).
>
> -Paul
> _______________________________________________
> bug-lilypond mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/bug-lilypond


_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: Exporting fonts as outlines in SVG (was: \markup \sans ... does not always give sans-serif output in svgs in 2.19.36)

Paul Morris
> On Feb 13, 2016, at 4:05 PM, Urs Liska <[hidden email]> wrote:
>
> would it be possible to (optionally) export text fonts as outlines in the SVG?

This would be a nice option to have at some point, but I can’t speak to feasibility / amount of effort entailed.

-Paul
_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: \markup \sans ... does not always give sans-serif output in svgs in 2.19.36

James Lowe
In reply to this post by Paul Morris
Hello,

On 13/02/16 20:50, Paul Morris wrote:

> Looking closer at the SVG files produced...  In 2.18 we have this:
>
>    <text … font-family="sans-serif” … > some text </text>
>
>
> Whereas in 2.19 we have this:
>
>    <text … font-family="LilyPond Sans Serif” … > some text </text>
>
>
> And when I manually edit the 2.19 svg file so it has font-family="sans-serif” then that fixes it and the text appears as sans-serif.  Elsewhere in the svg files I see that:
>
> 2.18 svg has:  font-family="Century Schoolbook L”
> 2.19 svg has:  font-family="LilyPond Serif"
>
>  From this thread:
> http://lists.gnu.org/archive/html/lilypond-devel/2015-06/msg00175.html
>
> and this commit:
> http://git.savannah.gnu.org/gitweb/?p=lilypond.git;a=commit;h=28f58ecc2271956e9377dc61e5135ce3ade4abbd
>
> we see that “LilyPond Sans Serif” and “LilyPond Serif” are aliases.  So it appears that the code that produces the svgs is including the alias names for “font-family" rather than what the alias refers to (e.g. “sans-serif” or "Century Schoolbook L”).
 From usage:

http://lilypond.org/doc/v2.19/Documentation/usage-big-page#advanced-command-line-options-for-lilypond

*Note for backend svg output:* LilyPond’s default fonts (|LilyPond
Serif|, |LilyPond Sans Serif| and |LilyPond Monospace|) are just /local/
font aliases. Therefore, when using the backend |svg| command you must
explicitly define the default fonts in your source file;

    \paper  {
       #(define fonts
         (make-pango-font-tree "TeX Gyre Schola"
                               "TeX Gyre Heros"
                               "TeX Gyre Cursor"
                               (/ staff-height pt 20)))
    }

--
James

-------

B8F4 5395 CBE2 ED37 7513 B075 FF32 5682 A84B D8BE

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: \markup \sans ... does not always give sans-serif output in svgs in 2.19.36

Paul Morris
> On Feb 16, 2016, at 4:17 PM, James Lowe <[hidden email]> wrote:
>
> From usage:
>
> http://lilypond.org/doc/v2.19/Documentation/usage-big-page#advanced-command-line-options-for-lilypond <http://lilypond.org/doc/v2.19/Documentation/usage-big-page#advanced-command-line-options-for-lilypond>
> Note for backend svg output: LilyPond’s default fonts (LilyPond Serif, LilyPond Sans Serif and LilyPond Monospace) are just local font aliases. Therefore, when using the backend svg command you must explicitly define the default fonts in your source file;
>
Thanks James, I hadn’t seen that explanation and workaround.

It still seems like it would be better if these local aliases didn’t make it into the svg files by default (when fonts are not user specified).  Seems like LilyPond's svg backend code could simply substitute:

“serif” for “LilyPond Serif”
“sans-serif” for “LilyPond Sans Serif”
“monospace” for “LilyPond Monospace”

That would produce svgs that had valid defaults and met expectations, svgs like those produced by 2.18.

(Well, instead of “serif” in 2.18 you would get "Century Schoolbook L” but I think “serif” is the better default.  Or we could specify both a specific font and a generic fallback like "TeX Gyre Schola, serif”.  That’s an option with the svg font-family property.)

So this seems like a regression to me, or at least a good feature request.

-Paul
_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: \markup \sans ... does not always give sans-serif output in svgs in 2.19.36

James Lowe
On 17/02/16 04:04, Paul Morris wrote:

>> On Feb 16, 2016, at 4:17 PM, James Lowe <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>> From usage:
>>
>> http://lilypond.org/doc/v2.19/Documentation/usage-big-page#advanced-command-line-options-for-lilypond
>>
>> *Note for backend svg output:*LilyPond’s default fonts (|LilyPond
>> Serif|,|LilyPond Sans Serif|and|LilyPond Monospace|) are
>> just/local/font aliases. Therefore, when using the
>> backend|svg|command you must explicitly define the default fonts in
>> your source file;
>>
> Thanks James, I hadn’t seen that explanation and workaround.

I have created

https://sourceforge.net/p/testlilyissues/issues/4774/

in at attempt to try to make sure others do not miss this either.

>
> It still seems like it would be better if these local aliases didn’t
> make it into the svg files by default (when fonts are not user
> specified).  Seems like LilyPond's svg backend code could simply
> substitute:
>
> “serif” for “LilyPond Serif”
> “sans-serif” for “LilyPond Sans Serif”
> “monospace” for “LilyPond Monospace”
>
> That would produce svgs that had valid defaults and met expectations,
> svgs like those produced by 2.18.
>
> (Well, instead of “serif” in 2.18 you would get "Century Schoolbook L”
> but I think “serif” is the better default.  Or we could specify both a
> specific font and a generic fallback like "TeX Gyre Schola, serif”.
>  That’s an option with the svg font-family property.)
>
> So this seems like a regression to me, or at least a good feature request.

I don't think this is a regression.

Without pretending to understand any of the past history of the reasons
we changed the font defaults I think the problem was (and I am sure I
will be corrected) that the results on all the different OSes - where
Century Schoolbook may or may not be installed would result in
unexpected results, along with some 'cyrillic' considerations, so I
think it seemed to make it a better idea to define this via aliases.

As to saying 'LilyPond Serif' vs just 'Serif', isn't that just semantics
if it is all an 'alias' anyway?

Here are the core check-ins (in case we have already discussed what you
are asking on dev or bug - if only at a programmatic level that I am not
competent enough to understand).

e.g

https://code.google.com/archive/p/lilypond/issues/4441
https://codereview.appspot.com/241340043/

Maybe embedding (or whatever it is you need for SVG particularly) was
more complex or 'impossible' when using this alias method - hence the
extra note in Documentation.

I did go round the houses with the devs on this when trying to help the
patch submitted with the documentation. No one seemed to express
concerns about the alias part - but of course that doesn't mean it
cannot be an enhancement.


--
James

-------

B8F4 5395 CBE2 ED37 7513 B075 FF32 5682 A84B D8BE

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: \markup \sans ... does not always give sans-serif output in svgs in 2.19.36

Paul Morris
Hi James,

> On Feb 17, 2016, at 6:26 AM, James Lowe <[hidden email]> wrote:
>
> Without pretending to understand any of the past history of the reasons we changed the font defaults I think the problem was (and I am sure I will be corrected) that the results on all the different OSes - where Century Schoolbook may or may not be installed would result in unexpected results, along with some 'cyrillic' considerations, so I think it seemed to make it a better idea to define this via aliases.

Using the aliases is fine, but when creating svg files it is possible to specify a generic font-family instead of a particular font (or in addition to it, in case the particular font is not available).  So when producing svg files we could specify a generic font-family when the user asks for that (\markup \sans …) even if the user has not specified a particular font.

> As to saying 'LilyPond Serif' vs just 'Serif', isn't that just semantics if it is all an 'alias' anyway?

“serif” “sans-serif” and “monospace” are officially defined as meaningful values for the font-family property for svg files.  They tell an svg renderer (like a web browser) to “use a font of this type when displaying this svg image”.[1]  

“LilyPond Serif” and friends mean nothing to an svg renderer because they are neither fonts nor generic font families that they understand.

So my suggestion is that LilyPond should be smart enough to use “serif” in an svg file rather than “LilyPond Serif” when no particular font has been set by the user.  (Same for “sans-serif” and “monospace” for “LilyPond Sans Serif” and “LilyPond Monospace”.)  

Hope that clarifies things.


[1] Links to svg specification / documentation:

http://www.w3.org/TR/SVG11/text.html#FontFamilyProperty
http://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-specification
http://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#generic-font-families

<generic-family>
The following generic families are defined: 'serif', 'sans-serif', 'cursive', 'fantasy', and 'monospace'. Please see the section on generic font families for descriptions of these families. Generic font family names are keywords, and therefore must not be quoted.
Authors are encouraged to offer a generic font family as a last alternative, for improved robustness.



> Here are the core check-ins (in case we have already discussed what you are asking on dev or bug - if only at a programmatic level that I am not competent enough to understand).
>
> e.g
>
> https://code.google.com/archive/p/lilypond/issues/4441
> https://codereview.appspot.com/241340043/

Thanks.  I took a look.  My sense is that what I am talking about would need to happen in the svg backend code, but I’m just making a more or less educated guess.


> I did go round the houses with the devs on this when trying to help the patch submitted with the documentation. No one seemed to express concerns about the alias part - but of course that doesn't mean it cannot be an enhancement.

Ok, I'd still say it’s a regression since 2.18 produces svg files that better reflect user input than 2.19, but I’ll take an enhancement.  :-)

Thanks,
-Paul



_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: \markup \sans ... does not always give sans-serif output in svgs in 2.19.36

Urs Liska


Am 17.02.2016 um 16:48 schrieb Paul Morris:
> “serif” “sans-serif” and “monospace” are officially defined as meaningful values for the font-family property for svg files.  They tell an svg renderer (like a web browser) to “use a font of this type when displaying this svg image”.[1]  
>
> “LilyPond Serif” and friends mean nothing to an svg renderer because they are neither fonts nor generic font families that they understand.
>
> So my suggestion is that LilyPond should be smart enough to use “serif” in an svg file rather than “LilyPond Serif” when no particular font has been set by the user.  (Same for “sans-serif” and “monospace” for “LilyPond Sans Serif” and “LilyPond Monospace”.)  
>
> Hope that clarifies things.
>
>

Sounds reasonable for me.

One of the origins of the issue was the fact that LilyPond didn't
specify a concrete font for \sans and \typewriter. This meant that
Century Schoolbook was by default used as roman font, but the others
used anything the compiling machine considered appropriate. So passing
along a .ly file to someone else could result in ridiculously
different-looking scores.

I don't think that's the immediate cause for the current issue, but that
was the outset of the changes that led to the current issue.

Urs

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond