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

re-introduce font-specific formatting to chord symbol metrics #1569

Merged
merged 3 commits into from
May 28, 2023

Conversation

AaronDavidNewman
Copy link
Collaborator

These are the minimal changes to add chord symbol metrics and have custom for Petaluma.

Copy link
Collaborator

@rvilarl rvilarl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AaronDavidNewman is it working? don't you need the following change in chordsymbol?

- const glyphPoints = 20;
- symbolBlock.glyph = new Glyph(glyphArgs.code, glyphPoints, { category: 'chordSymbol' });
+ const glyphPoints = 20 * metrics.scale;
+ symbolBlock.glyph = new Glyph(glyphArgs.code, glyphPoints,);

@AaronDavidNewman
Copy link
Collaborator Author

Wow, you're right. But it does seem to be working, weirdly. The key difference is the size of the sharp. If I add my changes to the master branch, and remove them, the size follows the change.

It is not working in the sense that change the scale does not actually change the rendered glyph. But the scale of some glyphs is definitely changing. I don't really understand it, I'll have to dig in. There seems to be some type of side-effect going on.

master:
image

PR:
image

@rvilarl
Copy link
Collaborator

rvilarl commented May 22, 2023

@AaronDavidNewman I think that the scale is not working. The differences come from the other parameters. The size is the same.

@AaronDavidNewman
Copy link
Collaborator Author

Maybe it was the other parameters that were wrong, then, and not the scale. I thought the sharp was larger, but I see now that it just isn't formatted correctly. Because the advance width isn't being used.

When I apply the scaling now, the glyphs look too small. And I guess that makes sense, because scaling the symbols you'd also have to scale the width of the symbols.

So maybe the way to go is just to put the Petaluma metrics back for chord symbols, but without the scaling for now.

Main branch Too large:
image

Main branch w/metrics and scaling Too small:
image

Main branch w/metrics and no scaling Just right?:
image

And it's not just a problem with Petaluma, Bravura with scaling, also too small:
image

@AaronDavidNewman AaronDavidNewman changed the title re-introduce scale to chord symbol metrics re-introduce font-specific formatting to chord symbol metrics May 25, 2023
@AaronDavidNewman
Copy link
Collaborator Author

I've changed my mind about scaling the individual glyphs. I think the music fonts were made with the glyphs sized relative to each other intentionally, either for readability or effect. So if the left and right parens aren't the same size (like they aren't in Petaluma), it's something we should just accept when we're using that font.

The other metrics are different though, because they are needed for formatting. The common metrics only work because most of the fonts are similar enough to Bravura, but they won't work for Petaluma. Also they could be embedded in the fonts themselves so in theory we wouldn't need font-specific formatting, it would just be part of the font package.

So anyway, long winded way of saying this is ready for review.

Comment on lines +10 to +16
const petalumaChordMetrics: Record<string, ChordSymbolGlyphMetrics> = {
csymDiminished: {
leftSideBearing: -95,
advanceWidth: 506,
yOffset: 0,
},
csymHalfDiminished: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rvilarl is this approach OK with you?

Before, we had a separate metrics file for the petaluma font.

With this PR, it is hard-coded into the load_petaluma.ts file.

I guess this can serve as a way to illustrate how we can customize metrics even though those files no longer exist.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine with me for vexflow4.

@rvilarl
Copy link
Collaborator

rvilarl commented May 27, 2023

Only one comment. If we do not use the scales why do we leave them?

@rvilarl
Copy link
Collaborator

rvilarl commented May 27, 2023

FYI in Vexflow5 I found specific glyphs for the accidental
https://w3c.github.io/smufl/latest/tables/standard-accidentals-for-chord-symbols.html?highlight=csyms#standard-accidentals-for-chord-symbols-ued60ued6f
They render very nicely as text mixed with A C ...

@AaronDavidNewman
Copy link
Collaborator Author

If we do not use the scales why do we leave them?

It was an oversight. I removed it from common metrics.

@rvilarl rvilarl merged commit 6cf8770 into master May 28, 2023
@ronyeh ronyeh deleted the chord-symbol-metrics branch July 4, 2023 07:50
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

Successfully merging this pull request may close these issues.

3 participants