Fine-tuning of the placement of the sqrt symbol and Patch of Mike Shaver to make the code compile on Linux

This commit is contained in:
rbs%maths.uq.edu.au 1999-11-18 04:51:56 +00:00
parent b60b0cf5ad
commit 398a37cb3d
3 changed files with 29 additions and 25 deletions

View File

@ -218,6 +218,7 @@ static PRUnichar gMathMLCharGlyph[] = {
//------------
//index = 66
//Section for: square-root bar
0xF8E5, // RADICAL EXTENDER # radicalex (CUS)
0x0000, // That's all folks ...
@ -228,7 +229,7 @@ static PRUnichar gMathMLCharGlyph[] = {
0xF8E5, // RADICAL EXTENDER # radicalex (CUS)
//------------
//index = 70
//index = 72
//end of table ...
0x0000,
};
@ -246,27 +247,11 @@ static PRInt32 gMathMLCharIndex[] = {
48, // eMathMLChar_UpArrow,
54, // eMathMLChar_LeftArrow,
60, // eMathMLChar_RightArrow,
66, // eMathMLChar_RadicalExtender,
66, // eMathMLChar_RadicalBar,
72, // safeguard, *must* always point at the *end* of gMathMLCharGlyph[]
};
// data to enable a clean architecture and extensibility
enum nsMathMLCharEnum {
eMathMLChar_UNKNOWN = -1,
eMathMLChar_LeftParenthesis,
eMathMLChar_RightParenthesis,
eMathMLChar_Integral ,
eMathMLChar_LeftSquareBracket,
eMathMLChar_RightSquareBracket,
eMathMLChar_LeftCurlyBracket,
eMathMLChar_RightCurlyBracket,
eMathMLChar_DownArrow,
eMathMLChar_UpArrow,
eMathMLChar_LeftArrow,
eMathMLChar_RightArrow,
eMathMLChar_RadicalExtender,
eMathMLChar_COUNT
};
static const PRInt32 kMathMLChar[] = {
eMathMLChar_LeftParenthesis , '(',
@ -280,7 +265,7 @@ static const PRInt32 kMathMLChar[] = {
eMathMLChar_UpArrow, 0x2191,
eMathMLChar_LeftArrow, 0x2190,
eMathMLChar_RightArrow, 0x2192,
eMathMLChar_RadicalExtender, 0xF8E5,
eMathMLChar_RadicalBar, 0xF8E5,
// eMathMLChar_Radical, 0x221A,
};

View File

@ -25,11 +25,28 @@
#include "nsMathMLOperators.h"
typedef PRUint32 nsStretchDirection;
enum nsMathMLCharEnum;
#define NS_STRETCH_DIRECTION_HORIZONTAL 0
#define NS_STRETCH_DIRECTION_VERTICAL 1
// chars that we know how to stretch
enum nsMathMLCharEnum {
eMathMLChar_UNKNOWN = -1,
eMathMLChar_LeftParenthesis,
eMathMLChar_RightParenthesis,
eMathMLChar_Integral ,
eMathMLChar_LeftSquareBracket,
eMathMLChar_RightSquareBracket,
eMathMLChar_LeftCurlyBracket,
eMathMLChar_RightCurlyBracket,
eMathMLChar_DownArrow,
eMathMLChar_UpArrow,
eMathMLChar_LeftArrow,
eMathMLChar_RightArrow,
eMathMLChar_RadicalBar,
eMathMLChar_COUNT
};
// Structure used for a char's size and alignment information.
struct nsCharMetrics {
// nscoord leading;

View File

@ -63,8 +63,10 @@ nsMathMLmsqrtFrame::nsMathMLmsqrtFrame() :
mSqrtChar(),
mSqrtBar()
{
mSqrtChar.SetData(nsAutoString(PRUnichar(0x221A)));
mSqrtBar.SetData(nsAutoString(PRUnichar(0xF8E5)));
nsAutoString sqr(PRUnichar(0x221A)),
bar(PRUnichar(0xF8E5));
mSqrtChar.SetData(sqr);
mSqrtBar.SetData(bar);
}
nsMathMLmsqrtFrame::~nsMathMLmsqrtFrame()
@ -215,15 +217,15 @@ nsMathMLmsqrtFrame::Reflow(nsIPresContext& aPresContext,
aDesiredSize.descent = desSize.descent;
}
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
mSqrtChar.SetRect(nsRect(0, thickspace, desSize.width, aDesiredSize.height));
nscoord dy = bmdata[0].ascent - ascent;
mSqrtChar.SetRect(nsRect(0, dy, charWidth, aDesiredSize.height));
// Stretch the overline bar to the appropriate width if it is not big enough.
contSize = nsCharMetrics(aDesiredSize);
desSize = nsCharMetrics(descent, ascent, bmdata[1].rightBearing-bmdata[1].leftBearing, ascent + descent);
mSqrtBar.Stretch(aPresContext, renderingContext, mStyleContext,
NS_STRETCH_DIRECTION_HORIZONTAL, contSize, desSize);
nscoord dy = bmdata[1].ascent - ascent;
dy = bmdata[1].ascent - ascent;
mSqrtBar.SetRect(nsRect(charBearing, dy, desSize.width, thickspace));
// Update the size of the container