Melodeon.net Forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the new melodeon.net forum

Pages: 1 [2] 3   Go Down

Author Topic: EasyABC - exporting as SVG - fonts used  (Read 10012 times)

0 Members and 1 Guest are viewing this topic.

Anahata

  • This mind intentionally left blank
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 6767
  • Oakwood D/G, C/F Club, 1-rows in C,D,G
    • Treewind Music
Re: EasyABC - exporting as SVG - fonts used
« Reply #20 on: March 31, 2020, 11:53:07 AM »

Yes if you want to inline a score into a web page, svg works well, but pdf don't natively inline. E.g. see:

http://davidjohnsummers.uk/music/CastletonCarol/CastletonCarol.html


Hmm... Unfortunately Firefox (68.6.0esr on Linux) makes a dog's dinner of the SVG on that page, the text in huge letters overlapping all over the music.
Logged
Слава Україні !
Music recording and web hosting: www.treewind.co.uk
Mary Humphreys and Anahata: www.maryanahata.co.uk
Ceilidh band: www.barleycoteband.co.uk

David Summers

  • Regular debater
  • ***
  • Offline Offline
  • Posts: 159
Re: EasyABC - exporting as SVG - fonts used
« Reply #21 on: March 31, 2020, 01:35:52 PM »

Yes if you want to inline a score into a web page, svg works well, but pdf don't natively inline. E.g. see:

http://davidjohnsummers.uk/music/CastletonCarol/CastletonCarol.html


Hmm... Unfortunately Firefox (68.6.0esr on Linux) makes a dog's dinner of the SVG on that page, the text in huge letters overlapping all over the music.
Hmm - thanks for letting me know. For what its worth I'm looking at it on firefox (73.0.1) on ArchLinux, and its as intended. let me check how the fonts are encoded in the svg, I suspect as text so the machine needs to know the font. Looks like Times Roman to me. Oh yes - if you click on any of the bits of music, it will download a pdf, so you can see how it was meant to look ...

OK sample of the xml svg text:
Quote
  <text
     font-size="2.4696"
     id="text88"
     style="font-size:2.46959996px;font-family:serif;text-anchor:start;fill:currentColor"
     x="16.344711"
     y="23.406433">
    <tspan
       id="tspan86">Down</tspan>
  </text>
Which looks fine, and should be the right size. So suspect the serif font isn't recognised. Which seems very strange. As commented about changing all fonts into path is possible, but not a great solution as give huge files. Hmmm ...
« Last Edit: March 31, 2020, 01:49:33 PM by David Summers »
Logged

Stiamh

  • Old grey C#/D pest
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 3611
    • Packie Manus Byrne
Re: EasyABC - exporting as SVG - fonts used
« Reply #22 on: March 31, 2020, 11:15:28 PM »

Since Gena pointed out that, in the case of SVGs, fonts will be rendered on the user's machine, I think it would be best to stick to common fonts, and I have prepared files using Times, Arial, Helvetica, and Verdana.

I know that these work well on my Windows machine using all the browsers I have. Could those of you who are on different platforms, esp. Macintosh and Linux, report on how they look to you, specifying OS and browser.

Is the title font in each case different and presentable, resembling what you would expect for these fonts (Times being the only serif font)?

Thanks in advance!

Times
Helvetica
Arial
Verdana
Verdana bold


PS Does anybody know if it is possible to control the font used for symbols such as !FINE! and !D.C.! ? I have tried all the font commands listed in the Guido guide and elsewhere, but none seem to work on these.

Anahata

  • This mind intentionally left blank
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 6767
  • Oakwood D/G, C/F Club, 1-rows in C,D,G
    • Treewind Music
Re: EasyABC - exporting as SVG - fonts used
« Reply #23 on: April 01, 2020, 12:05:17 AM »

On Firefox 68, Debian Linux, the Helvetica is coming up with a serif font. It may be my browser's default font.
The others look like the fonts they are supposed to be.

Note that any system will generally display any font that is installed on it, whether it's Windows, Linux or a Macintosh; for example I could install any Truetype font here. The only Helveticas I have are bitmapped fonts, so Firefox doesn't use them (unless, perhaps, they happen to match a specified size.)

Unlike Postscript and PDF, SVG doesn't seem to have "standard" or "base" fonts - you are simply advised to use web-safe fonts (or presumably embed special fonts if you need them.)

Logged
Слава Україні !
Music recording and web hosting: www.treewind.co.uk
Mary Humphreys and Anahata: www.maryanahata.co.uk
Ceilidh band: www.barleycoteband.co.uk

Mike Hirst

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1433
  • Black Dot B/C, Bastardo C#/D, Corona II GCF
Re: EasyABC - exporting as SVG - fonts used
« Reply #24 on: April 01, 2020, 12:30:39 AM »

Does anybody know if it is possible to control the font used for symbols such as !FINE! and !D.C.! ?

Look at the last few lines of the svg/xml source.

Code: [Select]
<text style="font:16px serif"
x="752.50" y="334.80" text-anchor="middle">D.C.</text>
</g>
<g stroke-width="0.70" style="font:16.00px Courier">
<text x="68.90" y="415.60">Some comments by Jean Duval in Courier. Pas bon!!!</text>
</g>
</svg>

note the styling for both the inline D.C. and the comment below the stave. Changing these will change the display. making these changes by hand is easy, but laborious. It might be possible to write an external CSS stylesheet that would work for individual display, but it would be difficult to ensure that this would work for all instances.
« Last Edit: April 01, 2020, 12:50:58 AM by Mike Hirst »
Logged
Semper idem, sed non eodem modo

Steve_freereeder

  • Content Manager
  • Hero Member
  • ***
  • Offline Offline
  • Posts: 7511
  • MAD is inevitable. Keep Calm and Carry On
    • Lizzie Dripping
Re: EasyABC - exporting as SVG - fonts used
« Reply #25 on: April 01, 2020, 12:43:31 AM »

... Could those of you who are on different platforms, esp. Macintosh and Linux, report on how they look to you, specifying OS and browser.

Is the title font in each case different and presentable, resembling what you would expect for these fonts (Times being the only serif font)?

Thanks in advance!

Times
Helvetica
Arial
Verdana
Verdana bold

On MacOS 10.14.6 (Mojave) I get the following:
Using Firefox (v. 74) all fonts display correctly.
Using Safari (v. 13.0.5) Verdana and Verdana Bold are showing up as a serif font (looks a bit like Times New Roman). The others are all OK.
Logged
Steve
Sheffield, UK.
www.lizziedripping.org.uk

Stiamh

  • Old grey C#/D pest
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 3611
    • Packie Manus Byrne
Re: EasyABC - exporting as SVG - fonts used
« Reply #26 on: April 01, 2020, 02:03:56 AM »

Thanks, Anahata & Steve. More feedback from others would be appreciated!

Thanks Mike. I will try hand-tweaking the styling. Since I will be producing a large number of images in this project, the easiest thing would be to write a macro in my text editor or script to make the changes (although actually the proportion of tunes having !symbols! is not very high).
« Last Edit: April 01, 2020, 02:37:31 AM by Stiamh »
Logged

Steve_freereeder

  • Content Manager
  • Hero Member
  • ***
  • Offline Offline
  • Posts: 7511
  • MAD is inevitable. Keep Calm and Carry On
    • Lizzie Dripping
Re: EasyABC - exporting as SVG - fonts used
« Reply #27 on: April 01, 2020, 09:00:22 AM »

On MacOS 10.14.6 (Mojave) I get the following:
Using Firefox (v. 74) all fonts display correctly.
Using Safari (v. 13.0.5) Verdana and Verdana Bold are showing up as a serif font (looks a bit like Times New Roman). The others are all OK.
Also, using Opera v. 67 on the same platform, I can confirm that all the fonts are dispalying correctly.
Logged
Steve
Sheffield, UK.
www.lizziedripping.org.uk

David Summers

  • Regular debater
  • ***
  • Offline Offline
  • Posts: 159
Re: EasyABC - exporting as SVG - fonts used
« Reply #28 on: April 01, 2020, 09:03:12 AM »

Times
Helvetica
Arial
Verdana
Verdana bold
All worked on my ArchLinux and firefox. Interesting almost none worked on my tablet (android, something like 10), all had the same sans-serif font,  (bold was bold though). Note that my desk top has a good selection of fonts in /usr/share/fonts - including a host of ttf, which is probably what firefox svg interpreter uses. (or whatever firefox uses, probably pango/cairo ...).

This svg page is instructive: https://www.w3.org/TR/SVG/fonts.html - fonts used to be in the specification but were removed. This could explain the problems, programs that use the old specification have fonts in the svg; but new svg specification is clear, should use CSS fonts https://www.w3.org/TR/css-fonts/.

Sigh - I'll see if I can create a page using the new sodding specification ....
« Last Edit: April 01, 2020, 09:07:34 AM by David Summers »
Logged

Mike Hirst

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1433
  • Black Dot B/C, Bastardo C#/D, Corona II GCF
Re: EasyABC - exporting as SVG - fonts used
« Reply #29 on: April 01, 2020, 10:58:57 AM »

Since I will be producing a large number of images in this project, the easiest thing would be to write a macro in my text editor or script to make the changes (although actually the proportion of tunes having !symbols! is not very high).

Identifying the tunes which include !symbols! would be easiest doing some sort of global search over the abc source(s). If you are OK with using regular expressions this should not be too difficult. If the number is not too small, I would suggest that hand editing would be the quickest way to go.
Logged
Semper idem, sed non eodem modo

Gena Crisman

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1108
  • 🇬🇧
Re: EasyABC - exporting as SVG - fonts used
« Reply #30 on: April 01, 2020, 06:54:48 PM »

PS Does anybody know if it is possible to control the font used for symbols such as !FINE! and !D.C.! ? I have tried all the font commands listed in the Guido guide and elsewhere, but none seem to work on these.

How are they defined in the ABC? Honestly I should have just asked for (a link to) the ABC for this tune by now. My guess is they are decorations:
http://abcnotation.com/wiki/abc:standard:v2.2#decorations so, they are very specific words put in between !s, exactly as you put in your post, (a-duh)

This means that they're considered decorations by abcm2ps and likely are looked up in this list:
https://github.com/leesavide/abcm2ps/blob/master/deco.c#L124
which sets up a command word 'dacs' which gets used in the output SVG code via this switch case statement
https://github.com/leesavide/abcm2ps/blob/master/svg.c#L2331

(Thanks for your post, Mike, with that example, it was the first breadcrumb I followed to figure out the above)

Basically: you get you a hard coded serif font output with at least !FINE! and !D.C.! - so, to answer your question, I can tell you that no, without modifying the binary either by compiling the source code yourself, or hex editing to turn that particular serif into a keyword to find later, you're out of luck in terms of having the program do the job for you.

The good news is that font:16px serif is only found in your discussed decorations & those other few covered by the 'dacs' keyword in deco.c, and whatever dacoda would be (per ABC spec, !dacoda!               the word "Da" followed by a Coda sign) so, you can probably search for the above text throughout all your SVG files and it will most likely be unique to these problem cases, because of the lack of decimal points after the 16, there.

You might be better served just searching for 'serif', if you potentially have other examples of !! decorations, as these will have slightly different handling that also results in hard coded serif font, with either bold/italics or a different size.
Logged

Stiamh

  • Old grey C#/D pest
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 3611
    • Packie Manus Byrne
Re: EasyABC - exporting as SVG - fonts used
« Reply #31 on: April 02, 2020, 02:19:50 AM »

Editing the SVGs manually to adjust the font and size of the decorations is definitely a possibility. Actually a further, and bigger, gripe with the !D.C.! symbol in the examples I posted is that it is too high and interferes with "volta bracket" whereas the !FINE! does not. I don't think I want to get into fiddling with the instructions that produce that result.

Thank you to everyone for the feedback on the samples, and to Mike and Gena esp. for all the technical information and impressive sleuthing. I am much obliged to you all! :|glug

Gena Crisman

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1108
  • 🇬🇧
Re: EasyABC - exporting as SVG - fonts used
« Reply #32 on: April 02, 2020, 07:05:23 AM »

So, there's this to consider. It seems it's very cleverly positioning the decoration text based on the notes below it, but, it may not have any idea about the volta bracket to realise it should avoid it. The reason why it'll be higher in one place than another is most likely because of the note below it.

Most likely there isn't any good way to win, however, you may find making the text smaller will solve most of your problems.
Logged

David Summers

  • Regular debater
  • ***
  • Offline Offline
  • Posts: 159
Re: EasyABC - exporting as SVG - fonts used
« Reply #33 on: April 02, 2020, 12:43:06 PM »

Yes if you want to inline a score into a web page, svg works well, but pdf don't natively inline. E.g. see:

http://davidjohnsummers.uk/music/CastletonCarol/CastletonCarol.html


Hmm... Unfortunately Firefox (68.6.0esr on Linux) makes a dog's dinner of the SVG on that page, the text in huge letters overlapping all over the music.
OK, try this updated: https://davidjohnsummers.uk/music/CastletonCarol/CastletonCarol.html.

I've updated the svg to close to the SVG 2.0 standard. The fonts I've taken into a CSS; alas the font sizes I couldn't get to work in a style sheet, so these are still specified in the <text> tabs.

Would be good to know if this makes it displayable in more places. Next thing to do would be to change to WOFF fonts, and distribute the font with the page. Don't want to do that .... but seems only way to break the dependence on the fonts installed on the computer ...
Logged

Anahata

  • This mind intentionally left blank
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 6767
  • Oakwood D/G, C/F Club, 1-rows in C,D,G
    • Treewind Music
Re: EasyABC - exporting as SVG - fonts used
« Reply #34 on: April 02, 2020, 01:41:44 PM »

OK, try this updated: https://davidjohnsummers.uk/music/CastletonCarol/CastletonCarol.html.

I've updated the svg to close to the SVG 2.0 standard. The fonts I've taken into a CSS; alas the font sizes I couldn't get to work in a style sheet, so these are still specified in the <text> tabs.


Sorry, no obvious improvement. Perhaps I should try the latest version of Firefox.
Logged
Слава Україні !
Music recording and web hosting: www.treewind.co.uk
Mary Humphreys and Anahata: www.maryanahata.co.uk
Ceilidh band: www.barleycoteband.co.uk

Anahata

  • This mind intentionally left blank
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 6767
  • Oakwood D/G, C/F Club, 1-rows in C,D,G
    • Treewind Music
Re: EasyABC - exporting as SVG - fonts used
« Reply #35 on: April 02, 2020, 01:47:35 PM »

Here's what it looks like (In case it's any help)

Logged
Слава Україні !
Music recording and web hosting: www.treewind.co.uk
Mary Humphreys and Anahata: www.maryanahata.co.uk
Ceilidh band: www.barleycoteband.co.uk

David Summers

  • Regular debater
  • ***
  • Offline Offline
  • Posts: 159
Re: EasyABC - exporting as SVG - fonts used
« Reply #36 on: April 02, 2020, 02:25:34 PM »

OK, try this updated: https://davidjohnsummers.uk/music/CastletonCarol/CastletonCarol.html.

I've updated the svg to close to the SVG 2.0 standard. The fonts I've taken into a CSS; alas the font sizes I couldn't get to work in a style sheet, so these are still specified in the <text> tabs.


Sorry, no obvious improvement. Perhaps I should try the latest version of Firefox.
Ta - thanks for checking again. Yes what it looks like doesn't surprise me - I went through many graphics like that whilst attempting to update to SVG 2.0.

I try (harder) to get the font size into the CSS, but suspect its the host machine not finding fonts (especially as you and I are on similar machines). Alas as font specified (serif) should be available in one standard form or other, sounding like unless font provided (WOFF), may not work.

Anyway let me check the specification *very* carefully to see how to specify size - alas the SVG spec are evolving, and often you get to see something in draft that half way between two standards ....

Actually looking carefully at that graphic, everything in the CSS did work. E.g. The font is serif, and the bits in bold are in bold, so it just the font size thats failed ....
« Last Edit: April 02, 2020, 03:30:03 PM by David Summers »
Logged

Steve_freereeder

  • Content Manager
  • Hero Member
  • ***
  • Offline Offline
  • Posts: 7511
  • MAD is inevitable. Keep Calm and Carry On
    • Lizzie Dripping
Re: EasyABC - exporting as SVG - fonts used
« Reply #37 on: April 02, 2020, 03:12:36 PM »

Here's what it looks like (In case it's any help)
It looks like a piece of artwork. If you printed it at very large (e.g. A0 size) and then framed it, you could hang it on the wall, or better still, print a limited edition number of copies and flog 'em on Etsy or e-bay.  ;)
Logged
Steve
Sheffield, UK.
www.lizziedripping.org.uk

Gena Crisman

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1108
  • 🇬🇧
Re: EasyABC - exporting as SVG - fonts used
« Reply #38 on: April 02, 2020, 05:14:06 PM »

Would adding a backup font to the font-family help this one, seemingly rare occurrence?

It's super weird though, frankly that even if the font is not found, that the size would be so ridiculous. Maybe it's throwing a fit at the perfectly valid floating point sizes?
Logged

Mike Hirst

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1433
  • Black Dot B/C, Bastardo C#/D, Corona II GCF
Re: EasyABC - exporting as SVG - fonts used
« Reply #39 on: April 02, 2020, 05:38:55 PM »

It might be useful here to clarify the situation with regard to styling SVG using external CSS.

SVG referenced using <img>, <object> or <embed> tags cannot be styled using external css. All styling must be included in the SVG. This can be inline or in a <style> block, usually at the start of the file.

If SVG is inline - i.e SVG code is included in html <body> external css will work. This can be either an external file referenced in the html head, or css style rules defined in a <style> block included in the html <head>.

The most common work around with referenced SVG is to use jquery.
« Last Edit: April 02, 2020, 08:01:03 PM by Mike Hirst »
Logged
Semper idem, sed non eodem modo
Pages: 1 [2] 3   Go Up
 


Melodeon.net - (c) Theo Gibb; Clive Williams 2010. The access and use of this website and forum featuring these terms and conditions constitutes your acceptance of these terms and conditions.
SimplePortal 2.3.5 © 2008-2012, SimplePortal