|
|
|
Lines 352-369
nsMathMLmmultiscriptsFrame::PlaceMultiSc
|
Link Here
|
|---|
|
| 352 |
// If italics correction is applied, we always add "a little to spare" |
352 |
// If italics correction is applied, we always add "a little to spare" |
| 353 |
// (see TeXbook Ch.11, p.64), as we estimate the italic creation |
353 |
// (see TeXbook Ch.11, p.64), as we estimate the italic creation |
| 354 |
// ourselves and it isn't the same as TeX. |
354 |
// ourselves and it isn't the same as TeX. |
| 355 |
italicCorrection += onePixel; |
355 |
italicCorrection += onePixel; |
| 356 |
} |
356 |
} |
| 357 |
|
357 |
|
| 358 |
// we update boundingMetrics.{ascent,descent} with that |
358 |
// we update boundingMetrics.{ascent,descent} with that |
| 359 |
// of the baseFrame only after processing all the sup/sub pairs |
359 |
// of the baseFrame only after processing all the sup/sub pairs |
| 360 |
// XXX need italic correction only *if* there are postscripts ? |
360 |
boundingMetrics.width = bmBase.width; |
| 361 |
boundingMetrics.width = bmBase.width + italicCorrection; |
|
|
| 362 |
boundingMetrics.rightBearing = bmBase.rightBearing; |
361 |
boundingMetrics.rightBearing = bmBase.rightBearing; |
| 363 |
boundingMetrics.leftBearing = bmBase.leftBearing; // until overwritten |
362 |
boundingMetrics.leftBearing = bmBase.leftBearing; // until overwritten |
| 364 |
} else { |
363 |
} else { |
| 365 |
// super/subscript block |
364 |
// super/subscript block |
| 366 |
if ( childTag == nsGkAtoms::none) { |
365 |
if ( childTag == nsGkAtoms::none) { |
| 367 |
foundNoneTag = true; |
366 |
foundNoneTag = true; |
| 368 |
} |
367 |
} |
| 369 |
|
368 |
|
|
Lines 420-441
nsMathMLmmultiscriptsFrame::PlaceMultiSc
|
Link Here
|
|---|
|
| 420 |
bmMultiSup.ascent = std::max(bmMultiSup.ascent, bmSupScript.ascent); |
419 |
bmMultiSup.ascent = std::max(bmMultiSup.ascent, bmSupScript.ascent); |
| 421 |
bmMultiSup.descent = std::max(bmMultiSup.descent, bmSupScript.descent); |
420 |
bmMultiSup.descent = std::max(bmMultiSup.descent, bmSupScript.descent); |
| 422 |
multiSupSize.Height() = |
421 |
multiSupSize.Height() = |
| 423 |
std::max(multiSupSize.Height(), |
422 |
std::max(multiSupSize.Height(), |
| 424 |
supScriptSize.Height() - supScriptSize.TopAscent()); |
423 |
supScriptSize.Height() - supScriptSize.TopAscent()); |
| 425 |
|
424 |
|
| 426 |
if (bmSupScript.width) |
425 |
if (bmSupScript.width) |
| 427 |
width = std::max(width, bmSupScript.width + aScriptSpace); |
426 |
width = std::max(width, bmSupScript.width + aScriptSpace); |
| 428 |
rightBearing = std::max(rightBearing, bmSupScript.rightBearing); |
|
|
| 429 |
|
427 |
|
| 430 |
if (!prescriptsFrame) { // we are still looping over base & postscripts |
428 |
if (!prescriptsFrame) { // we are still looping over base & postscripts |
|
|
429 |
rightBearing = std::max(rightBearing, |
| 430 |
italicCorrection + bmSupScript.rightBearing); |
| 431 |
boundingMetrics.rightBearing = boundingMetrics.width + rightBearing; |
431 |
boundingMetrics.rightBearing = boundingMetrics.width + rightBearing; |
| 432 |
boundingMetrics.width += width; |
432 |
boundingMetrics.width += width; |
| 433 |
} else { |
433 |
} else { |
|
|
434 |
rightBearing = std::max(rightBearing, bmSupScript.rightBearing); |
| 434 |
prescriptsWidth += width; |
435 |
prescriptsWidth += width; |
| 435 |
if (firstPrescriptsPair) { |
436 |
if (firstPrescriptsPair) { |
| 436 |
firstPrescriptsPair = false; |
437 |
firstPrescriptsPair = false; |
| 437 |
boundingMetrics.leftBearing = |
438 |
boundingMetrics.leftBearing = |
| 438 |
std::min(bmSubScript.leftBearing, bmSupScript.leftBearing); |
439 |
std::min(bmSubScript.leftBearing, bmSupScript.leftBearing); |
| 439 |
} |
440 |
} |
| 440 |
} |
441 |
} |
| 441 |
width = rightBearing = 0; |
442 |
width = rightBearing = 0; |
|
Lines 565-581
nsMathMLmmultiscriptsFrame::PlaceMultiSc
|
Link Here
|
|---|
|
| 565 |
// place the base ... |
566 |
// place the base ... |
| 566 |
childFrame = baseFrame; |
567 |
childFrame = baseFrame; |
| 567 |
dy = aDesiredSize.TopAscent() - baseSize.TopAscent(); |
568 |
dy = aDesiredSize.TopAscent() - baseSize.TopAscent(); |
| 568 |
FinishReflowChild (baseFrame, aPresContext, baseSize, nullptr, |
569 |
FinishReflowChild (baseFrame, aPresContext, baseSize, nullptr, |
| 569 |
aFrame->MirrorIfRTL(aDesiredSize.Width(), |
570 |
aFrame->MirrorIfRTL(aDesiredSize.Width(), |
| 570 |
baseSize.Width(), |
571 |
baseSize.Width(), |
| 571 |
dx), |
572 |
dx), |
| 572 |
dy, 0); |
573 |
dy, 0); |
| 573 |
dx += bmBase.width + italicCorrection; |
574 |
dx += bmBase.width; |
| 574 |
} else if (prescriptsFrame != childFrame) { |
575 |
} else if (prescriptsFrame != childFrame) { |
| 575 |
// process each sup/sub pair |
576 |
// process each sup/sub pair |
| 576 |
if (0 == count) { |
577 |
if (0 == count) { |
| 577 |
subScriptFrame = childFrame; |
578 |
subScriptFrame = childFrame; |
| 578 |
count = 1; |
579 |
count = 1; |
| 579 |
} else if (1 == count) { |
580 |
} else if (1 == count) { |
| 580 |
if (tag != nsGkAtoms::msub_) |
581 |
if (tag != nsGkAtoms::msub_) |
| 581 |
supScriptFrame = childFrame; |
582 |
supScriptFrame = childFrame; |
|
Lines 603-620
nsMathMLmmultiscriptsFrame::PlaceMultiSc
|
Link Here
|
|---|
|
| 603 |
aFrame->MirrorIfRTL(aDesiredSize.Width(), |
604 |
aFrame->MirrorIfRTL(aDesiredSize.Width(), |
| 604 |
subScriptSize.Width(), |
605 |
subScriptSize.Width(), |
| 605 |
x), |
606 |
x), |
| 606 |
dy, 0); |
607 |
dy, 0); |
| 607 |
} |
608 |
} |
| 608 |
|
609 |
|
| 609 |
if (supScriptFrame) { |
610 |
if (supScriptFrame) { |
| 610 |
nscoord x = dx; |
611 |
nscoord x = dx; |
| 611 |
if (isPreScript) |
612 |
if (isPreScript) { |
| 612 |
x += width - supScriptSize.Width(); |
613 |
x += width - supScriptSize.Width(); |
|
|
614 |
} else { |
| 615 |
// post superscripts are shifted by the italic correction value |
| 616 |
x += italicCorrection; |
| 617 |
} |
| 613 |
dy = aDesiredSize.TopAscent() - supScriptSize.TopAscent() - |
618 |
dy = aDesiredSize.TopAscent() - supScriptSize.TopAscent() - |
| 614 |
maxSupScriptShift; |
619 |
maxSupScriptShift; |
| 615 |
FinishReflowChild (supScriptFrame, aPresContext, supScriptSize, |
620 |
FinishReflowChild (supScriptFrame, aPresContext, supScriptSize, |
| 616 |
nullptr, |
621 |
nullptr, |
| 617 |
aFrame->MirrorIfRTL(aDesiredSize.Width(), |
622 |
aFrame->MirrorIfRTL(aDesiredSize.Width(), |
| 618 |
supScriptSize.Width(), |
623 |
supScriptSize.Width(), |
| 619 |
x), |
624 |
x), |
| 620 |
dy, 0); |
625 |
dy, 0); |