зеркало из https://github.com/mozilla/pjs.git
Bug 429899. Always treat the first character of a ligature as the start of a cluster when dividing ligature width among clusters. r+a=vlad
This commit is contained in:
Родитель
5f5ff03eec
Коммит
d023abdf77
|
@ -1271,8 +1271,8 @@ public:
|
|||
// when the part is as the end of the ligature
|
||||
gfxFloat mPartWidth;
|
||||
|
||||
PRPackedBool mPartIsStartOfLigature;
|
||||
PRPackedBool mPartIsEndOfLigature;
|
||||
PRPackedBool mClipBeforePart;
|
||||
PRPackedBool mClipAfterPart;
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -1191,7 +1191,10 @@ gfxTextRun::ComputeLigatureData(PRUint32 aPartStart, PRUint32 aPartEnd,
|
|||
PRUint32 partClusterIndex = 0;
|
||||
PRUint32 partClusterCount = 0;
|
||||
for (i = result.mLigatureStart; i < result.mLigatureEnd; ++i) {
|
||||
if (charGlyphs[i].IsClusterStart()) {
|
||||
// Treat the first character of the ligature as the start of a
|
||||
// cluster for our purposes of allocating ligature width to its
|
||||
// characters.
|
||||
if (i == result.mLigatureStart || charGlyphs[i].IsClusterStart()) {
|
||||
++totalClusterCount;
|
||||
if (i < aPartStart) {
|
||||
++partClusterIndex;
|
||||
|
@ -1202,8 +1205,20 @@ gfxTextRun::ComputeLigatureData(PRUint32 aPartStart, PRUint32 aPartEnd,
|
|||
}
|
||||
result.mPartAdvance = ligatureWidth*partClusterIndex/totalClusterCount;
|
||||
result.mPartWidth = ligatureWidth*partClusterCount/totalClusterCount;
|
||||
result.mPartIsStartOfLigature = partClusterIndex == 0;
|
||||
result.mPartIsEndOfLigature = partClusterIndex + partClusterCount == totalClusterCount;
|
||||
|
||||
if (partClusterCount == 0) {
|
||||
// nothing to draw
|
||||
result.mClipBeforePart = result.mClipAfterPart = PR_TRUE;
|
||||
} else {
|
||||
// Determine whether we should clip before or after this part when
|
||||
// drawing its slice of the ligature.
|
||||
// We need to clip before the part if any cluster is drawn before
|
||||
// this part.
|
||||
result.mClipBeforePart = partClusterIndex > 0;
|
||||
// We need to clip after the part if any cluster is drawn after
|
||||
// this part.
|
||||
result.mClipAfterPart = partClusterIndex + partClusterCount < totalClusterCount;
|
||||
}
|
||||
|
||||
if (aProvider && (mFlags & gfxTextRunFactory::TEXT_ENABLE_SPACING)) {
|
||||
gfxFont::Spacing spacing;
|
||||
|
@ -1310,16 +1325,14 @@ static void
|
|||
ClipPartialLigature(gfxTextRun *aTextRun, gfxFloat *aLeft, gfxFloat *aRight,
|
||||
gfxFloat aXOrigin, gfxTextRun::LigatureData *aLigature)
|
||||
{
|
||||
if (!aLigature->mPartIsStartOfLigature) {
|
||||
// need to clip the ligature before the part
|
||||
if (aLigature->mClipBeforePart) {
|
||||
if (aTextRun->IsRightToLeft()) {
|
||||
*aRight = PR_MIN(*aRight, aXOrigin);
|
||||
} else {
|
||||
*aLeft = PR_MAX(*aLeft, aXOrigin);
|
||||
}
|
||||
}
|
||||
if (!aLigature->mPartIsEndOfLigature) {
|
||||
// need to clip the ligature after the part
|
||||
if (aLigature->mClipAfterPart) {
|
||||
gfxFloat endEdge = aXOrigin + aTextRun->GetDirection()*aLigature->mPartWidth;
|
||||
if (aTextRun->IsRightToLeft()) {
|
||||
*aLeft = PR_MAX(*aLeft, endEdge);
|
||||
|
|
Загрузка…
Ссылка в новой задаче