зеркало из https://github.com/mozilla/gecko-dev.git
[#ifdef MOZ_MATHML] Change of the character cordinate system of GetBoundingMetrics()
This commit is contained in:
Родитель
060ba9ea6a
Коммит
aecdd16b1d
|
@ -2398,7 +2398,7 @@ nsFontMetricsGTK::GetBoundingMetrics (nsFontGTK* aFont,
|
|||
{
|
||||
aBoundingMetrics.Clear();
|
||||
|
||||
if (0 < aLength) {
|
||||
if (aString && 0 < aLength) {
|
||||
XChar2b buf[512]; // XXX watch buffer length !!!
|
||||
gint len = aFont->mCharSetInfo->Convert(aFont->mCharSetInfo, aString, aLength,
|
||||
(char*) buf, sizeof(buf));
|
||||
|
@ -2408,8 +2408,6 @@ nsFontMetricsGTK::GetBoundingMetrics (nsFontGTK* aFont,
|
|||
&aBoundingMetrics.width,
|
||||
&aBoundingMetrics.ascent,
|
||||
&aBoundingMetrics.descent);
|
||||
// flip sign of descent for cross-platform compatibility
|
||||
aBoundingMetrics.descent = -aBoundingMetrics.descent;
|
||||
// get italic correction
|
||||
XFontStruct *fontInfo = (XFontStruct *) GDK_FONT_XFONT (aFont->mFont);
|
||||
unsigned long pr = 0;
|
||||
|
|
|
@ -1615,7 +1615,7 @@ nsRenderingContextGTK::GetBoundingMetrics(const char* aString,
|
|||
nsBoundingMetrics& aBoundingMetrics)
|
||||
{
|
||||
aBoundingMetrics.Clear();
|
||||
if (0 < aLength) {
|
||||
if (aString && 0 < aLength) {
|
||||
g_return_val_if_fail(aString != NULL, NS_ERROR_FAILURE);
|
||||
gdk_text_extents (mCurrentFont, aString, aLength,
|
||||
&aBoundingMetrics.leftBearing,
|
||||
|
@ -1623,8 +1623,6 @@ nsRenderingContextGTK::GetBoundingMetrics(const char* aString,
|
|||
&aBoundingMetrics.width,
|
||||
&aBoundingMetrics.ascent,
|
||||
&aBoundingMetrics.descent);
|
||||
// flip sign of descent for cross-platform compatibility
|
||||
aBoundingMetrics.descent = -aBoundingMetrics.descent;
|
||||
|
||||
aBoundingMetrics.leftBearing = NSToCoordRound(aBoundingMetrics.leftBearing * mP2T);
|
||||
aBoundingMetrics.rightBearing = NSToCoordRound(aBoundingMetrics.rightBearing * mP2T);
|
||||
|
|
|
@ -1956,7 +1956,8 @@ nsFontWinUnicode::GetBoundingMetrics(HDC aDC,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
else {
|
||||
descent = nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY);
|
||||
// flip sign of descent for cross-platform compatibility
|
||||
descent = -(nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY));
|
||||
aBoundingMetrics.leftBearing = gm.gmptGlyphOrigin.x;
|
||||
aBoundingMetrics.rightBearing = gm.gmptGlyphOrigin.x + gm.gmBlackBoxX;
|
||||
aBoundingMetrics.ascent = gm.gmptGlyphOrigin.y;
|
||||
|
@ -1972,10 +1973,11 @@ nsFontWinUnicode::GetBoundingMetrics(HDC aDC,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
else {
|
||||
descent = nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY);
|
||||
// flip sign of descent for cross-platform compatibility
|
||||
descent = -(nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY));
|
||||
if (aBoundingMetrics.ascent < gm.gmptGlyphOrigin.y)
|
||||
aBoundingMetrics.ascent = gm.gmptGlyphOrigin.y;
|
||||
if (aBoundingMetrics.descent > descent)
|
||||
if (aBoundingMetrics.descent < descent)
|
||||
aBoundingMetrics.descent = descent;
|
||||
}
|
||||
}
|
||||
|
@ -2102,7 +2104,8 @@ nsFontWinNonUnicode::GetBoundingMetrics(HDC aDC,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
else {
|
||||
descent = nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY);
|
||||
// flip sign of descent for cross-platform compatibility
|
||||
descent = -(nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY));
|
||||
aBoundingMetrics.leftBearing = gm.gmptGlyphOrigin.x;
|
||||
aBoundingMetrics.rightBearing = gm.gmptGlyphOrigin.x + gm.gmBlackBoxX;
|
||||
aBoundingMetrics.ascent = gm.gmptGlyphOrigin.y;
|
||||
|
@ -2118,10 +2121,11 @@ nsFontWinNonUnicode::GetBoundingMetrics(HDC aDC,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
else {
|
||||
descent = nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY);
|
||||
// flip sign of descent for cross-platform compatibility
|
||||
descent = -(nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY));
|
||||
if (aBoundingMetrics.ascent < gm.gmptGlyphOrigin.y)
|
||||
aBoundingMetrics.ascent = gm.gmptGlyphOrigin.y;
|
||||
if (aBoundingMetrics.descent > descent)
|
||||
if (aBoundingMetrics.descent < descent)
|
||||
aBoundingMetrics.descent = descent;
|
||||
}
|
||||
}
|
||||
|
@ -2733,7 +2737,7 @@ nsFontSubset::GetBoundingMetrics(HDC aDC,
|
|||
if (aString && 0 < aLength) {
|
||||
char str[CHAR_BUFFER_SIZE];
|
||||
char* pstr = str;
|
||||
// Get number of bytes to needed for the conversion
|
||||
// Get number of bytes needed for the conversion
|
||||
int nb;
|
||||
nb = WideCharToMultiByte(mCodePage, 0, aString, aLength,
|
||||
pstr, 0, nsnull, nsnull);
|
||||
|
@ -2766,7 +2770,8 @@ nsFontSubset::GetBoundingMetrics(HDC aDC,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
else {
|
||||
descent = nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY);
|
||||
// flip sign of descent for cross-platform compatibility
|
||||
descent = -(nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY));
|
||||
aBoundingMetrics.leftBearing = gm.gmptGlyphOrigin.x;
|
||||
aBoundingMetrics.rightBearing = gm.gmptGlyphOrigin.x + gm.gmBlackBoxX;
|
||||
aBoundingMetrics.ascent = gm.gmptGlyphOrigin.y;
|
||||
|
@ -2782,7 +2787,8 @@ nsFontSubset::GetBoundingMetrics(HDC aDC,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
else {
|
||||
descent = nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY);
|
||||
// flip sign of descent for cross-platform compatibility
|
||||
descent = -(nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY));
|
||||
if (aBoundingMetrics.ascent < gm.gmptGlyphOrigin.y)
|
||||
aBoundingMetrics.ascent = gm.gmptGlyphOrigin.y;
|
||||
if (aBoundingMetrics.descent > descent)
|
||||
|
|
|
@ -1969,7 +1969,8 @@ nsRenderingContextWin::GetBoundingMetrics(const char* aString,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
else {
|
||||
descent = nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY);
|
||||
// flip sign of descent for cross-platform compatibility
|
||||
descent = -(nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY));
|
||||
aBoundingMetrics.leftBearing = gm.gmptGlyphOrigin.x;
|
||||
aBoundingMetrics.rightBearing = gm.gmptGlyphOrigin.x + gm.gmBlackBoxX;
|
||||
aBoundingMetrics.ascent = gm.gmptGlyphOrigin.y;
|
||||
|
@ -1985,7 +1986,8 @@ nsRenderingContextWin::GetBoundingMetrics(const char* aString,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
else {
|
||||
descent = nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY);
|
||||
// flip sign of descent for cross-platform compatibility
|
||||
descent = -(nscoord(gm.gmptGlyphOrigin.y) - nscoord(gm.gmBlackBoxY));
|
||||
if (aBoundingMetrics.ascent < gm.gmptGlyphOrigin.y)
|
||||
aBoundingMetrics.ascent = gm.gmptGlyphOrigin.y;
|
||||
if (aBoundingMetrics.descent > descent)
|
||||
|
|
|
@ -2272,14 +2272,14 @@ nsFontMetricsXlib::FindFont(PRUnichar aChar)
|
|||
// bounding metrics for a string
|
||||
// remember returned values are not in app units
|
||||
nsresult
|
||||
nsFontMetricsXlib::GetBoundingMetrics (nsFontXlib* aFont,
|
||||
nsFontMetricsXlib::GetBoundingMetrics (nsFontXlib* aFont,
|
||||
const PRUnichar* aString,
|
||||
PRUint32 aLength,
|
||||
nsBoundingMetrics& aBoundingMetrics)
|
||||
{
|
||||
aBoundingMetrics.Clear();
|
||||
|
||||
if (0 < aLength) {
|
||||
if (aString && 0 < aLength) {
|
||||
XChar2b buf[512]; // XXX watch buffer length !!!
|
||||
int len = aFont->mCharSetInfo->Convert(aFont->mCharSetInfo, aString, aLength,
|
||||
(char*) buf, sizeof(buf));
|
||||
|
@ -2300,7 +2300,7 @@ nsFontMetricsXlib::GetBoundingMetrics (nsFontXlib* aFont,
|
|||
aBoundingMetrics.rightBearing = overall.rbearing;
|
||||
aBoundingMetrics.width = overall.width;
|
||||
aBoundingMetrics.ascent = overall.ascent;
|
||||
aBoundingMetrics.descent = -overall.descent;
|
||||
aBoundingMetrics.descent = overall.descent;
|
||||
|
||||
unsigned long pr = 0;
|
||||
if (::XGetFontProperty(font_struct, XA_ITALIC_ANGLE, &pr)) {
|
||||
|
|
|
@ -1425,9 +1425,7 @@ nsRenderingContextXlib::GetBoundingMetrics(const char* aString,
|
|||
nsBoundingMetrics& aBoundingMetrics)
|
||||
{
|
||||
aBoundingMetrics.Clear();
|
||||
if (0 < aLength) {
|
||||
if (!aString)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (aString && 0 < aLength) {
|
||||
|
||||
XCharStruct overall;
|
||||
int direction, font_ascent, font_descent;
|
||||
|
@ -1445,7 +1443,7 @@ nsRenderingContextXlib::GetBoundingMetrics(const char* aString,
|
|||
aBoundingMetrics.rightBearing = overall.rbearing;
|
||||
aBoundingMetrics.width = overall.width;
|
||||
aBoundingMetrics.ascent = overall.ascent;
|
||||
aBoundingMetrics.descent = -overall.descent;
|
||||
aBoundingMetrics.descent = overall.descent;
|
||||
|
||||
aBoundingMetrics.leftBearing = NSToCoordRound(aBoundingMetrics.leftBearing * mP2T);
|
||||
aBoundingMetrics.rightBearing = NSToCoordRound(aBoundingMetrics.rightBearing * mP2T);
|
||||
|
@ -1464,9 +1462,7 @@ nsRenderingContextXlib::GetBoundingMetrics(const PRUnichar* aString,
|
|||
PRInt32* aFontID)
|
||||
{
|
||||
aBoundingMetrics.Clear();
|
||||
if (0 < aLength) {
|
||||
if (!aString)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (aString && 0 < aLength) {
|
||||
|
||||
nsFontMetricsXlib* metrics = (nsFontMetricsXlib*) mFontMetrics;
|
||||
nsFontXlib* prevFont = nsnull;
|
||||
|
|
Загрузка…
Ссылка в новой задаче