@@ -23,7 +23,8 @@ function L(...args: any[]) {
23
23
function drawPedalGlyph ( name : string , context : RenderContext , x : number , y : number , point : number ) : void {
24
24
const glyph_data = PedalMarking . GLYPHS [ name ] ;
25
25
const glyph = new Glyph ( glyph_data . code , point , { category : 'pedalMarking' } ) ;
26
- glyph . render ( context , x + glyph_data . x_shift , y + glyph_data . y_shift ) ;
26
+ // Center the middle of the glyph with the middle of the note head (Tables.STAVE_LINE_DISTANCE / 2)
27
+ glyph . render ( context , x - ( glyph . getMetrics ( ) . width - Tables . STAVE_LINE_DISTANCE ) / 2 , y ) ;
27
28
}
28
29
29
30
/**
@@ -61,16 +62,12 @@ export class PedalMarking extends Element {
61
62
protected notes : StaveNote [ ] ;
62
63
63
64
/** Glyph data */
64
- static readonly GLYPHS : Record < string , { code : string ; y_shift : number ; x_shift : number } > = {
65
+ static readonly GLYPHS : Record < string , { code : string } > = {
65
66
pedal_depress : {
66
67
code : 'keyboardPedalPed' ,
67
- x_shift : - 10 ,
68
- y_shift : 0 ,
69
68
} ,
70
69
pedal_release : {
71
70
code : 'keyboardPedalUp' ,
72
- x_shift : - 2 ,
73
- y_shift : 3 ,
74
71
} ,
75
72
} ;
76
73
@@ -188,7 +185,9 @@ export class PedalMarking extends Element {
188
185
const prev_is_same = notes [ index - 1 ] === note ;
189
186
190
187
let x_shift = 0 ;
191
- const point = Tables . currentMusicFont ( ) . lookupMetric ( `pedalMarking.${ is_pedal_depressed ? 'down' : 'up' } .point` ) ;
188
+ const point =
189
+ Tables . currentMusicFont ( ) . lookupMetric ( `pedalMarking.${ is_pedal_depressed ? 'down' : 'up' } .point` ) ??
190
+ Tables . NOTATION_FONT_SCALE ;
192
191
193
192
if ( is_pedal_depressed ) {
194
193
// Adjustment for release+depress
@@ -248,7 +247,9 @@ export class PedalMarking extends Element {
248
247
const x = note . getAbsoluteX ( ) ;
249
248
const y = stave . getYForBottomText ( this . line + 3 ) ;
250
249
251
- const point = Tables . currentMusicFont ( ) . lookupMetric ( `pedalMarking.${ is_pedal_depressed ? 'down' : 'up' } .point` ) ;
250
+ const point =
251
+ Tables . currentMusicFont ( ) . lookupMetric ( `pedalMarking.${ is_pedal_depressed ? 'down' : 'up' } .point` ) ??
252
+ Tables . NOTATION_FONT_SCALE ;
252
253
253
254
let text_width = 0 ;
254
255
if ( is_pedal_depressed ) {
0 commit comments