Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shape notes: Help defining glyphs #101

Open
torotil opened this issue Aug 22, 2021 · 6 comments
Open

Shape notes: Help defining glyphs #101

torotil opened this issue Aug 22, 2021 · 6 comments

Comments

@torotil
Copy link

torotil commented Aug 22, 2021

Hi, I’m trying to make abcm2ps render shape notes. I’ve started from the shape note example and further refined it to also include non-filled shapes for half notes and full notes (see my current version at the bottom).

Through trial and error I’ve found that while I can’t remove the class-attribute (I then get a broken PS file), I can replace it with another class.

I’ve also found the svg.c source file which seems to provide many examples for defining glyphs.

At the moment I’m trying increase the stroke-width for the unfilled heads, but it doesn’t seem to accept the stroke-width attribute as in the svg.c. In a more general sense I’m wondering which SVG subset is supported here.

Am I looking for this in the right place? Is there more documentation for defining the note head glyphs that I didn’t find?


%%beginsvg
<defs>
<path id="fablup" d="m-3.5 -2.9l7.2 0 0 5.8z" class="fill"/>
<path id="fablupo" d="m-3.5 -2.9l7.2 0 0 5.8z" class="stroke"/>
<path id="fabldn" d="m-3.5 -2.9l7.2 5.8 -7.2 0z" class="fill"/>
<path id="fabldno" d="m-3.5 -2.9l7.2 5.8 -7.2 0z" class="stroke"/>
<path id="labl" d="m-3.5 2.9l0 -5.8 7.2 0 0 5.8z" class="fill"/>
<path id="lablo" d="m-3.5 2.9l0 -5.8 7.2 0 0 5.8z" class="stroke"/>
<path id="mibl" d="m0 3l-3.7 -3.2 3.7 -3.2 3.7 3.2z" class="fill"/>
<path id="miblo" d="m0 3l-3.7 -3.2 3.7 -3.2 3.7 3.2z" class="stroke"/>
</defs>
%%endsvg
%
%%map shape key,C heads=fablup/fabldn,fablupo/fabldno
%%map shape key,E heads=labl,lablo
%%map shape key,F heads=fablup/fabldn,fablupo/fabldno
%%map shape key,A heads=labl,lablo
%%map shape key,B heads=mibl,miblo
%
@moinejf
Copy link
Collaborator

moinejf commented Aug 22, 2021

Hi,
In the <defs>, you can add an other class:

<path id="fablupo" d="m-3.5 -2.9l7.2 0 0 5.8z" class="stroke stw"/>

Then, the class could be defined in a <style> that would contain all the attributes you want, including stroke-width:

<style> .stw {stroke-width: 1.4} </style>

I updated the shape example (care, the file extension has changed from xhtml to html):

http://moinejf.free.fr/abcm2ps-doc/shape.html

But, this does not work with the PostScript output of abcm2ps.
Instead, you have to redefine manually the PS functions fablupo, fabldno...

@torotil
Copy link
Author

torotil commented Aug 23, 2021

But, this does not work with the PostScript output of abcm2ps.

I was talking about the PS output. Funnily the instructions (as in the new example) do work just fine for PS output, except for the styles.

Instead, you have to redefine manually the PS functions fablupo, fabldno...

Could you give me pointers on how to find out how to do this?

@moinejf
Copy link
Collaborator

moinejf commented Aug 23, 2021

I looked in the code of abcm2ps and, you're lucky, the stroke width may be defined in the %%beginsvg definitions by
style="stroke-width:1.4"
after the class.
I updated the shape example
http://moinejf.free.fr/abcm2ps-doc/shape.html

@torotil
Copy link
Author

torotil commented Aug 23, 2021

That’s great thanks. For fine-tuning this further (aligning staff with head, having different stroke widths for horizontal / vertical lignes …) etc. I’d still need more control over this. I don’t think a blind trial-error approach will allow this. Is there anything I that you can point me at that would help me? (I am a software developer so reading C code is not entirely beyond me).

@moinejf
Copy link
Collaborator

moinejf commented Aug 23, 2021

Well, abcm2ps can do both PostScript (PS) and SVG. For SVG, it contains a small PS interpreter, so, the SVG output is rather odd.

Now that abcm2ps does not evolve anymore, it is replaced by abc2svg which does only SVG output.
There are bridges between PS and SVG in both programs. So, some of the %%beginsvg..%%endsvg definitions are understood by abcm2ps, and some of the %%beginps..%%endps definitions are understood by abc2svg.

As it seems that your better like PS output, you should use %%beginps..%%endps and have a fine definition of the graphical output. The PostScript language is defined in the Adobe document PLRM3.pdf.

For the shape notes, the move from SVG to PS is easy enough: with abcm2ps, generate a simple ABC tune with the SVG definitions, and, then, looking at the generated PS file, you will see the functions /fablup, /fablupo ... (these functions have been generated from the SVG definitions).

You can then move these PS functions to your ABC tune between %%beginps and %%endps, and remove the %%beginsvg .. %%endsvg sequence. The result shoud be the same.

@torotil
Copy link
Author

torotil commented Aug 23, 2021

Thanks for writing this up! It’s very useful.

I didn’t realise that abcm2ps was being phased out. Being more fluent in SVG than PS, this might indeed be a good opportunity for me to attempt a switch instead of investing more into abcm2ps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants