Fix calc. of TAB symbols bbox

Fix drawing of broken stems
Improve kerning of multi-digit numbers
This commit is contained in:
Maurizio Gavioli 2012-09-21 18:31:31 +02:00
parent 8b016da895
commit 58706c4c1b
5 changed files with 328 additions and 50 deletions

Binary file not shown.

View file

@ -23,7 +23,7 @@ OS2Version: 0
OS2_WeightWidthSlopeOnly: 0
OS2_UseTypoMetrics: 1
CreationTime: 1291378652
ModificationTime: 1345070770
ModificationTime: 1348235366
PfmFamily: 17
TTFWeight: 500
TTFWidth: 5
@ -54,7 +54,7 @@ NameList: Adobe Glyph List
DisplaySize: -48
AntiAlias: 1
FitToEm: 1
WinInfo: 32 16 13
WinInfo: 16 16 13
BeginPrivate: 0
EndPrivate
Grid
@ -71,7 +71,7 @@ Grid
-300 460 m 9,6,-1
700 460 l 25
EndSplineSet
BeginChars: 65536 128
BeginChars: 65536 129
StartChar: space
Encoding: 32 32 0
@ -1369,7 +1369,22 @@ StartChar: A
Encoding: 65 65 41
Width: 649
Flags: W
HStem: -10 140<160.5 267.801> -1 140<467.5 578.5> 330 140<276.263 469>
VStem: 66 124<79.5 214.641> 422 94<279.797 324.844>
LayerCount: 2
Back
SplineSet
464 264 m 0,0,1
449 176 449 176 379 125 c 24,2,3
291 60 291 60 222 60 c 0,4,5
128 60 128 60 128 160 c 27,6,7
128 240 128 240 185 340 c 0,8,9
220 400 220 400 394 400 c 3,10,11
449 400 449 400 486 388 c 17,12,13
449 179 449 179 455 150 c 24,14,15
469 69 469 69 518.5 69 c 131,-1,16
568 69 568 69 614 132 c 24,17,-1
EndSplineSet
Fore
SplineSet
392 110 m 1,0,-1
@ -1417,7 +1432,24 @@ StartChar: B
Encoding: 66 66 42
Width: 608
Flags: W
HStem: 0 140<269.5 397> 330 140<283.5 410.5>
VStem: 113 124<205.46 325.034 388 516.203> 444 124<174 322>
LayerCount: 2
Back
SplineSet
175 235 m 0,0,1
176 303 176 303 224 351 c 0,2,3
273 400 273 400 340 400 c 0,4,5
408 399 408 399 456 351 c 0,6,7
506 303 506 303 506 235 c 128,-1,8
506 167 506 167 456 119 c 0,9,10
407 70 407 70 340 70 c 0,11,12
272 71 272 71 224 119 c 0,13,14
174 169 174 169 175 235 c 0,0,1
113 595 m 24,15,16
175 573 175 573 175 503 c 2,17,-1
175 221 l 2,18,19
EndSplineSet
Fore
SplineSet
175 648 m 9,0,1
@ -1457,7 +1489,19 @@ StartChar: C
Encoding: 67 67 43
Width: 543
Flags: W
HStem: 320 140<312.938 473>
VStem: 160 125<161.25 284.25>
LayerCount: 2
Back
SplineSet
514 390 m 25,0,-1
328 390 l 18,1,2
278 390 278 390 240 331 c 24,3,4
222 303 222 303 222 227 c 27,5,6
222 184 222 184 233 145 c 0,7,8
258 59 258 59 297 60 c 0,9,10
335 60 335 60 371 77 c 24,11,-1
EndSplineSet
Fore
SplineSet
576 443 m 1,0,-1
@ -1488,7 +1532,23 @@ StartChar: D
Encoding: 68 68 44
Width: 631
Flags: W
HStem: -11 140<275.455 405> 365 140<-88.3193 186 226.012 406.155>
VStem: 90 124<128 288.5> 467 124<191 357.5>
LayerCount: 2
Back
SplineSet
-212 511 m 0,0,1
-136 435 -136 435 -7 435 c 2,2,3
388 435 l 26,4,5
442 435 442 435 478 390 c 24,6,7
529 326 529 326 529 259 c 27,8,9
529 186 529 186 471 123 c 24,10,11
412 59 412 59 346 59 c 27,12,13
256 59 256 59 208 98 c 24,14,15
152 143 152 143 152 216 c 27,16,17
152 308 152 308 203 364 c 0,18,19
268 435 268 435 376 435 c 0,20,-1
EndSplineSet
Fore
SplineSet
331 365 m 2,0,1
@ -1530,7 +1590,22 @@ StartChar: E
Encoding: 69 69 45
Width: 596
Flags: W
HStem: -10 140<333.099 469.666> 330 140<332.249 470.922>
VStem: 144 124<171.278 290.5>
LayerCount: 2
Back
SplineSet
631 172 m 0,0,1
532 61 532 61 405 60 c 27,2,3
239 60 239 60 217 145 c 0,4,5
206 188 206 188 206 227 c 27,6,7
206 281 206 281 227 315.5 c 0,8,9
246 346 246 346 287 375 c 0,10,11
323 400 323 400 374 400 c 27,12,13
427 400 427 400 451 391 c 0,14,15
493 375 493 375 493 346 c 27,16,17
493 303 493 303 313 170 c 0,18,-1
EndSplineSet
Fore
SplineSet
293 167 m 1,0,1
@ -1571,7 +1646,18 @@ StartChar: F
Encoding: 70 70 46
Width: 600
Flags: W
HStem: -135 140<-56 34.8613> 455 140<466.907 550>
LayerCount: 2
Back
SplineSet
-97 -65 m 17,2,3
20 -65 l 0,4,5
121 -65 121 -65 252 230 c 128,-1,6
383 525 383 525 483 525 c 27,7,8
537 525 537 525 591 525 c 26,9,-1
76 218 m 25,0,-1
459 242 l 25,1,-1
EndSplineSet
Fore
SplineSet
-159 -118 m 1,0,-1
@ -1609,7 +1695,22 @@ Encoding: 71 71 47
Width: 580
VWidth: 1000
Flags: W
HStem: -135 140<201.183 373.926> 390 140<308.263 494.5>
VStem: 98 124<144.5 274.641>
LayerCount: 2
Back
SplineSet
501 324 m 0,0,1
489 251 489 251 411 185 c 24,2,3
346 130 346 130 262 130 c 0,4,5
160 130 160 130 160 220 c 27,6,7
160 300 160 300 217 400 c 0,8,9
252 460 252 460 426 460 c 3,10,11
481 460 481 460 518 448 c 17,12,13
459 11 l 18,14,15
449 -65 449 -65 275 -65 c 11,16,17
114 -65 114 -65 128 23 c 0,18,-1
EndSplineSet
Fore
SplineSet
439 272 m 2,0,-1
@ -1657,7 +1758,23 @@ StartChar: H
Encoding: 72 72 48
Width: 608
Flags: W
HStem: 330 140<283.5 411.684>
VStem: 113 124<135.539 325.034 388 515.461> 444 124<91.9243 261.734>
LayerCount: 2
Back
SplineSet
237 56 m 17,12,13
175 78 175 78 175 148 c 2,14,-1
175 503 l 2,15,16
175 573 175 573 113 595 c 9,17,-1
401 -96 m 17,3,4
506 29 506 29 506 148 c 10,5,-1
506 235 l 2,6,7
506 301 506 301 456 351 c 0,8,9
408 399 408 399 340 400 c 0,10,11
273 400 273 400 224 351 c 0,12,13
176 303 176 303 175 235 c 0,14,-1
EndSplineSet
Fore
SplineSet
339 -149 m 1,0,1
@ -1702,8 +1819,17 @@ StartChar: I
Encoding: 73 73 49
Width: 460
VWidth: 1000
Flags: W
Flags: MW
HStem: 725 20G<266 307.667>
VStem: 270 140<128.607 335.435>
LayerCount: 2
Back
SplineSet
402 56 m 17,15,16
340 78 340 78 340 136 c 2,17,-1
340 336 l 2,17,-1
340 394 340 394 278 416 c 9,15,16
EndSplineSet
Fore
SplineSet
212 653 m 1,0,-1
@ -1760,7 +1886,25 @@ Encoding: 75 75 51
Width: 500
VWidth: 1000
Flags: W
HStem: 305 140<283.5 411>
VStem: 113 124<135.539 300.034 479 515.461> 444 124<136.631 236.734>
LayerCount: 2
Back
SplineSet
175 397 m 25,0,-1
468 566 l 25,1,-1
568 56 m 17,2,3
506 83 506 83 506 148 c 2,4,-1
506 210 l 2,5,6
506 276 506 276 456 326 c 0,7,8
408 374 408 374 340 375 c 0,9,10
273 375 273 375 224 326 c 0,11,12
176 278 176 278 175 210 c 0,13,-1
237 56 m 17,14,15
175 78 175 78 175 148 c 2,16,-1
175 503 l 2,17,18
175 573 175 573 113 595 c 9,19,-1
EndSplineSet
Fore
SplineSet
299 109 m 1,0,-1
@ -1812,7 +1956,15 @@ Encoding: 76 76 52
Width: 502
VWidth: 1000
Flags: W
VStem: 278 124<135.785 515.215>
LayerCount: 2
Back
SplineSet
402 56 m 17,12,13
340 78 340 78 340 148 c 2,14,-1
340 503 l 2,15,16
340 573 340 573 278 595 c 9,17,-1
EndSplineSet
Fore
SplineSet
464 109 m 1,0,-1
@ -1838,8 +1990,32 @@ StartChar: M
Encoding: 77 77 53
Width: 673
VWidth: 1000
Flags: W
Flags: MW
HStem: 330 140<187 271 405 489>
VStem: 60 124<135.785 329.375> 278 124<135.785 278.688> 496 124<135.785 278.688>
CounterMasks: 1 70
LayerCount: 2
Back
SplineSet
620 56 m 17,12,13
558 78 558 78 558 148 c 2,14,-1
558 235 l 2,17,-1
558 301 558 301 525 351 c 0,6,7
493 399 493 399 448 400 c 0,4,5
404 400 404 400 372 351 c 0,2,3
340 303 340 303 340 235 c 0,0,1
402 56 m 17,12,13
340 78 340 78 340 148 c 2,14,-1
340 235 l 2,17,-1
340 301 340 301 307 351 c 0,6,7
275 399 275 399 230 400 c 0,4,5
186 400 186 400 154 351 c 0,2,3
122 303 122 303 122 235 c 0,0,1
184 56 m 17,12,13
122 78 122 78 122 148 c 2,14,-1
122 338 l 2,15,16
122 408 122 408 60 430 c 9,17,-1
EndSplineSet
Fore
SplineSet
246 109 m 1,0,-1
@ -1904,8 +2080,24 @@ StartChar: N
Encoding: 78 78 54
Width: 618
VWidth: 1000
Flags: W
Flags: MW
HStem: 330 140<283.5 410.5>
VStem: 113 124<135.785 318.531> 444 124<135.785 263.047>
LayerCount: 2
Back
SplineSet
568 56 m 17,12,13
506 78 506 78 506 148 c 2,14,-1
506 235 l 2,17,-1
506 301 506 301 456 351 c 0,6,7
408 399 408 399 340 400 c 0,4,5
273 400 273 400 224 351 c 0,2,3
176 303 176 303 175 235 c 0,0,1
237 56 m 17,12,13
175 78 175 78 175 148 c 2,14,-1
175 338 l 2,15,16
175 408 175 408 113 430 c 9,17,-1
EndSplineSet
Fore
SplineSet
299 109 m 1,0,-1
@ -1951,7 +2143,21 @@ StartChar: O
Encoding: 79 79 55
Width: 612
Flags: W
HStem: -10 140<296.568 382.691> 330 140<297.309 383.432>
VStem: 108 124<142 292> 448 124<168 318>
LayerCount: 2
Back
SplineSet
170 230 m 128,-1,0
170 300 170 300 220 350 c 128,-1,1
270 400 270 400 340 400 c 128,-1,2
410 400 410 400 460 350 c 128,-1,3
510 300 510 300 510 230 c 128,-1,4
510 160 510 160 460 110 c 128,-1,5
410 60 410 60 340 60 c 128,-1,6
270 60 270 60 220 110 c 128,-1,7
170 160 170 160 170 230 c 128,-1,0
EndSplineSet
Fore
SplineSet
232 283 m 0,0,1
@ -2631,6 +2837,8 @@ Encoding: 161 161 80
Width: 556
VWidth: 1000
Flags: W
HStem: 505 63<102 207.012>
VStem: 259 88<0 505> 289 58<646.802 709>
LayerCount: 2
Fore
SplineSet
@ -2644,6 +2852,7 @@ SplineSet
259 0 l 1,8,-1
259 505 l 1,0,-1
EndSplineSet
Kerns2: 88 -210 "'kern' Horizontal Kerning lookup 0-1" 87 -210 "'kern' Horizontal Kerning lookup 0-1" 86 -210 "'kern' Horizontal Kerning lookup 0-1" 85 -210 "'kern' Horizontal Kerning lookup 0-1" 84 -210 "'kern' Horizontal Kerning lookup 0-1" 83 -210 "'kern' Horizontal Kerning lookup 0-1" 82 -210 "'kern' Horizontal Kerning lookup 0-1" 81 -210 "'kern' Horizontal Kerning lookup 0-1" 80 -210 "'kern' Horizontal Kerning lookup 0-1" 126 -210 "'kern' Horizontal Kerning lookup 0-1"
EndChar
StartChar: cent
@ -2651,6 +2860,8 @@ Encoding: 162 162 81
Width: 556
VWidth: 1000
Flags: W
HStem: 0 87<133 506> 632 77<201.075 360.471>
VStem: 50 88<463 558.854> 421 85<425.363 573.193>
LayerCount: 2
Fore
SplineSet
@ -2674,6 +2885,7 @@ SplineSet
148 632 148 632 138 463 c 1,25,-1
50 463 l 1,0,1
EndSplineSet
Kerns2: 126 -45 "'kern' Horizontal Kerning lookup 0-1" 88 -45 "'kern' Horizontal Kerning lookup 0-1" 87 -45 "'kern' Horizontal Kerning lookup 0-1" 86 -45 "'kern' Horizontal Kerning lookup 0-1" 85 -45 "'kern' Horizontal Kerning lookup 0-1" 84 -45 "'kern' Horizontal Kerning lookup 0-1" 83 -45 "'kern' Horizontal Kerning lookup 0-1" 82 -45 "'kern' Horizontal Kerning lookup 0-1" 81 -45 "'kern' Horizontal Kerning lookup 0-1" 80 -45 "'kern' Horizontal Kerning lookup 0-1"
EndChar
StartChar: sterling
@ -2681,6 +2893,8 @@ Encoding: 163 163 82
Width: 556
VWidth: 1000
Flags: W
HStem: -23 78<180.072 356.46> 325 75<221 351.675> 480 21G<47 136> 632 77<184.1 349.155>
VStem: 32 88<122.417 206> 47 88<480 574.764> 395 90<437.663 586.323> 416 90<112.708 278.063>
LayerCount: 2
Fore
SplineSet
@ -2718,6 +2932,8 @@ Encoding: 164 164 83
Width: 556
VWidth: 1000
Flags: W
HStem: 170 79<105 327 415 520>
VStem: 327 88<0 170 249 559>
LayerCount: 2
Fore
SplineSet
@ -2745,6 +2961,8 @@ Encoding: 165 165 84
Width: 556
VWidth: 1000
Flags: W
HStem: -23 78<186.164 353.756> 389 78<187.135 352.923> 622 87<181 476>
VStem: 35 88<121.661 174> 423 90<125.517 315.285>
LayerCount: 2
Fore
SplineSet
@ -2757,23 +2975,18 @@ SplineSet
513 336 513 336 513 231 c 0,8,9
513 119 513 119 445 48 c 128,-1,10
377 -23 377 -23 270 -23 c 0,11,12
229 -23 229 -23 194.5 -14 c 128,-1,13
160 -5 160 -5 137.5 7.5 c 128,-1,14
115 20 115 20 96.5 40.5 c 128,-1,15
78 61 78 61 68.5 76.5 c 128,-1,16
59 92 59 92 50.5 115.5 c 128,-1,17
42 139 42 139 40 148 c 128,-1,18
38 157 38 157 35 174 c 1,19,-1
123 174 l 1,20,21
154 55 154 55 268 55 c 0,22,23
340 55 340 55 381.5 99 c 128,-1,24
423 143 423 143 423 219 c 0,25,26
423 298 423 298 381 343.5 c 128,-1,27
339 389 339 389 268 389 c 0,28,29
227 389 227 389 198 374.5 c 128,-1,30
169 360 169 360 138 323 c 1,31,-1
57 323 l 1,32,-1
110 709 l 1,33,-1
192.4 -23 192.4 -23 124.417 14.7681 c 128,-1,13
56.4348 52.5362 56.4348 52.5362 35 174 c 1,14,-1
123 174 l 1,15,16
154 55 154 55 268 55 c 0,17,18
340 55 340 55 381.5 99 c 128,-1,19
423 143 423 143 423 219 c 0,20,21
423 298 423 298 381 343.5 c 128,-1,22
339 389 339 389 268 389 c 0,23,24
227 389 227 389 198 374.5 c 128,-1,25
169 360 169 360 138 323 c 1,26,-1
57 323 l 1,27,-1
110 709 l 1,28,-1
476 709 l 1,0,-1
EndSplineSet
EndChar
@ -2783,6 +2996,8 @@ Encoding: 166 166 85
Width: 556
VWidth: 1000
Flags: W
HStem: -23 78<205.706 358.021> 363 78<202.612 363.454> 524 21G<404.5 498> 631 78<216.63 360.744>
VStem: 43 95<145.476 509.377> 423 90<122.766 300.664>
LayerCount: 2
Fore
SplineSet
@ -2822,6 +3037,8 @@ Encoding: 167 167 86
Width: 556
VWidth: 1000
Flags: W
HStem: 622 87<46 429>
VStem: 138 94<0 83.9062>
LayerCount: 2
Fore
SplineSet
@ -2843,6 +3060,8 @@ Encoding: 168 168 87
Width: 556
VWidth: 1000
Flags: W
HStem: -23 78<189.888 359.331> 334 74<196.066 353.934> 631 78<196.131 353.869>
VStem: 37 90<116.362 272.212> 62 90<450.563 587.612> 398 90<450.293 587.595> 423 90<115.584 273.521>
LayerCount: 2
Fore
SplineSet
@ -2887,6 +3106,8 @@ Encoding: 169 169 88
Width: 556
VWidth: 1000
Flags: W
HStem: -23 78<190.256 334.206> 245 78<187.742 346.7> 632 77<193.699 345.451>
VStem: 38 90<385.336 563.374> 413 96<176.623 540.066>
LayerCount: 2
Fore
SplineSet
@ -4114,6 +4335,8 @@ Encoding: 170 170 126
Width: 556
VWidth: 1000
Flags: W
HStem: -23 73<207.306 342.835> 631 78<208.264 341.127>
VStem: 43 90<157.512 524.073> 417 90<154.432 524.943>
LayerCount: 2
Fore
SplineSet
@ -4142,6 +4365,8 @@ Encoding: 80 80 127
Width: 1024
VWidth: 0
Flags: W
HStem: -1 142<295.809 381.951> 329 142<298.08 383.943>
VStem: 113 124<-36 12 207.266 317.531> 443 126<175 321>
LayerCount: 2
Back
SplineSet
@ -4192,5 +4417,67 @@ SplineSet
237 -36 l 1,16,-1
EndSplineSet
EndChar
StartChar: Q
Encoding: 81 81 128
Width: 1024
VWidth: 0
Flags: W
HStem: 0 140<269 397> 330 140<283.5 411>
VStem: 113 124<206.535 263> 448 120<-24.2031 86.8835 145.932 255.699>
LayerCount: 2
Back
SplineSet
508 416 m 1,0,-1
508 -12 l 2,1,2
508 -82 508 -82 570 -104 c 9,3,-1
175 235 m 0,4,5
176 303 176 303 224 351 c 0,6,7
273 400 273 400 340 400 c 0,8,9
408 399 408 399 456 351 c 0,10,11
506 303 506 303 506 235 c 128,-1,12
506 167 506 167 456 119 c 0,13,14
407 70 407 70 340 70 c 0,15,16
272 71 272 71 224 119 c 0,17,18
174 169 174 169 175 235 c 0,4,5
EndSplineSet
Fore
SplineSet
113 182 m 0,0,1
114 242 114 242 151 286 c 2,2,-1
254 409 l 2,3,4
259 415 259 415 265 421 c 0,5,6
314 470 314 470 381 470 c 1,7,8
441 469 441 469 485 432 c 1,9,-1
506 415 l 1,10,-1
506 414.2 l 1,11,-1
568 470 l 1,12,-1
568 288 l 1,13,-1
568 42 l 2,14,15
568 -28 568 -28 630 -50 c 1,16,-1
510 -158 l 1,17,18
448 -136 448 -136 448 -66 c 2,19,-1
448 86.8835 l 1,20,-1
428 63 l 2,21,22
422 56 422 56 415 49 c 0,23,24
366 0 366 0 299 0 c 1,25,26
239 1 239 1 195 38 c 1,27,-1
174 55 l 1,28,-1
174 56 l 1,29,30
168 61 168 61 162 66 c 0,31,32
112 116 112 116 113 182 c 0,0,1
237 288 m 0,33,34
236 222 236 222 286 172 c 0,35,36
287 171 287 171 288 170 c 0,37,38
329 141 329 141 381 140 c 0,39,40
413 140 413 140 441 151 c 1,41,42
444 166 444 166 444 182 c 0,43,44
444 250 444 250 394 298 c 0,45,46
393 299 393 299 392 300 c 0,47,48
351 329 351 329 299 330 c 0,49,50
268 330 268 330 240 319 c 1,51,52
237 304 237 304 237 288 c 0,33,34
EndSplineSet
EndChar
EndChars
EndSplineFont

View file

@ -543,26 +543,20 @@ void Note::draw(QPainter* painter) const
// tablature
if (tablature) {
if (tieBack())
return;
StaffTypeTablature* tab = (StaffTypeTablature*)staff()->staffType();
if (tieBack() && tab->slashStyle())
return;
qreal mag = magS();
qreal imag = 1.0 / mag;
painter->scale(mag, mag);
painter->setFont(tab->fretFont());
// // when using letters, "+(_fret > 8)" skips 'j'
// QString s = _ghost ? "X" :
// ( tab->useNumbers() ? QString::number(_fret) : QString('a' + _fret + (_fret > 8)) );
QString s = tab->fretString(_fret, _ghost);
qreal currSpatium = spatium();
qreal d = currSpatium * .2;
QRectF bb = bbox().adjusted(-d, 2*d, d, -2*d);
// draw background, if required
if (!tab->linesThrough() || fretConflict()) {
qreal d = spatium() * .1;
QRectF bb = bbox().adjusted(-d, -d, d, d);
// we do not know which viewer did this draw() call
// so update all:
foreach(MuseScoreView* view, score()->getViewer())

View file

@ -541,24 +541,14 @@ void StaffTypeTablature::setOnLines(bool val)
// checks whether the internally computed metrics are is still valid and re-computes them, if not
//---------------------------------------------------------
static QString g_strNumbers("0123456789");
static QString g_strLetters("abcdefghiklmnopq");
// used both to generate duration symbols and to compute duration metrics:
static QChar g_cDurationChars[] = { 0xE0FF, 0xE100, 0xE101, 0xE102, 0xE103, 0xE104,
// Longa Brevis Whole Half Quarter 1/8
0xE105, 0xE106, 0xE107, 0xE108, 0xE109, 0xE10B, ' ', ' '};
// 1\16 1\32 1\64 1\128 1\256 dot
#define STAFFTYPETAB_NUMOFDURCHARS 12 /* how many used chars there are in g_cDurationChar[] */
#define STAFFTYPETAB_IDXOFDOTCHAR 11 /* the offset of the dot char in g_cDurationChars[] */
void StaffTypeTablature::setDurationMetrics()
{
if (_durationMetricsValid && _refDPI == MScore::DPI) // metrics are still valid
return;
QFontMetricsF fm(durationFont());
QRectF bb( fm.tightBoundingRect(QString(g_cDurationChars, STAFFTYPETAB_NUMOFDURCHARS)) );
QString txt(_durationFonts[_durationFontIdx].displayValue, NUM_OF_TAB_VALS);
QRectF bb( fm.tightBoundingRect(txt) );
// move symbols so that the lowest margin 'sits' on the base line:
// move down by the whole part above (negative) the base line
// ( -bb.y() ) then up by the whole height ( -bb.height()/2 )
@ -579,19 +569,26 @@ void StaffTypeTablature::setFretMetrics()
return;
QFontMetricsF fm(fretFont());
// compute total height of used characters
QRectF bb(fm.tightBoundingRect(_useNumbers ? g_strNumbers : g_strLetters));
QRectF bb;
// compute vertical displacement
if(_useNumbers) {
// compute total height of used characters
QString txt = QString();
for (int idx = 0; idx < 10; idx++) // use only first 10 digits
txt.append(_fretFonts[_fretFontIdx].displayDigit[idx]);
bb = fm.tightBoundingRect(txt);
// for numbers: centre on '0': move down by the whole part above (negative)
// the base line ( -bb.y() ) then up by half the whole height ( -bb.height()/2 )
QRectF bx( fm.tightBoundingRect("0") );
QRectF bx( fm.tightBoundingRect(_fretFonts[_fretFontIdx].displayDigit[0]) );
_fretYOffset = -(bx.y() + bx.height()/2.0);
// _fretYOffset = -(bb.y() + bb.height()/2.0); // <- using bbox of all chars
}
else {
// compute total height of used characters
QString txt(_fretFonts[_fretFontIdx].displayLetter, NUM_OF_LETTERFRETS);
bb = fm.tightBoundingRect(txt);
// for letters: centre on the 'a' ascender, by moving down half of the part above the base line in bx
QRectF bx( fm.tightBoundingRect("a") );
QRectF bx( fm.tightBoundingRect(_fretFonts[_fretFontIdx].displayLetter[0]) );
_fretYOffset = -bx.y() / 2.0;
}
// if on string, we are done; if between strings, raise by half line distance

View file

@ -144,7 +144,7 @@ class StaffTypePercussion : public StaffType {
//---------------------------------------------------------
#define NUM_OF_DIGITFRETS 25
#define NUM_OF_LETTERFRETS 18
#define NUM_OF_LETTERFRETS 17
struct TablatureFretFont {
QString family; // the family of the physical font to use