-
Notifications
You must be signed in to change notification settings - Fork 5
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
Honor measure width specifications #213
Comments
It sounds like this might be an issue in |
I'm putting this on ice for now. I tried applying |
musicxml/scaling.ts import { NamedElement } from '@/util';
const DEFAULT_MILLIMETERS = 7;
const DEFAULT_TENTHS = 40;
const DEFAULT_MILLIMETERS_PER_TENTH = DEFAULT_MILLIMETERS / DEFAULT_TENTHS;
/**
* Describes the scaling throughout the MusicXML document.
*
* See https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/scaling/
*/
export class Scaling {
constructor(private element: NamedElement<'scaling'>) {}
/** Returns the factor to adjust specified measurements by. */
getScalingFactor(): number {
const millimeters = this.getMillimeters();
const tenths = this.getTenths();
const millimetersPerTenth = millimeters / tenths;
return millimetersPerTenth / DEFAULT_MILLIMETERS_PER_TENTH;
}
/** Returns the millimeters. */
getMillimeters(): number {
return this.element.first('millimeters')?.content().withDefault(DEFAULT_MILLIMETERS).float() ?? DEFAULT_MILLIMETERS;
}
/** Returns the tenths. */
getTenths(): number {
return this.element.first('tenths')?.content().withDefault(DEFAULT_TENTHS).float() ?? DEFAULT_TENTHS;
}
} |
In #211 (comment), I realized that
vexml
is not honoring measure width specifications correctly.<scaling>
when calculating how many pixels a<measure>
element's width is.The data that can be used for testing is: Prelude_No._1_BWV_846_in_C_Major.zip
The text was updated successfully, but these errors were encountered: