/* This file is part of * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1997 Asger Alstrup *
*======================================================*/
int InsetSpecialChar::Ascent(LyXFont const&font) const
{ return font.maxAscent();
}
int InsetSpecialChar::Descent(LyXFont const&font) const
{ return font.maxDescent();
}
int InsetSpecialChar::Width(LyXFont const&font) const
{
LyXFont f = font; switch (kind) { case HYPHENATION:
{ int w = f.textWidth("-", 1); if (w > 5)
w -= 2; // to make it look shorter return w;
} case END_OF_SENTENCE:
{ return f.textWidth(".", 1);
} case LDOTS:
{ return f.textWidth(". . .", 5);
}
} return 1; // To shut up gcc
}
void InsetSpecialChar::Draw(LyXFont font, LyXScreen &scr, int baseline, float &x)
{ switch (kind) { case HYPHENATION:
{
font.setColor(LyXFont::MAGENTA);
scr.drawText(font, "-", 1, baseline, int(x));
x += Width(font); break;
} case END_OF_SENTENCE:
{
font.setColor(LyXFont::MAGENTA);
scr.drawText(font, ".", 1, baseline, int(x));
x += Width(font); break;
} case LDOTS:
{
font.setColor(LyXFont::MAGENTA);
scr.drawText(font, ". . .", 5, baseline, int(x));
x += Width(font); break;
}
}
}
// In lyxf3 this will be just LaTeX void InsetSpecialChar::Write(FILE *file)
{
LString command; switch (kind) { case HYPHENATION: command = "\\-"; break; case END_OF_SENTENCE: command = "\\@."; break; case LDOTS: command = "\\ldots{}"; break;
}
fprintf(file, "\\SpecialChar %s\n", command.c_str());
}
// This function will not be necessary when lyx3 void InsetSpecialChar::Read(LyXLex &lex)
{
lex.nextToken();
LString command = lex.GetString();
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.