本文整理汇总了C++中CellParser::CheckTeXFonts方法的典型用法代码示例。如果您正苦于以下问题:C++ CellParser::CheckTeXFonts方法的具体用法?C++ CellParser::CheckTeXFonts怎么用?C++ CellParser::CheckTeXFonts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CellParser
的用法示例。
在下文中一共展示了CellParser::CheckTeXFonts方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecalculateSize
void IntCell::RecalculateSize(CellParser& parser, int fontsize)
{
double scale = parser.GetScale();
m_under->RecalculateSizeList(parser, MAX(MC_MIN_SIZE, fontsize - 5));
m_over->RecalculateSizeList(parser, MAX(MC_MIN_SIZE, fontsize - 5));
m_base->RecalculateSizeList(parser, fontsize);
m_var->RecalculateSizeList(parser, fontsize);
if (m_intStyle == INT_DEF)
{
if (parser.CheckTeXFonts())
{
m_center = MAX(m_over->GetMaxHeight() + SCALE_PX(4, scale) + m_signSize / 2 - m_signSize / 3,
m_base->GetMaxCenter());
m_height = m_center +
MAX(m_under->GetMaxHeight() + SCALE_PX(4, scale) + m_signSize / 2 - m_signSize / 3,
m_base->GetMaxDrop());
}
else
{
m_center = MAX(m_over->GetMaxHeight() + SCALE_PX(4, scale) + m_signSize / 2 - m_signSize / 3,
m_base->GetMaxCenter());
m_height = m_center +
MAX(m_under->GetMaxHeight() + SCALE_PX(4, scale) + m_signSize / 2 - m_signSize / 3,
m_base->GetMaxDrop());
}
}
else
{
m_center = MAX(m_signSize / 2, m_base->GetMaxCenter());
m_height = m_center +
MAX(m_signSize / 2, m_base->GetMaxDrop());
}
}
示例2: RecalculateSize
void ParenCell::RecalculateSize(CellParser& parser, int fontsize, bool all)
{
double scale = parser.GetScale();
m_innerCell->RecalculateSize(parser, fontsize, true);
m_height = m_innerCell->GetMaxHeight() + SCALE_PX(2, scale);
m_center = m_innerCell->GetMaxCenter() + SCALE_PX(1, scale);
#if defined __WXMSW__
if (!parser.CheckTeXFonts())
{
wxDC& dc = parser.GetDC();
int fontsize1 = (int) ((fontsize * scale + 0.5));
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
false,
false,
false,
parser.GetFontName()));
dc.GetTextExtent(wxT("("), &m_charWidth1, &m_charHeight1);
}
#endif
m_open->RecalculateSize(parser, fontsize, false);
m_close->RecalculateSize(parser, fontsize, false);
MathCell::RecalculateSize(parser, fontsize, all);
}
示例3: RecalculateWidths
void SqrtCell::RecalculateWidths(int fontsize)
{
CellParser *parser = CellParser::Get();
double scale = parser->GetScale();
m_innerCell->RecalculateWidthsList(fontsize);
if (parser->CheckTeXFonts())
{
wxDC& dc = parser->GetDC();
double scale = parser->GetScale();
m_innerCell->RecalculateSizeList(fontsize);
m_signFontScale = 1.0;
int fontsize1 = (int)(SIGN_FONT_SCALE*scale*fontsize*m_signFontScale + 0.5);
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, parser->GetTeXCMEX()));
dc.GetTextExtent(wxT("s"), &m_signWidth, &m_signSize);
m_signTop = m_signSize / 5;
m_width = m_innerCell->GetFullWidth(scale) + m_signWidth;
int size = m_innerCell->GetMaxHeight();
if (size <= (m_signSize) / 5) {
m_signType = 1;
m_signFontScale = (5.0 * size) / (1.5 * m_signSize);
}
else if (size <= (2*m_signSize) / 5) {
m_signType = 2;
m_signFontScale = (5.0 * size) / (2.2 * m_signSize);
}
else if (size <= (3*m_signSize) / 5) {
m_signType = 3;
m_signFontScale = (5.0 * size) / (3.0 * m_signSize);
}
else if (size <= (4*m_signSize) / 5 ) {
m_signType = 4;
m_signFontScale = (5.0 * size) / (3.8 * m_signSize);
}
else {
m_signType = 5;
m_signFontScale = 1.0;
}
fontsize1 = (int)(SIGN_FONT_SCALE*scale*fontsize*m_signFontScale + 0.5);
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, parser->GetTeXCMEX()));
dc.GetTextExtent(wxT("s"), &m_signWidth, &m_signSize);
m_signTop = m_signSize / 5;
m_width = m_innerCell->GetFullWidth(scale) + m_signWidth;
}
else
m_width = m_innerCell->GetFullWidth(scale) + SCALE_PX(10, scale) +
3 * SCALE_PX(1, scale) + 1;
m_open->RecalculateWidthsList(fontsize);
m_close->RecalculateWidthsList(fontsize);
ResetData();
}
示例4: RecalculateWidths
void SqrtCell::RecalculateWidths(CellParser& parser, int fontsize, bool all)
{
double scale = parser.GetScale();
m_innerCell->RecalculateWidths(parser, fontsize, true);
if (parser.CheckTeXFonts())
{
wxDC& dc = parser.GetDC();
double scale = parser.GetScale();
m_innerCell->RecalculateSize(parser, fontsize, true);
m_signFontScale = 1.0;
int fontsize1 = (int)(SIGN_FONT_SCALE*scale*fontsize*m_signFontScale + 0.5);
dc.SetFont(wxFont(fontsize1, wxMODERN, false, false, false, parser.GetTeXCMEX()));
dc.GetTextExtent(wxT("s"), &m_signWidth, &m_signSize);
m_signTop = m_signSize / 5;
m_width = m_innerCell->GetFullWidth(scale) + m_signWidth;
int size = m_innerCell->GetMaxHeight();
if (size <= (m_signSize) / 5) {
m_signType = 1;
m_signFontScale = (5.0 * size) / (1.5 * m_signSize);
}
else if (size <= (2*m_signSize) / 5) {
m_signType = 2;
m_signFontScale = (5.0 * size) / (2.2 * m_signSize);
}
else if (size <= (3*m_signSize) / 5) {
m_signType = 3;
m_signFontScale = (5.0 * size) / (3.0 * m_signSize);
}
else if (size <= (4*m_signSize) / 5 ) {
m_signType = 4;
m_signFontScale = (5.0 * size) / (3.8 * m_signSize);
}
else {
m_signType = 5;
m_signFontScale = 1.0;
}
fontsize1 = (int)(SIGN_FONT_SCALE*scale*fontsize*m_signFontScale + 0.5);
dc.SetFont(wxFont(fontsize1, wxMODERN, false, false, false, parser.GetTeXCMEX()));
dc.GetTextExtent(wxT("s"), &m_signWidth, &m_signSize);
m_signTop = m_signSize / 5;
m_width = m_innerCell->GetFullWidth(scale) + m_signWidth;
}
else
m_width = m_innerCell->GetFullWidth(scale) + SCALE_PX(10, scale) +
3 * SCALE_PX(1, scale) + 1;
m_open->RecalculateWidths(parser, fontsize, all);
m_close->RecalculateWidths(parser, fontsize, all);
MathCell::RecalculateWidths(parser, fontsize, all);
}
示例5: Draw
void SqrtCell::Draw(CellParser& parser, wxPoint point, int fontsize, bool all)
{
if (DrawThisCell(parser, point))
{
wxDC& dc = parser.GetDC();
double scale = parser.GetScale();
wxPoint in(point);
if (parser.CheckTeXFonts())
{
SetPen(parser);
in.x += m_signWidth;
double scale = parser.GetScale();
int fontsize1 = (int)(SIGN_FONT_SCALE*scale*fontsize*m_signFontScale + 0.5);
dc.SetFont(wxFont(fontsize1, wxMODERN, false, false, false, parser.GetTeXCMEX()));
SetForeground(parser);
if (m_signType < 4) {
dc.DrawText(
m_signType == 1 ? wxT("p") :
m_signType == 2 ? wxT("q") :
m_signType == 3 ? wxT("r") : wxT("s"),
point.x,
point.y - m_innerCell->GetMaxCenter() - m_signTop);
}
else {
int yBottom = point.y + m_innerCell->GetMaxDrop() - 3.2*m_signTop;
int yTop = point.y - m_innerCell->GetMaxCenter() - m_signTop;
int dy = m_signSize / 10;
dc.DrawText(wxT("t"),
point.x,
yBottom);
dc.DrawText(wxT("v"),
point.x,
yTop);
while (yTop < yBottom) {
yTop += dy;
dc.DrawText(wxT("u"),
point.x,
yTop);
}
}
dc.DrawLine(point.x + m_signWidth,
point.y - m_innerCell->GetMaxCenter(),
point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
point.y - m_innerCell->GetMaxCenter());
UnsetPen(parser);
}
else
{
in.x += SCALE_PX(10, scale) + SCALE_PX(1, scale) + 1;
SetPen(parser);
dc.DrawLine(point.x,
point.y,
point.x + SCALE_PX(3, scale),
point.y - SCALE_PX(1, scale));
dc.DrawLine(point.x + SCALE_PX(3, scale),
point.y - SCALE_PX(1, scale),
point.x + SCALE_PX(7, scale),
point.y + m_height - m_center - SCALE_PX(4, scale));
dc.DrawLine(point.x + SCALE_PX(3, scale) + 1,
point.y - SCALE_PX(1, scale),
point.x + SCALE_PX(7, scale) + 1,
point.y + m_height - m_center - SCALE_PX(4, scale));
dc.DrawLine(point.x + SCALE_PX(7, scale) + 1,
point.y + m_height - m_center - SCALE_PX(4, scale),
point.x + SCALE_PX(10, scale),
point.y - m_center + SCALE_PX(2, scale));
dc.DrawLine(point.x + SCALE_PX(10, scale),
point.y - m_center + SCALE_PX(2, scale),
point.x + m_width - SCALE_PX(1, scale),
point.y - m_center + SCALE_PX(2, scale));
dc.DrawLine(point.x + m_width - SCALE_PX(1, scale),
point.y - m_center + SCALE_PX(2, scale),
point.x + m_width - SCALE_PX(1, scale),
point.y - m_center + SCALE_PX(6, scale));
UnsetPen(parser);
}
m_innerCell->Draw(parser, in, fontsize, true);
}
MathCell::Draw(parser, point, fontsize, all);
}
示例6: Draw
void ParenCell::Draw(CellParser& parser, wxPoint point, int fontsize)
{
if (DrawThisCell(parser, point))
{
double scale = parser.GetScale();
wxDC& dc = parser.GetDC();
wxPoint in(point);
if (parser.CheckTeXFonts())
{
in.x = point.x + m_signWidth;
SetForeground(parser);
int fontsize1 = (int) ((m_parenFontSize * scale + 0.5));
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
m_bigParenType < 1 ?
parser.GetTeXCMRI() :
parser.GetTeXCMEX()));
if (m_bigParenType < 2)
{
dc.DrawText(m_bigParenType == 0 ? wxT("(") :
wxT(PAREN_OPEN),
point.x,
point.y - m_center + SCALE_PX(MC_TEXT_PADDING, scale) -
(m_bigParenType > 0 ? m_signTop : 0));
dc.DrawText(m_bigParenType == 0 ? wxT(")") :
wxT(PAREN_CLOSE),
point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
point.y - m_center + SCALE_PX(MC_TEXT_PADDING, scale) -
(m_bigParenType > 0 ? m_signTop : 0));
}
else {
int top = point.y - m_center - m_signTop;
int bottom = point.y + m_height - m_center - m_signTop - m_signSize / 2;
dc.DrawText(wxT(PAREN_OPEN_TOP),
point.x,
top);
dc.DrawText(wxT(PAREN_CLOSE_TOP),
point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
top);
dc.DrawText(wxT(PAREN_OPEN_BOTTOM),
point.x,
bottom);
dc.DrawText(wxT(PAREN_CLOSE_BOTTOM),
point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
bottom);
top = top + m_signSize / 2;
if (top <= bottom)
{
while (top < bottom)
{
dc.DrawText(wxT(PAREN_OPEN_EXTEND),
point.x,
top-1);
dc.DrawText(wxT(PAREN_CLOSE_EXTEND),
point.x + m_width - m_signWidth,
top-1);
top += m_signSize / 10;
}
}
}
}
else
{
#if defined __WXMSW__
in.x += m_charWidth;
int fontsize1 = (int) ((PAREN_FONT_SIZE * scale + 0.5));
SetForeground(parser);
if (m_height < (3*m_charHeight)/2)
{
fontsize1 = (int) ((fontsize * scale + 0.5));
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false,
parser.GetFontName()));
dc.DrawText(wxT("("),
point.x + m_charWidth - m_charWidth1,
point.y - m_charHeight1 / 2);
dc.DrawText(wxT(")"),
point.x + m_width - m_charWidth,
point.y - m_charHeight1 / 2);
}
else
{
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false,
parser.GetSymbolFontName(),
wxFONTENCODING_CP1250));
dc.DrawText(PAREN_LEFT_TOP,
point.x,
point.y - m_center);
dc.DrawText(PAREN_LEFT_BOTTOM,
point.x,
point.y + m_height - m_center - m_charHeight);
dc.DrawText(PAREN_RIGHT_TOP,
point.x + m_width - m_charWidth,
point.y - m_center);
dc.DrawText(PAREN_RIGHT_BOTTOM,
point.x + m_width - m_charWidth,
//.........这里部分代码省略.........
示例7: RecalculateWidths
void ParenCell::RecalculateWidths(CellParser& parser, int fontsize)
{
double scale = parser.GetScale();
if (m_innerCell == NULL)
m_innerCell = new TextCell;
m_innerCell->RecalculateWidthsList(parser, fontsize);
if (parser.CheckTeXFonts())
{
wxDC& dc = parser.GetDC();
m_innerCell->RecalculateSizeList(parser, fontsize);
int size = m_innerCell->GetMaxHeight();
int fontsize1 = (int) ((fontsize * scale + 0.5));
if (size < 2*fontsize1)
m_bigParenType = 0;
else if (size < 4*fontsize1)
m_bigParenType = 1;
else
m_bigParenType = 2;
if (m_bigParenType < 2)
{
m_parenFontSize = fontsize;
fontsize1 = (int) ((m_parenFontSize * scale + 0.5));
dc.SetFont( wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
m_bigParenType == 0 ?
parser.GetTeXCMRI() :
parser.GetTeXCMEX()));
dc.GetTextExtent(m_bigParenType == 0 ? wxT("(") :
m_bigParenType == 1 ? wxT(PAREN_OPEN) :
wxT(PAREN_OPEN_TOP),
&m_signWidth, &m_signSize);
/// BUG 2897415: Exporting equations to HTML locks up on Mac
/// there is something wrong with what dc.GetTextExtent returns,
/// make sure there is no infinite loop!
int i=0;
// Avoid a possible infinite loop.
if(size < 2) size = 2;
while (m_signSize < TRANSFORM_SIZE(m_bigParenType, size) && i<20)
{
int fontsize1 = (int) ((m_parenFontSize++ * scale + 0.5));
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
m_bigParenType == 0 ?
parser.GetTeXCMRI() :
parser.GetTeXCMEX()));
dc.GetTextExtent(m_bigParenType == 0 ? wxT("(") :
m_bigParenType == 1 ? wxT(PAREN_OPEN) :
wxT(PAREN_OPEN_TOP),
&m_signWidth, &m_signSize);
// Avoid an infinite loop.
if(m_signSize < 2) m_signSize = 2;
i++;
}
}
else
{
m_parenFontSize = fontsize;
fontsize1 = (int) ((m_parenFontSize * scale + 0.5));
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
m_bigParenType < 1 ?
parser.GetTeXCMRI() :
parser.GetTeXCMEX()));
dc.GetTextExtent(wxT(PAREN_OPEN), &m_signWidth, &m_signSize);
}
m_signTop = m_signSize / 5;
m_width = m_innerCell->GetFullWidth(scale) + 2*m_signWidth;
}
else
{
#if defined __WXMSW__
wxDC& dc = parser.GetDC();
int fontsize1 = (int) ((PAREN_FONT_SIZE * scale + 0.5));
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
parser.IsItalic(TS_DEFAULT),
parser.IsBold(TS_DEFAULT),
parser.IsUnderlined(TS_DEFAULT),
parser.GetSymbolFontName()));
dc.GetTextExtent(PAREN_LEFT_TOP, &m_charWidth, &m_charHeight);
if(m_charHeight < 2)
m_charHeight = 2;
m_width = m_innerCell->GetFullWidth(scale) + 2*m_charWidth;
#else
m_width = m_innerCell->GetFullWidth(scale) + SCALE_PX(12, parser.GetScale());
#endif
}
m_open->RecalculateWidthsList(parser, fontsize);
m_close->RecalculateWidthsList(parser, fontsize);
ResetData();
}
示例8: Draw
void SqrtCell::Draw(wxPoint point, int fontsize)
{
MathCell::Draw(point, fontsize);
CellParser *parser = CellParser::Get();
if (DrawThisCell(point) && InUpdateRegion())
{
wxDC& dc = parser->GetDC();
double scale = parser->GetScale();
wxPoint in(point);
if (parser->CheckTeXFonts())
{
SetPen();
in.x += m_signWidth;
double scale = parser->GetScale();
int fontsize1 = (int)(SIGN_FONT_SCALE*scale*fontsize*m_signFontScale + 0.5);
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, parser->GetTeXCMEX()));
SetForeground();
if (m_signType < 4) {
dc.DrawText(
m_signType == 1 ? wxT("p") :
m_signType == 2 ? wxT("q") :
m_signType == 3 ? wxT("r") : wxT("s"),
point.x,
point.y - m_innerCell->GetMaxCenter() - m_signTop);
}
else {
int yBottom = point.y + m_innerCell->GetMaxDrop() - 3.2*m_signTop;
int yTop = point.y - m_innerCell->GetMaxCenter() - m_signTop;
int dy = m_signSize / 10;
wxASSERT_MSG((yTop != 0) || (yBottom != 0),_("Font issue? The contents of a sqrt() has the size 0."));
wxASSERT_MSG(dy>0,_("Font issue: The sqrt() sign has the size 0! Installing http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html and checking \"Use JSmath fonts\" in the configuration dialogue should be a workaround."));
if(dy <= 0)
dy = 1;
dc.DrawText(wxT("t"),
point.x,
yBottom);
dc.DrawText(wxT("v"),
point.x,
yTop);
while (yTop < yBottom) {
yTop += dy;
dc.DrawText(wxT("u"),
point.x,
yTop);
}
}
dc.DrawLine(point.x + m_signWidth,
point.y - m_innerCell->GetMaxCenter(),
point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
point.y - m_innerCell->GetMaxCenter());
UnsetPen();
}
else
{
in.x += SCALE_PX(10, scale) + SCALE_PX(1, scale) + 1;
SetPen();
dc.DrawLine(point.x,
point.y,
point.x + SCALE_PX(3, scale),
point.y - SCALE_PX(1, scale));
dc.DrawLine(point.x + SCALE_PX(3, scale),
point.y - SCALE_PX(1, scale),
point.x + SCALE_PX(7, scale),
point.y + m_height - m_center - SCALE_PX(4, scale));
dc.DrawLine(point.x + SCALE_PX(3, scale) + 1,
point.y - SCALE_PX(1, scale),
point.x + SCALE_PX(7, scale) + 1,
point.y + m_height - m_center - SCALE_PX(4, scale));
dc.DrawLine(point.x + SCALE_PX(7, scale) + 1,
point.y + m_height - m_center - SCALE_PX(4, scale),
point.x + SCALE_PX(10, scale),
point.y - m_center + SCALE_PX(2, scale));
dc.DrawLine(point.x + SCALE_PX(10, scale),
point.y - m_center + SCALE_PX(2, scale),
point.x + m_width - SCALE_PX(1, scale),
point.y - m_center + SCALE_PX(2, scale));
dc.DrawLine(point.x + m_width - SCALE_PX(1, scale),
point.y - m_center + SCALE_PX(2, scale),
point.x + m_width - SCALE_PX(1, scale),
point.y - m_center + SCALE_PX(6, scale));
UnsetPen();
}
m_innerCell->DrawList(in, fontsize);
}
}
示例9: Draw
void IntCell::Draw(CellParser& parser, wxPoint point, int fontsize, bool all)
{
if (DrawThisCell(parser, point))
{
wxDC& dc = parser.GetDC();
double scale = parser.GetScale();
wxPoint base(point), under(point), over(point), var(point), sign(point);
if (parser.CheckTeXFonts())
{
SetForeground(parser);
int fontsize1 = (int) ((fontsize * scale * 1.5 + 0.5));
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
false, false, false,
parser.GetTeXCMEX()));
dc.DrawText(wxT("\x5A"),
sign.x,
sign.y - m_signTop);
}
else
{
#if defined __WXMSW__
SetForeground(parser);
int fontsize1 = (int) ((INTEGRAL_FONT_SIZE * scale + 0.5));
int m_signWCenter = m_signWidth / 2;
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
false, false, false,
parser.GetSymbolFontName()));
dc.DrawText(wxT(INTEGRAL_TOP),
sign.x + m_signWCenter - m_charWidth / 2,
sign.y - (m_signSize + 1) / 2);
dc.DrawText(wxT(INTEGRAL_BOTTOM),
sign.x + m_signWCenter - m_charWidth / 2,
sign.y + (m_signSize + 1) / 2 - m_charHeight);
int top, bottom;
top = sign.y - (m_signSize + 1) / 2 + m_charHeight / 2;
bottom = sign.y + (m_signSize + 1) / 2 - (3 * m_charHeight) / 2;
if (top <= bottom)
{
while (top < bottom)
{
dc.DrawText(wxT(INTEGRAL_EXTEND),
point.x + m_signWCenter - m_charWidth / 2,
top);
top += (2*m_charHeight)/3;
}
dc.DrawText(wxT(INTEGRAL_EXTEND),
point.x + m_signWCenter - m_charWidth / 2,
sign.y + (m_signSize + 1) / 2 - (3 * m_charHeight) / 2);
}
#else
SetPen(parser);
// top decoration
int m_signWCenter = m_signWidth / 2;
dc.DrawLine(sign.x + m_signWCenter,
sign.y - (m_signSize + 1) / 2 + SCALE_PX(12, scale) - 1,
sign.x + m_signWCenter + SCALE_PX(3, scale),
sign.y - (m_signSize + 1) / 2 + SCALE_PX(3, scale));
dc.DrawLine(sign.x + m_signWCenter + SCALE_PX(3, scale),
sign.y - (m_signSize + 1) / 2 + SCALE_PX(3, scale),
sign.x + m_signWCenter + SCALE_PX(6, scale),
sign.y - (m_signSize + 1) / 2);
dc.DrawLine(sign.x + m_signWCenter + SCALE_PX(6, scale),
sign.y - (m_signSize + 1) / 2,
sign.x + m_signWCenter + SCALE_PX(9, scale),
sign.y - (m_signSize + 1) / 2 + SCALE_PX(3, scale));
// bottom decoration
dc.DrawLine(sign.x + m_signWCenter,
sign.y + (m_signSize + 1) / 2 - SCALE_PX(12, scale) + 1,
sign.x + m_signWCenter - SCALE_PX(3, scale),
sign.y + (m_signSize + 1) / 2 - SCALE_PX(3, scale));
dc.DrawLine(sign.x + m_signWCenter - SCALE_PX(3, scale),
sign.y + (m_signSize + 1) / 2 - SCALE_PX(3, scale),
sign.x + m_signWCenter - SCALE_PX(6, scale),
sign.y + (m_signSize + 1) / 2);
dc.DrawLine(sign.x + m_signWCenter - SCALE_PX(6, scale),
sign.y + (m_signSize + 1) / 2,
sign.x + m_signWCenter - SCALE_PX(9, scale),
sign.y + (m_signSize + 1) / 2 - SCALE_PX(3, scale));
// line
dc.DrawLine(sign.x + m_signWCenter,
sign.y - (m_signSize + 1) / 2 + SCALE_PX(12, scale) - 1,
sign.x + m_signWCenter,
sign.y + (m_signSize + 1) / 2 - SCALE_PX(12, scale) + 1);
UnsetPen(parser);
#endif
}
if (m_intStyle == INT_DEF)
{
under.x += m_signWidth;
under.y = point.y + m_signSize / 2 + m_under->GetMaxCenter() + SCALE_PX(2, scale) -
m_signSize / 3;
m_under->Draw(parser, under, MAX(MC_MIN_SIZE, fontsize - 5), true);
if (parser.CheckTeXFonts())
over.x += 2*m_signWidth;
//.........这里部分代码省略.........
示例10: RecalculateWidths
void IntCell::RecalculateWidths(CellParser& parser, int fontsize, bool all)
{
double scale = parser.GetScale();
m_signSize = SCALE_PX(50, scale);
m_signWidth = SCALE_PX(18, scale);
m_base->RecalculateWidths(parser, fontsize, true);
m_var->RecalculateWidths(parser, fontsize, true);
if (m_under == NULL)
m_under = new TextCell;
m_under->RecalculateWidths(parser, MAX(MC_MIN_SIZE, fontsize - 5), true);
if (m_over == NULL)
m_over = new TextCell;
m_over->RecalculateWidths(parser, MAX(MC_MIN_SIZE, fontsize - 5), true);
if (parser.CheckTeXFonts()) {
wxDC& dc = parser.GetDC();
int fontsize1 = (int) ((fontsize * scale * 1.5 + 0.5));
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
false, false, false,
parser.GetTeXCMEX()));
dc.GetTextExtent(wxT("\x5A"), &m_signWidth, &m_signSize);
#if defined __WXMSW__
m_signWidth = m_signWidth / 2;
#endif
m_signTop = m_signSize / 2;
m_signSize = (85 * m_signSize) / 100;
m_width = m_signWidth +
MAX(m_over->GetFullWidth(scale) + m_signWidth, m_under->GetFullWidth(scale)) +
m_base->GetFullWidth(scale) +
m_var->GetFullWidth(scale) +
SCALE_PX(4, scale);
}
else {
#if defined __WXMSW__
wxDC& dc = parser.GetDC();
int fontsize1 = (int) ((INTEGRAL_FONT_SIZE * scale + 0.5));
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
false, false, false,
parser.GetSymbolFontName()));
dc.GetTextExtent(wxT(INTEGRAL_TOP), &m_charWidth, &m_charHeight);
m_width = m_signWidth +
m_base->GetFullWidth(scale) +
MAX(m_over->GetFullWidth(scale), m_under->GetFullWidth(scale)) +
m_var->GetFullWidth(scale) +
SCALE_PX(4, scale);
#else
m_width = m_signWidth +
m_base->GetFullWidth(scale) +
MAX(m_over->GetFullWidth(scale), m_under->GetFullWidth(scale)) +
m_var->GetFullWidth(scale) +
SCALE_PX(4, scale);
#endif
}
MathCell::RecalculateWidths(parser, fontsize, all);
}
示例11: Draw
void ParenCell::Draw(CellParser& parser, wxPoint point, int fontsize)
{
if (DrawThisCell(parser, point))
{
double scale = parser.GetScale();
wxDC& dc = parser.GetDC();
wxPoint in(point);
if (parser.CheckTeXFonts())
{
in.x = point.x + m_signWidth;
SetForeground(parser);
int fontsize1 = (int) ((m_parenFontSize * scale + 0.5));
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
m_bigParenType < 1 ?
parser.GetTeXCMRI() :
parser.GetTeXCMEX()));
if (m_bigParenType < 2)
{
dc.DrawText(m_bigParenType == 0 ? wxT("(") :
wxT(PAREN_OPEN),
point.x,
point.y - m_center + SCALE_PX(MC_TEXT_PADDING, scale) -
(m_bigParenType > 0 ? m_signTop : 0));
dc.DrawText(m_bigParenType == 0 ? wxT(")") :
wxT(PAREN_CLOSE),
point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
point.y - m_center + SCALE_PX(MC_TEXT_PADDING, scale) -
(m_bigParenType > 0 ? m_signTop : 0));
}
else {
int top = point.y - m_center - m_signTop;
int bottom = point.y + m_height - m_center - m_signTop - m_signSize / 2;
dc.DrawText(wxT(PAREN_OPEN_TOP),
point.x,
top);
dc.DrawText(wxT(PAREN_CLOSE_TOP),
point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
top);
dc.DrawText(wxT(PAREN_OPEN_BOTTOM),
point.x,
bottom);
dc.DrawText(wxT(PAREN_CLOSE_BOTTOM),
point.x + m_signWidth + m_innerCell->GetFullWidth(scale),
bottom);
top = top + m_signSize / 2;
wxASSERT_MSG(m_signSize>=10,_("Font issue: The Parenthesis sign is too small!"));
if(m_signSize <= 10)
m_signSize = 10;
if (top <= bottom)
{
while (top < bottom)
{
dc.DrawText(wxT(PAREN_OPEN_EXTEND),
point.x,
top-1);
dc.DrawText(wxT(PAREN_CLOSE_EXTEND),
point.x + m_width - m_signWidth,
top-1);
top += m_signSize / 10;
}
}
}
}
else
{
#if defined __WXMSW__
in.x += m_charWidth;
int fontsize1 = (int) ((PAREN_FONT_SIZE * scale + 0.5));
SetForeground(parser);
if (m_height < (3*m_charHeight)/2)
{
fontsize1 = (int) ((fontsize * scale + 0.5));
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false,
parser.GetFontName()));
dc.DrawText(wxT("("),
point.x + m_charWidth - m_charWidth1,
point.y - m_charHeight1 / 2);
dc.DrawText(wxT(")"),
point.x + m_width - m_charWidth,
point.y - m_charHeight1 / 2);
}
else
{
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false,
parser.GetSymbolFontName(),
wxFONTENCODING_CP1250));
dc.DrawText(PAREN_LEFT_TOP,
point.x,
point.y - m_center);
dc.DrawText(PAREN_LEFT_BOTTOM,
point.x,
point.y + m_height - m_center - m_charHeight);
//.........这里部分代码省略.........
示例12: Draw
void IntCell::Draw(wxPoint point, int fontsize)
{
MathCell::Draw(point, fontsize);
CellParser *parser = CellParser::Get();
if (DrawThisCell(point) && InUpdateRegion())
{
wxDC& dc = parser->GetDC();
double scale = parser->GetScale();
wxPoint base(point), under(point), over(point), var(point), sign(point);
if (parser->CheckTeXFonts())
{
SetForeground();
int fontsize1 = (int) ((fontsize * scale * 1.5 + 0.5));
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
parser->GetTeXCMEX()));
dc.DrawText(wxT("\x5A"),
sign.x,
sign.y - m_signTop);
}
else
{
#if defined __WXMSW__
SetForeground();
int fontsize1 = (int) ((INTEGRAL_FONT_SIZE * scale + 0.5));
int m_signWCenter = m_signWidth / 2;
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false,
parser->GetSymbolFontName()));
dc.DrawText(INTEGRAL_TOP,
sign.x + m_signWCenter - m_charWidth / 2,
sign.y - (m_signSize + 1) / 2);
dc.DrawText(INTEGRAL_BOTTOM,
sign.x + m_signWCenter - m_charWidth / 2,
sign.y + (m_signSize + 1) / 2 - m_charHeight);
int top, bottom;
top = sign.y - (m_signSize + 1) / 2 + m_charHeight / 2;
bottom = sign.y + (m_signSize + 1) / 2 - (3 * m_charHeight) / 2;
if (top <= bottom)
{
wxASSERT_MSG(m_charHeight>=2,_("Font issue: The char height is too small! Installing http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html and checking \"Use JSmath fonts\" in the configuration dialogue should be a workaround."));
if(m_charHeight <= 2)
m_charHeight = 2;
while (top < bottom)
{
dc.DrawText(INTEGRAL_EXTEND,
point.x + m_signWCenter - m_charWidth / 2,
top);
top += (2*m_charHeight)/3;
}
dc.DrawText(INTEGRAL_EXTEND,
point.x + m_signWCenter - m_charWidth / 2,
sign.y + (m_signSize + 1) / 2 - (3 * m_charHeight) / 2);
}
#else
SetPen();
// top decoration
int m_signWCenter = m_signWidth / 2;
dc.DrawLine(sign.x + m_signWCenter,
sign.y - (m_signSize + 1) / 2 + SCALE_PX(12, scale) - 1,
sign.x + m_signWCenter + SCALE_PX(3, scale),
sign.y - (m_signSize + 1) / 2 + SCALE_PX(3, scale));
dc.DrawLine(sign.x + m_signWCenter + SCALE_PX(3, scale),
sign.y - (m_signSize + 1) / 2 + SCALE_PX(3, scale),
sign.x + m_signWCenter + SCALE_PX(6, scale),
sign.y - (m_signSize + 1) / 2);
dc.DrawLine(sign.x + m_signWCenter + SCALE_PX(6, scale),
sign.y - (m_signSize + 1) / 2,
sign.x + m_signWCenter + SCALE_PX(9, scale),
sign.y - (m_signSize + 1) / 2 + SCALE_PX(3, scale));
// bottom decoration
dc.DrawLine(sign.x + m_signWCenter,
sign.y + (m_signSize + 1) / 2 - SCALE_PX(12, scale) + 1,
sign.x + m_signWCenter - SCALE_PX(3, scale),
sign.y + (m_signSize + 1) / 2 - SCALE_PX(3, scale));
dc.DrawLine(sign.x + m_signWCenter - SCALE_PX(3, scale),
sign.y + (m_signSize + 1) / 2 - SCALE_PX(3, scale),
sign.x + m_signWCenter - SCALE_PX(6, scale),
sign.y + (m_signSize + 1) / 2);
dc.DrawLine(sign.x + m_signWCenter - SCALE_PX(6, scale),
sign.y + (m_signSize + 1) / 2,
sign.x + m_signWCenter - SCALE_PX(9, scale),
sign.y + (m_signSize + 1) / 2 - SCALE_PX(3, scale));
// line
dc.DrawLine(sign.x + m_signWCenter,
sign.y - (m_signSize + 1) / 2 + SCALE_PX(12, scale) - 1,
sign.x + m_signWCenter,
sign.y + (m_signSize + 1) / 2 - SCALE_PX(12, scale) + 1);
UnsetPen();
#endif
}
if (m_intStyle == INT_DEF)
//.........这里部分代码省略.........
示例13: RecalculateWidths
void IntCell::RecalculateWidths(int fontsize)
{
CellParser *parser = CellParser::Get();
double scale = parser->GetScale();
m_signSize = SCALE_PX(50, scale);
m_signWidth = SCALE_PX(18, scale);
m_base->RecalculateWidthsList(fontsize);
m_var->RecalculateWidthsList(fontsize);
if (m_under == NULL)
m_under = new TextCell;
m_under->RecalculateWidthsList(MAX(MC_MIN_SIZE, fontsize - 5));
if (m_over == NULL)
m_over = new TextCell;
m_over->RecalculateWidthsList(MAX(MC_MIN_SIZE, fontsize - 5));
if (parser->CheckTeXFonts()) {
wxDC& dc = parser->GetDC();
int fontsize1 = (int) ((fontsize * scale * 1.5 + 0.5));
dc.SetFont( wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
parser->GetTeXCMEX()));
dc.GetTextExtent(wxT("\x5A"), &m_signWidth, &m_signSize);
#if defined __WXMSW__
m_signWidth = m_signWidth / 2;
#endif
m_signTop = m_signSize / 2;
m_signSize = (85 * m_signSize) / 100;
m_width = m_signWidth +
MAX(m_over->GetFullWidth(scale) + m_signWidth, m_under->GetFullWidth(scale)) +
m_base->GetFullWidth(scale) +
m_var->GetFullWidth(scale) +
SCALE_PX(4, scale);
}
else {
#if defined __WXMSW__
wxDC& dc = parser->GetDC();
int fontsize1 = (int) ((INTEGRAL_FONT_SIZE * scale + 0.5));
dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false,
parser->GetSymbolFontName()));
dc.GetTextExtent(INTEGRAL_TOP, &m_charWidth, &m_charHeight);
m_width = m_signWidth +
m_base->GetFullWidth(scale) +
MAX(m_over->GetFullWidth(scale), m_under->GetFullWidth(scale)) +
m_var->GetFullWidth(scale) +
SCALE_PX(4, scale);
#else
m_width = m_signWidth +
m_base->GetFullWidth(scale) +
MAX(m_over->GetFullWidth(scale), m_under->GetFullWidth(scale)) +
m_var->GetFullWidth(scale) +
SCALE_PX(4, scale);
#endif
}
ResetData();
}