/* * File: math_draw.C * Purpose: Interaction and drawing for mathed * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx> * Created: January 1996 * Description: Math drawing and interaction for a WYSIWYG math editor. * * Dependencies: Xlib, XForms * * Copyright: (c) 1996, Alejandro Aguilar Sierra * * Version: 0.8beta, Mathed & Lyx project. * * You are free to use and modify this code under the terms of * the GNU General Public Licence version 2 or later.
*/
void
MathParInset::Metrics()
{
byte cx, cxp=0, *s; int ls; int asc=df_asc, des=0; int tb = 0, tab=0;
bool limits = false;
ascent = df_asc;//mathed_char_height(LM_TC_VAR, size, 'I', asc, des);
width = df_width;
descent = 0; if (!array) return; if (array->Empty()) return;
ascent = 0;
MathedXIter data(this);
data.GoBegin(); while (data.OK()) {
cx = data.GetChar(); if (cx >= ' ') {
s = data.GetString(ls);
mathed_string_height(data.FCode(), size, s, ls, asc, des); if (asc > ascent) ascent = asc; if (des > descent) descent = des;
limits = false;
} else if (MathIsInset(cx)) {
MathedInset *p = data.GetInset();
p->SetStyle(size);
p->Metrics(); if (cx==LM_TC_UP) {
asc += (limits) ? p->Height()+4: p->Ascent() +
((p->Descent()>asc) ? p->Descent()-asc+4: 0);
} else if (cx==LM_TC_DOWN) {
des += ((limits) ? p->Height()+4: p->Height()-p->Ascent()/2);
} else {
asc = p->Ascent();
des = p->Descent();
} if (asc > ascent) ascent = asc; if (des > descent) descent = des; if (cx!=LM_TC_UP && cx!=LM_TC_DOWN)
limits = p->GetLimits();
data.Next();
} else if (cx==LM_TC_TAB) { int x, y;
data.GetIncPos(x, y); if (data.IsFirst() || cxp==LM_TC_TAB || cxp==LM_TC_CR) { if (ascent<df_asc) ascent = df_asc;
tb = x;
}
data.setTab(x-tb, tab);
tb = x;
tab++;
limits = false;
data.Next();
} else if (cx==LM_TC_CR) { if (tb>0) { int x, y;
data.GetIncPos(x, y); if (data.IsFirst() || cxp==LM_TC_TAB || cxp==LM_TC_CR) { if (ascent<df_asc) ascent = df_asc;
tb = x;
}
data.setTab(x-tb, tab);
} else//if (GetColumns()==1)
{ int x, y;
data.GetIncPos(x, y);
data.setTab(x, tab); if (ascent<df_asc) ascent = df_asc;
}
tb=tab=0;
data.subMetrics(ascent, descent);
ascent = df_asc;
descent = 0;
data.Next();
} else {
fprintf(stderr, "Mathed Error: Unrecognized code[%d]\n", cx); break;
}
cxp = cx;
}
data.GetIncPos(width, ls);
// No matter how simple is a matrix, it is NOT a subparagraph if (isMatrix()) { if (cxp==LM_TC_TAB) { if (ascent<df_asc) ascent = df_asc;
data.setTab(0, tab);
} else {
data.setTab(width-tb, tab);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.