зеркало из https://github.com/mozilla/gecko-dev.git
Fix for bug 4627. Tested by Bruce Mitchener. Approved by Chris Yeh.
This commit is contained in:
Родитель
20c87baa91
Коммит
0170e093e7
|
@ -739,7 +739,7 @@ struct nsFontStretch
|
||||||
PRUint16 mSizesCount;
|
PRUint16 mSizesCount;
|
||||||
|
|
||||||
char* mScalable;
|
char* mScalable;
|
||||||
nsFontGTK* mScaledFonts;
|
nsFontGTK** mScaledFonts;
|
||||||
PRUint16 mScaledFontsAlloc;
|
PRUint16 mScaledFontsAlloc;
|
||||||
PRUint16 mScaledFontsCount;
|
PRUint16 mScaledFontsCount;
|
||||||
};
|
};
|
||||||
|
@ -1393,42 +1393,60 @@ PickASizeAndLoad(nsFontSearch* aSearch, nsFontStretch* aStretch,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalable) {
|
if (scalable) {
|
||||||
begin = aStretch->mScaledFonts;
|
nsFontGTK* closestBitmapSize = s;
|
||||||
end = &aStretch->mScaledFonts[aStretch->mScaledFontsCount];
|
nsFontGTK** beginScaled = aStretch->mScaledFonts;
|
||||||
for (s = begin; s < end; s++) {
|
nsFontGTK** endScaled =
|
||||||
if (s->mSize == desiredSize) {
|
&aStretch->mScaledFonts[aStretch->mScaledFontsCount];
|
||||||
|
nsFontGTK** p;
|
||||||
|
for (p = beginScaled; p < endScaled; p++) {
|
||||||
|
if ((*p)->mSize == desiredSize) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (s == end) {
|
if (p == endScaled) {
|
||||||
|
s = new nsFontGTK;
|
||||||
|
if (s) {
|
||||||
|
s->mName = PR_smprintf(aStretch->mScalable, desiredSize);
|
||||||
|
if (!s->mName) {
|
||||||
|
delete s;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
s->mSize = desiredSize;
|
||||||
|
s->mCharSetInfo = aCharSet->mInfo;
|
||||||
|
s->LoadFont(aCharSet, m);
|
||||||
|
if (s->mFont) {
|
||||||
if (aStretch->mScaledFontsCount == aStretch->mScaledFontsAlloc) {
|
if (aStretch->mScaledFontsCount == aStretch->mScaledFontsAlloc) {
|
||||||
int newSize = 2 *
|
int newSize = 2 *
|
||||||
(aStretch->mScaledFontsAlloc ? aStretch->mScaledFontsAlloc : 1);
|
(aStretch->mScaledFontsAlloc ? aStretch->mScaledFontsAlloc : 1);
|
||||||
nsFontGTK* newPointer = new nsFontGTK[newSize];
|
nsFontGTK** newPointer = (nsFontGTK**)
|
||||||
|
PR_Realloc(aStretch->mScaledFonts, newSize * sizeof(nsFontGTK*));
|
||||||
if (newPointer) {
|
if (newPointer) {
|
||||||
for (int i = aStretch->mScaledFontsAlloc - 1; i >= 0; i--) {
|
|
||||||
newPointer[i] = aStretch->mScaledFonts[i];
|
|
||||||
}
|
|
||||||
aStretch->mScaledFontsAlloc = newSize;
|
aStretch->mScaledFontsAlloc = newSize;
|
||||||
delete [] aStretch->mScaledFonts;
|
|
||||||
aStretch->mScaledFonts = newPointer;
|
aStretch->mScaledFonts = newPointer;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
delete s;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aStretch->mScaledFonts[aStretch->mScaledFontsCount++] = s;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
delete s;
|
||||||
|
s = nsnull;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!s) {
|
||||||
|
if (closestBitmapSize) {
|
||||||
|
s = closestBitmapSize;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s = &aStretch->mScaledFonts[aStretch->mScaledFontsCount++];
|
|
||||||
s->mName = PR_smprintf(aStretch->mScalable, desiredSize);
|
|
||||||
if (!s->mName) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
s->mSize = desiredSize;
|
|
||||||
s->mBaselineAdjust = 0;
|
|
||||||
s->mCharSetInfo = aCharSet->mInfo;
|
|
||||||
s->LoadFont(aCharSet, m);
|
|
||||||
if (!s->mFont) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
s = *p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче