-#else
-void InsetLatexAccent::Draw(LyXFont font,
- LyXScreen & scr,
- int baseline,
- float & x)
-{
- if (lyxrc->font_norm == "iso8859-9")
- if (DisplayISO8859_9 (font, scr, baseline, x))
- return;
-
- /* draw it! */
- // All the manually drawn accents in this function could use an
- // overhaul. Different ways of drawing (what metrics to use)
- // should also be considered.
-
- if (candisp) {
- int asc = Ascent(font);
- int desc = Descent(font);
- int wid = Width(font);
- float x2 = x + (Rbearing(font) - Lbearing(font)) / 2.0;
- float hg;
- int y;
- if (plusasc) {
- // mark at the top
- hg = font.maxDescent();
- y = baseline - asc;
-
- if (font.shape() == LyXFont::ITALIC_SHAPE)
- x2 += (4.0 * hg) / 5.0; // italic
- } else {
- // at the bottom
- hg = desc;
- y = baseline;
- }
-
- float hg35 = float(hg * 3.0) / 5.0;
-
- // display with proper accent mark
- // first the letter
- scr.drawText(font, &ic, 1, baseline, int(x));
-
- GC pgc = GetAccentGC(font, int((hg + 3.0) / 5.0));
-
- if (remdot) {
- int tmpvar = baseline - font.ascent('i');
- float tmpx = 0;
- if (font.shape() == LyXFont::ITALIC_SHAPE)
- tmpx += (8.0 * hg) / 10.0; // italic
- lyxerr[Debug::KEY] << "Removing dot." << endl;
- // remove the dot first
- scr.fillRectangle(gc_clear, int(x + tmpx),
- tmpvar, wid,
- font.ascent('i') -
- font.ascent('x') - 1);
- // the five lines below is a simple hack to
- // make the display of accent 'i' and 'j'
- // better. It makes the accent be written
- // closer to the top of the dot-less 'i' or 'j'.
- char tmpic = ic; // store the ic when we
- ic = 'x'; // calculates the ascent of
- asc = Ascent(font); // the dot-less version (here: 'x')
- ic = tmpic; // set the orig ic back
- y = baseline - asc; // update to new y coord.
- }
- // now the rest - draw within (x, y, x+wid, y+hg)
- switch (modtype) {
- case ACUTE: // acute
- {
- scr.drawLine(pgc, int(x2), int(y + hg),
- int(x2 + hg35), y + hg35);
- break;
- }
- case GRAVE: // grave
- {
- scr.drawLine(pgc, int(x2), int(y + hg),
- int(x2 - hg35), y + hg35);
- break;
- }
- case MACRON: // macron
- {
- scr.drawLine(pgc,
- int(x2 - wid * 0.4),
- int(y + hg),
- int(x2 + wid * 0.4),
- int(y + hg));
- break;
- }
- case TILDE: // tilde
- {
- if (hg35 > 2.0) hg35 -= 1.0;
- x2 += (hg35 / 2.0);
- XPoint p[4];
- p[0].x = int(x2 - 2.0 * hg35); p[0].y = int(y + hg);
- p[1].x = int(x2 - hg35); p[1].y = int(y + hg35);
- p[2].x = int(x2); p[2].y = int(y + hg);
- p[3].x = int(x2 + hg35); p[3].y = int(y + hg35);
- scr.drawLines(pgc, p, 4);
- break;
- }
- case UNDERBAR: // underbar
- {
- scr.drawLine(pgc,
- int(x2 - wid * 0.4),
- y + (hg / 2.0),
- int(x2 + wid * 0.4),
- y + (hg / 2.0));
- break;
- }
- case CEDILLA: // cedilla
- {
- XPoint p[4];
- p[0].x = int(x2); p[0].y = y;
- p[1].x = int(x2); p[1].y = y + int(hg / 3.0);
- p[2].x = int(x2 + (hg / 3.0));
- p[2].y = y + int(hg / 2.0);
- p[3].x = int(x2 - (hg / 4.0)); p[3].y = y + int(hg);
- scr.drawLines(pgc, p, 4);
- break;
- }
- case UNDERDOT: // underdot
- {
- scr.fillArc(pgc, int(x2), y + hg35,
- 3, 3, 0, 360*64);
- break;
- }
-
- case DOT: // dot
- {
- scr.fillArc(pgc, int(x2), y + hg * 0.5,
- (hg + 3.0)/5.0,
- (hg + 3.0)/5.0, 0, 360*64);
- break;
- }
-
- case CIRCLE: // circle
- {
- scr.drawArc(pgc, int(x2 - (hg / 2.0)),
- y + (hg / 2.0), hg, hg, 0,
- 360*64);
- break;
- }
- case TIE: // tie
- {
- scr.drawArc(pgc,
- int(x2 + hg35), y + (hg / 2.0),
- 2 * hg, hg, 0, 360*32);
- break;
- }
- case BREVE: // breve
- {
- scr.drawArc(pgc,
- int(x2 - (hg / 2.0)), y,
- hg, hg, 0, -360*32);
- break;
- }
- case CARON: // caron
- {
- XPoint p[3];
- p[0].x = int(x2 - hg35); p[0].y = int(y + hg35);
- p[1].x = int(x2); p[1].y = int(y + hg);
- p[2].x = int(x2 + hg35); p[2].y = int(y + hg35);
- scr.drawLines(pgc, p, 3);
- break;
- }
- case SPECIAL_CARON: // special caron
- {
- switch (ic) {
- case 'L': wid = int(4.0 * wid / 5.0); break;
- case 't': y -= int(hg35 / 2.0); break;
- }
- XPoint p[3];
- p[0].x = int(x + wid); p[0].y = int(y + hg35 + hg);
- p[1].x = int(x + wid + (hg35 / 2.0));
- p[1].y = int(y + hg + (hg35 / 2.0));
- p[2].x = int(x + wid + (hg35 / 2.0));
- p[2].y = y + int(hg);
- scr.drawLines(pgc, p, 3);
- break;
- }
- case HUNGARIAN_UMLAUT: // hung. umlaut
- {
- XSegment s[2];
- s[0].x1= int(x2 - (hg / 2.0)); s[0].y1 = int(y + hg);
- s[0].x2 = int(x2 + hg35 - (hg / 2.0));
- s[0].y2 = int(y + hg35);
- s[1].x1 = int(x2 + (hg / 2.0));
- s[1].y1 = int(y + hg);
- s[1].x2 = int(x2 + hg35 + (hg / 2.0));
- s[1].y2 = int(y + hg35);
-
- scr.drawSegments(pgc, s, 2);
- break;
- }
- case UMLAUT: // umlaut
- {
- float rad = hg / 2.0;
- if (rad <= 1.0) {
- scr.drawPoint(pgc,
- int(x2 - ((4.0 * hg) / 7.0)),
- y + hg35);
- scr.drawPoint(pgc,
- int(x2 + ((4.0 * hg) / 7.0)),
- y + hg35);
- } else {
- rad += .5; // this ensures that f.ex. 1.5 will
- // not be rounded down to .5 and then
- // converted to int = 0
- scr.fillArc(pgc, int(x2 - ((2.0 * hg) / 4.0)),
- y + hg35,
- rad, rad, 0, 360*64);
- scr.fillArc(pgc, int(x2 + ((2.0 * hg) / 4.0)),
- y + hg35,
- rad, rad, 0, 360*64);
- }
- //scr.drawText(font, "ยจ", 1, baseline, x2);
- break;
- }
- case CIRCUMFLEX: // circumflex
- {
- XPoint p[3];
- p[0].x = int(x2 - hg35); p[0].y = y + int(hg);
- p[1].x = int(x2); p[1].y = int(y + hg35);
- p[2].x = int(x2 + hg35); p[2].y = y + int(hg);
- scr.drawLines(pgc, p, 3);
- break;
- }
- case OGONEK: // ogonek
- {
- // this does probably not look like an ogonek, so
- // it should certainly be refined
- XPoint p[4];
- p[0].x = int(x2); p[0].y = y;
- p[1].x = int(x2); p[1].y = y + int(hg35);
- p[2].x = int(x2 - hg35);
- p[2].y = y + int(hg / 2.0);
- p[3].x = int(x2 + (hg / 4.0)); p[3].y = y + int(hg);
- scr.drawLines(pgc, p, 4);
- break;
- }
- case lSLASH:
- case LSLASH:
- {
- XPoint p[2];
- p[0].x = int(x);
- p[0].y = y + int(3.0 * hg);
- p[1].x = int(x + float(wid) * 0.75);
- p[1].y = y + int(hg);
- scr.drawLines(pgc, p, 2);
- break;
- }
- case DOT_LESS_I: // dotless-i
- case DOT_LESS_J: // dotless-j
- {
- // nothing to do for these
- break;
- }
- }
- } else {
- scr.fillRectangle(gc_lighted,
- int(x + 1), baseline - Ascent(font) + 1,
- Width(font) - 2,
- Ascent(font) + Descent(font) - 2);
-
- scr.drawRectangle(gc_lighted,
- int(x), baseline - Ascent(font),
- Width(font) - 1,
- Ascent(font) + Descent(font) - 1);
- scr.drawString(font, contents, baseline, int(x + 2));
- }
- x += Width(font);
-}
-#endif