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   Go Down

Author Topic: curious font problem using easyabc  (Read 4957 times)

0 Members and 1 Guest are viewing this topic.

smiley

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 968
  • Folk music: it's not as bad as it sounds
    • a few sound clips
curious font problem using easyabc
« on: November 12, 2017, 05:36:42 AM »

Recently one of my abc files refused to export to pdf and I tracked the problem down to this line in the header:

%%textfont Palatino-Bold 20

The problem disappeared when I changed this to: %%textfont Palatino 20 , so I assume that Palatino-Bold is no longer a valid font. I couldn't find a listing of valid fonts anywhere. I'm using EasyABC v1.3.7.5 2016-08-09 on a Macbook.

The curious twist is that I had also created a subset of the first abc file (with the original header) and it still happily exports to pdf using the original font definition and the same EasyABC software etc. Can anyone explain to this novice user what's going on here?

BTW I thought an earlier discussion at http://forum.melodeon.net/index.php/topic,19813 might be useful but the link to the abc standard is now out of date.

Full disclosure: I copied that header off an example Stiamh once posted, in case he recognises it ...
Logged

Roger Hare

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 828
  • Urmston, Lancashire, U.K.
Re: curious font problem using easyabc
« Reply #1 on: November 12, 2017, 08:06:08 AM »

Recently one of my abc files refused to export to pdf and I tracked the problem down to this line in the header:

%%textfont Palatino-Bold 20

The problem disappeared when I changed this to: %%textfont Palatino 20 , so I assume that Palatino-Bold is no longer a valid font. I couldn't find a listing of valid fonts anywhere. I'm using EasyABC v1.3.7.5 2016-08-09 on a Macbook.

The curious twist is that I had also created a subset of the first abc file (with the original header) and it still happily exports to pdf using the original font definition and the same EasyABC software etc. Can anyone explain to this novice user what's going on here?

BTW I thought an earlier discussion at http://forum.melodeon.net/index.php/topic,19813 might be useful but the link to the abc standard is now out of date.

Full disclosure: I copied that header off an example Stiamh once posted, in case he recognises it ...

This is the correct version of an earlier premature and incomplete post...

I have tried this before and it didn't work. Out of curiosity, I tried it again when I saw your post
and was able to reproduce your problem.

I'm using EasyABC 1.3.7.7 on a W10 machine and I usually use the Helvetica font family for my scores.

However, on-screen, it worked!!! - the scores appeared with all selected fields bold-faced, but it
wouldn't export to PDF.

The only thing I can think of is that the problem is something to do with the particular Ghostscript
installation being used by the underlying abcm2ps program? Maybe you could try another version
of Ghostscript (if that's possible on a Mac)? I may try it - dunno if I've got the moral fibre...

If anyone can come up with a machine-independent solution to this, I too would be grateful!

There seems to be an up-to-date ABC specification at http://abcnotation.com/wiki/abc:standard:v2.1

I too steal copy code whenever I can...

Roger
« Last Edit: November 12, 2017, 08:49:24 AM by lachenal74693 »
Logged
For more about Manchester Morris, The Beech Band Folk Club or anything else,  please use the private messaging facility.
My (large) ABC Tune Book is here.

smiley

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 968
  • Folk music: it's not as bad as it sounds
    • a few sound clips
Re: curious font problem using easyabc
« Reply #2 on: November 14, 2017, 04:40:59 AM »

Thanks Roger

Its some comfort hearing that others have seen the same issue. The font works on screen for me too but its the exporting to pdf that causes grief.
Logged

smiley

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 968
  • Folk music: it's not as bad as it sounds
    • a few sound clips
Re: curious font problem using easyabc
« Reply #3 on: May 22, 2018, 02:57:42 AM »

I think Peter Dunk may have supplied the solution to my problem in a post on another discussion ...  a comma in the right place.

%%titlefont Helvetica, 22

Seems to work OK when exporting to PDF using EasyABC on my Mac, but I still can't find a list of which font definitions are valid.
Logged

Roger Hare

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 828
  • Urmston, Lancashire, U.K.
Re: curious font problem using easyabc
« Reply #4 on: May 22, 2018, 07:21:27 AM »

I think Peter Dunk may have supplied the solution to my problem in a post on another discussion ...  a comma in the right place.

%%titlefont Helvetica, 22

Seems to work OK when exporting to PDF using EasyABC on my Mac, but I still can't find a list of which font definitions are valid.

I did a bit more investigating. Palatino didn't seem to work on my display (I just got a sans-serif font), but it
was used when I generated a PDF file, but with no boldfacing. This seems to be the reverse of what I posted
earlier. This time I used a W7 machine instead of a W10 machine (My head is starting to hurt!).

The comma trick didn't seem to work for me...

The standard doesn't have a comma in the specification for %%titlefont, so in view of what was posted earlier,
I wonder if all this should just be put down to some sort of coding bug in EasyABC? (I'm convinced that these
exist - I just had a file with a line which started with a barline and a chord '[|"E"...'. It didn't work. It actually
played a line of the 'weel-kent' free-form jazz which we sometimes hear. I put a space in  '[| "E"...' and it
worked fine. Very odd.).

In fact the standard has a disclaimer relating to these formatting directives which seems to be saying something
like:

"These directives have been here since Adam were a lad. They didn't work properly then, and they may not work
properly now. We'll try and fix it all in version 2.3 of the standard..."

I wonder if your font problem might also have something to do with the GhostScript implementation you are using?
Changing this may make the problem go away?

It's a b*gger innit...
« Last Edit: May 22, 2018, 08:51:38 AM by lachenal74693 »
Logged
For more about Manchester Morris, The Beech Band Folk Club or anything else,  please use the private messaging facility.
My (large) ABC Tune Book is here.

Anahata

  • This mind intentionally left blank
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 6359
  • Oakwood D/G, C/F Club, 1-rows in C,D,G
    • Treewind Music
Re: curious font problem using easyabc
« Reply #5 on: May 22, 2018, 09:40:11 AM »

The comma between font name and size is definitely not part of the ABC standard 2.0 or 2.1.

I still can't find a list of which font definitions are valid.

If you mean which fonts are acceptable, I think you'll find the PostScript core fonts are a safe bet as abcm2ps (which is the rendering engine behind EasyABC) generates Postscript. see https://en.wikipedia.org/wiki/PostScript_fonts#Core_Font_Set for example.

Logged
I'm a melodeon player. What's your excuse?
Music recording and web hosting: www.treewind.co.uk
Mary Humphreys and Anahata: www.maryanahata.co.uk
Ceilidh band: www.barleycoteband.co.uk

smiley

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 968
  • Folk music: it's not as bad as it sounds
    • a few sound clips
Re: curious font problem using easyabc
« Reply #6 on: May 22, 2018, 12:22:14 PM »

Thanks. I tried about a dozen of those core fonts and only Helvetica would output as PDF (I'm using EasyABC 1.3.7.5 on a Mac). All the others produce an 'export failed' error when I try exporting to PDF.

Here are the first lines in my functioning abc code:

%%titlefont Helvetica, 22
%%subtitlefont Helvetica,16
%%textfont Helvetica Bold, 26

When I leave out the comma EasyABC says 'export failed'. 
Logged

Roger Hare

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 828
  • Urmston, Lancashire, U.K.
Re: curious font problem using easyabc
« Reply #7 on: May 22, 2018, 12:34:47 PM »

...only Helvetica would output as PDF...
Which explains why I don't usually have problems - when I started, I chose (more or
less at random) Helvetica to be my base font, and I've stuck with it, if only because
I was once told that it's generally considered that sans-serif fonts display better on
a screen than serif fonts..
« Last Edit: May 22, 2018, 12:37:55 PM by lachenal74693 »
Logged
For more about Manchester Morris, The Beech Band Folk Club or anything else,  please use the private messaging facility.
My (large) ABC Tune Book is here.

Gromit

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 519
Re: curious font problem using easyabc
« Reply #8 on: May 22, 2018, 05:34:43 PM »

Quote
I think you'll find the PostScript core fonts are a safe bet as abcm2ps (which is the rendering engine behind EasyABC) generates Postscript
Interesting discusion, back in the early days of Desk Top Publishing when I worked in the Print Industry, postscript fonts where the only type used for printing from DTP typesetting. I'm pretty sure pdf's wouldn't accept True type fonts, so perhaps the problem you're having may have something to do with that. If the abc programme generates postcript but you're using Truetype fonts that may also be the problem.
Logged

Anahata

  • This mind intentionally left blank
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 6359
  • Oakwood D/G, C/F Club, 1-rows in C,D,G
    • Treewind Music
Re: curious font problem using easyabc
« Reply #9 on: May 22, 2018, 08:23:59 PM »

I'm pretty sure pdf's wouldn't accept True type fonts

A quick look at some PDFs I've generated here shows some containing truetype fonts, so whatever may have been the case in the past, they are certainly allowed now.

Quote
If the abc programme generates postcript but you're using Truetype fonts that may also be the problem.
That's more likely. I can believe that Postscript won't accept Truetype.

{a few minutes later}
Ah, here's what I'm looking for. From Guido Gonzato's ABC Guide:
Quote
Note that the common True Type fonts used by the operating system are not the same fonts used by abcm-
2ps. In fact, abcm2ps uses the PostScript fonts, provided for and managed by Ghostscript.

However all may not be lost. Elsewhere in the same document he says:
Quote
Recent versions of Ghostscript support PostScript (.pfb), OpenType (.otf), and TrueType (.ttf) fonts.
And then:
Quote
Ghostscript does not use system fonts, i.e. the ones that the operating system
provides to all other applications. You will have to add new fonts following the
procedure outlined in this section
...
Supposing that you installed Ghostscript (let’s assume version 9.23) and its fonts in default locations,
such directory is:
• Windows: C:\ProgramFiles\gs\gs9.22\lib
• GNU/Linux: /usr/share/ghostscript/fonts/
Now edit Ghostscript’s font list, which is a simple text file:
• Windows: C:\ProgramFiles\gs\gs9.22\lib\Fontmap
• GNU/Linux: /var/lib/ghostscript/fonts/Fontmap

So maybe if you follow that procedure and your GS is recent enough, you will be able to embed Truetype fonts, but it doesn't happen by default.
You'll find the ABC guide here: http://abcplus.sourceforge.net/#ABCGuide
Logged
I'm a melodeon player. What's your excuse?
Music recording and web hosting: www.treewind.co.uk
Mary Humphreys and Anahata: www.maryanahata.co.uk
Ceilidh band: www.barleycoteband.co.uk

smiley

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 968
  • Folk music: it's not as bad as it sounds
    • a few sound clips
Re: curious font problem using easyabc
« Reply #10 on: May 23, 2018, 12:15:14 AM »

Ach so! My computer must have the wrong ghost in its ghostscript ...

At least my abc 'sort of' does what I want it to.
Which reminds me of my attitude to melodeon playing: if it sounds roughly ok and I can get away with it, then that'll do.
 ::)
Logged

Corinto

  • Regular debater
  • ***
  • Offline Offline
  • Posts: 222
  • Spain/Brasil/Belgium
Re: curious font problem using easyabc
« Reply #11 on: May 23, 2018, 02:25:37 PM »

EasyABC 1.3.7.5 on MacBook Air MacOSSierra 10.12.6
font Times, regular, bold and italics works perfect; no problems; no comma.
Logged
Carpe diem, C.

smiley

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 968
  • Folk music: it's not as bad as it sounds
    • a few sound clips
Re: curious font problem using easyabc
« Reply #12 on: May 23, 2018, 11:26:20 PM »


The curious twist is that I had also created a subset of the first abc file (with the original header) and it still happily exports to pdf using the original font definition and the same EasyABC software etc. Can anyone explain to this novice user what's going on here?


I should reiterate that the font problem doesn't occur with small abc files. The file I'm working on has 370 lines in EasyABC, and I need it to output as one pdf.
Logged

vof

  • Regular debater
  • ***
  • Offline Offline
  • Posts: 211
Re: curious font problem using easyabc
« Reply #13 on: May 24, 2018, 12:43:27 AM »

I've been meaning to respond to this thread for some time - it's late and I'm tired so let me just say a few things:

1. It's easy to assume that the software used to rasterise on-screen fonts - that is turned from definitions of the letter shapes into dots - is the same as that used for other destinations such as PDFs or printers. I believe that is pretty much true on Apple Macs but definitely not necessarily true on Windows computers. Anahata has already mentioned a number of factors that are very significant, the most important being that Ghostscript is pretty much, for licensing reasons, a closed system using its own font definitions.

2. If creating PDFs from abc, it is vital that you use the correct font name. That by default is the name specified in the font definition file used by Ghostscript, or the synonym defined in the Ghostscript Fontmap file. If Ghostscript does not recognise the font name you have specified, it will use its default font for that situation. I think that explains most of the incorrect font problems mentioned in this thread. If the font you are trying to use is outside the standard 13 or 35 core fonts in Postscript - again see Anahata's comments on this - you need to make sure you have told Ghostscript the name and where the font file can be found.

More info on these core fonts here: https://en.wikipedia.org/wiki/PostScript_fonts#Core_Font_Set

All this requires some understanding of the way Ghostscript works! I have found that in general, Ghostscript recognises font names with embedded hyphens such as Helvetica-Oblique-Bold. Note the use of Oblique and not Italic, and take care over capitalisation. These are systems with their genesis on Unix not Windows where case is important.

3. I've never seen a comma validly used between the font name and point size in Ghostscript. If it works, I suspect it is down to the relevant software accepting then ignoring the comma.

Vince
« Last Edit: May 24, 2018, 09:18:16 AM by vof »
Logged
Vince O'Farrell
Dino BPII; Hohners: Pokerwork D/G (fettled by Theo; 4th button start, Viennese tuning, and thirds stop by Mike Rowbotham); red Erica G/C; couple of 1040s in C and G project boxes.

Rob Bradshaw

  • Member
  • *
  • Offline Offline
  • Posts: 5
Re: curious font problem using easyabc
« Reply #14 on: December 27, 2018, 12:52:20 PM »

I have a Macbook, and in the past I've noted this difference between font names.  I discovered that if I created a Word document containing the required font and size, saved the file as a pdf, and then opened it with Acrobat, displaying the file properties gave me the correct font names to use in EasyABC. For example the font Time-Bold-Italic works as
Times-BoldItalic in EasyABC.

However, I do have another question.  I am trying to use EasyABC to create a book of tunes from Wales, which of course have tune titles in Welsh.  The problem character is circumflex+y.  I have the language flag set as Welsh, so I can type circumflex+character using alt+character.  In EasyABC I can enter these Tiles as either \^y or alt+y.  The titles appear correctly in the upper EasyABC window.  The snag is that when I export the tune as a pdf, the circumflex characters vanish, so ^+y just becomes y.  I assume that the EasyABC upper window displays the Postscript produced by abcm2ps, so it would appear that this program has behaved correctly, and that the problem is to ps to pdf conversion, which seems to be done via something called /usr/bin/pstopdf according to the ABC Settings information. 

So it would appear as if abcm2ps and pstopdf are not using the same fonts, or have I misunderstood something?  Is there some way to make them use the same fonts, or should I be using something other than pstopdf?

One way around the problem is to use the EasyABC Print Preview option, which then allows one to print the page, which then allows you to divert the output to a pdf file.  This file has the correct tune title, but the resolution of the image is poor.

Any suggestions would be most appreciated.  Thanks
Logged

Anahata

  • This mind intentionally left blank
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 6359
  • Oakwood D/G, C/F Club, 1-rows in C,D,G
    • Treewind Music
Re: curious font problem using easyabc
« Reply #15 on: December 27, 2018, 05:01:03 PM »

I am trying to use EasyABC to create a book of tunes from Wales, which of course have tune titles in Welsh.  The problem character is circumflex+y.  I have the language flag set as Welsh, so I can type circumflex+character using alt+character.  In EasyABC I can enter these Tiles as either \^y or alt+y.  The titles appear correctly in the upper EasyABC window.  The snag is that when I export the tune as a pdf, the circumflex characters vanish, so ^+y just becomes y.  I assume that the EasyABC upper window displays the Postscript produced by abcm2ps, so it would appear that this program has behaved correctly, and that the problem is to ps to pdf conversion

Postscript only works with the Latin-1 character set, which is the same as the first 256 code points of Unicode, and does not contain ŷ, nor, as I also discovered when trying to do Welsh music, does it have ŵ.
EasyABC is probably using an 8-bit character set like Latin Extended-A which does have those characters, but when it exports to Postscript it can't use those mappings and any of several things could happen, but none of them will give you the correct characters.

abcm2ps (the conversion engine of EasyABC) also has the option of exporting to SVG. I don't know much about how that works, but SVG is a much newer invention than Postscript and may well support Unicode fonts, then all you need is a SVG to PDF converter (or some way of displaying and printing SVG) and we're in the 21st century at last!

P.S. I just tried adding some of those characters to the title of an ABC tune file and converting to .SVG with abcm2ps, and then imported the .SVG file as a image into a LibreOffice document, and it did indeed render those characters correctly.

So SVG looks like the way to go. It also makes tunes look better on the web, if your browser supports it. Chris Walshaw's ABC search shows the dots as SVG, and they do look better - no pixellated edges at any size.

(SVG = Scalable Vector Graphics)

Logged
I'm a melodeon player. What's your excuse?
Music recording and web hosting: www.treewind.co.uk
Mary Humphreys and Anahata: www.maryanahata.co.uk
Ceilidh band: www.barleycoteband.co.uk

Rob Bradshaw

  • Member
  • *
  • Offline Offline
  • Posts: 5
Re: curious font problem using easyabc
« Reply #16 on: January 01, 2019, 03:08:02 PM »

Many thanks for your suggestions and explanations Anahata.  I will certainly have a go at these and see how I get on. 
Logged

Anahata

  • This mind intentionally left blank
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 6359
  • Oakwood D/G, C/F Club, 1-rows in C,D,G
    • Treewind Music
Re: curious font problem using easyabc
« Reply #17 on: January 02, 2019, 01:28:11 AM »

Just to confuse the issue - this morning I ran that file through abcm2ps and those characters came out right. So maybe PostScript has been updated to handle utf-8 now. I will investigate when I have time.
Logged
I'm a melodeon player. What's your excuse?
Music recording and web hosting: www.treewind.co.uk
Mary Humphreys and Anahata: www.maryanahata.co.uk
Ceilidh band: www.barleycoteband.co.uk

Rob Bradshaw

  • Member
  • *
  • Offline Offline
  • Posts: 5
Re: curious font problem using easyabc
« Reply #18 on: January 14, 2019, 08:43:08 PM »

Anahata

Oh, that is interesting!  Maybe my software is out of date, I'm using EasyABC 1.3.7.6 on a MacBook with 10.13.2.

Which version of EasyABC are you using, and on what system?  Does your abcm2ps have pango compiled in, and do you have ps2pdf or pstopdf (the latter is a MacOS program I think)?

Thanks
Rob
Logged

Anahata

  • This mind intentionally left blank
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 6359
  • Oakwood D/G, C/F Club, 1-rows in C,D,G
    • Treewind Music
Re: curious font problem using easyabc
« Reply #19 on: January 15, 2019, 12:58:32 AM »

I'm not using EasyABC, I'm using abcm2ps on the command line (actually via a small bash script) on Debian Linux.

I do have ps2pdf, but what I thought (based on reading Guido Gonzato's ABCplus manual) was that Postscript only accepted an 8 bit Latin-1 character set. If that is true, converting to PDF with ps2pdf wouldn't help because the information would already be lost.
Logged
I'm a melodeon player. What's your excuse?
Music recording and web hosting: www.treewind.co.uk
Mary Humphreys and Anahata: www.maryanahata.co.uk
Ceilidh band: www.barleycoteband.co.uk
Pages: [1] 2   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