mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
fix in lyxfont.C bogus static_cast, some changes in insetlatexaccent
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@380 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
20229daf94
commit
b3bc8c1e71
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
||||
1999-12-15 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/insets/insetlatexaccent.C (Lbearing): new function, used to
|
||||
help with placing the manually drawn accents better.
|
||||
(Rbearing): ditto
|
||||
(Draw): x2 and hg changed to float to minimize rounding errors and
|
||||
help place the accents better.
|
||||
|
||||
* src/lyxfont.C (ascent): fixed faulty static_cast, casting from
|
||||
unsigned short to char is just wrong...cast the char to unsigned
|
||||
char instead so that the two values can compare sanely. This
|
||||
should also make the display of insetlatexaccents better and
|
||||
perhaps also some other insets.
|
||||
(descent): ditto
|
||||
(lbearing): new function
|
||||
(rbearing): ditto
|
||||
|
||||
1999-12-15 Allan Rae <rae@lyx.org>
|
||||
|
||||
* src/stl_string_fwd.h, src/Makefile.am (lyx_SOURCES): added new
|
||||
|
@ -55,10 +55,10 @@
|
||||
/* Define as 1 if you have the stpcopy function */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/*
|
||||
#if 0
|
||||
/* Define if the bool type is known to your compiler */
|
||||
#undef HAVE_bool
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* Define to the name of the distribution. */
|
||||
#undef PACKAGE
|
||||
|
6
po/ca.po
6
po/ca.po
@ -4931,9 +4931,3 @@ msgstr "No es pot tallar la taula."
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "Un flotant inclouria un flotant!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Error! Impossible tancar el fitxer correctament: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Error! Impossible tancar el fitxer correctament: "
|
||||
|
6
po/cs.po
6
po/cs.po
@ -4924,9 +4924,3 @@ msgstr "Nelze rozd
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "Objekt by obsahoval objekt!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Chyba! Nemohu správně uzavřít soubor: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Chyba! Nemonu strávně uzavřít soubor:"
|
||||
|
6
po/da.po
6
po/da.po
@ -4970,9 +4970,3 @@ msgstr "Kan ikke klippe tabel."
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "Flyder ville inkludere flyder!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Fejl! Filen blev ikke lukket korrekt: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Fejl: Filen blev ikke lukket korrekt:"
|
||||
|
6
po/de.po
6
po/de.po
@ -4952,9 +4952,3 @@ msgstr "Die Tabelle kann nicht ausgeschnitten werden."
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "Float Objekt würde ein weiteres enthalten!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Fehler! Die Datei konnte nicht ordnungsgemäß geschlossen werden: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Fehler! Die Datei konnte nicht ordnungsgemäß geschlossen werden: "
|
||||
|
6
po/es.po
6
po/es.po
@ -4963,9 +4963,3 @@ msgstr "No se puede cortar tabla."
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "¡Flotante incluiría un flotante!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "¡Error! No se pudo cerrar el archivo correctamente: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "¡Error! No se puede cerrar el archivo correctamente:"
|
||||
|
6
po/fi.po
6
po/fi.po
@ -4947,9 +4947,3 @@ msgstr "Ei voi jakaa taulukkoa."
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "Kelluva sisältäisi kelluvan!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Virhe! En saanut tiedosto kunnolla suljetuksi: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Virhe! En saanut tiedosto kunnolla suljetuksi:"
|
||||
|
6
po/fr.po
6
po/fr.po
@ -4978,9 +4978,3 @@ msgstr "Impossible de couper le tableau."
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "Un flottant inclurait un flottant !"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Erreur ! Impossible de fermer le fichier correctement : "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Erreur ! Impossible de fermer le fichier correctement : "
|
||||
|
6
po/hu.po
6
po/hu.po
@ -4940,9 +4940,3 @@ msgstr ""
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Hiba! Nem sikerült a fájlt rendesen bezárni: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Hiba! Nem sikerült a fájlt rendesen bezárni:"
|
||||
|
6
po/it.po
6
po/it.po
@ -4958,9 +4958,3 @@ msgstr "Non puoi tagliare una tabella."
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "L'oggetto flottante ne includerebbe un altro!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Errore! Non riesco a chiudere correttamente il file: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Errore! Non riesco a chiudere correttamente il file:"
|
||||
|
6
po/nl.po
6
po/nl.po
@ -4977,9 +4977,3 @@ msgstr "Kan tabel niet splitsen."
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "Hier zou een zwever een andere zwever bevatten!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Fout! Kon bestand niet op juiste wijze sluiten: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Fout! Kon bestand niet op juiste wijze sluiten:"
|
||||
|
6
po/pl.po
6
po/pl.po
@ -4924,9 +4924,3 @@ msgstr "Nie mo
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "Wstawka móg³aby zawieraæ inn± wstawkê!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Błąd! Nie można poprawnie zamknąć pliku: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Błąd! Nie można poprawnie zamknąć pliku:"
|
||||
|
6
po/pt.po
6
po/pt.po
@ -4975,9 +4975,3 @@ msgstr "N
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "Flutuante incluiria flutuante!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Erro! Não posso fechar corretamente o arquivo"
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Erro! Não posso fechar corretamente o arquivo"
|
||||
|
6
po/ru.po
6
po/ru.po
@ -4998,9 +4998,3 @@ msgstr "
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "ëÁÄÒ ÄÏÌÖÅÎ ×ËÌÀÞÁÔØ ËÁÄÒ!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "ïÛÉÂËÁ ÚÁËÒÙÔÉÑ ÆÁÊÌÁ "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "ïÛÉÂËÁ ÚÁËÒÙÔÉÑ ÆÁÊÌÁ "
|
||||
|
6
po/sl.po
6
po/sl.po
@ -4937,9 +4937,3 @@ msgstr "Ne morem razkosati tabele."
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "Plovka bi vkljuèevala plovko!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Napaka! Ne morem pravilno zapreti datoteke: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Napaka! Ne morem pravilno zapreti datoteke:"
|
||||
|
6
po/sv.po
6
po/sv.po
@ -5062,9 +5062,3 @@ msgstr "Kan inte klippa tabell."
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "Flytande objekt skulle då innefatta ett annat!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Fel! Kunde inte stänga filen ordentligt: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Fel: Kunde inte stänga filen ordentligt:"
|
||||
|
6
po/tr.po
6
po/tr.po
@ -4996,9 +4996,3 @@ msgstr "Tabloyu kesemem."
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "Tek-parça, tek-parça içermeli!"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Hata! Dosya düzgün olarak kapatılamadı: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Hata! Dosya düzgün kapatılamadı:"
|
||||
|
8
po/wa.po
8
po/wa.po
@ -10,7 +10,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: LyX 1.0.0\n"
|
||||
"POT-Creation-Date: 1999-12-13 23:06+0100\n"
|
||||
"PO-Revision-Date: 1999-12-01 00:26+01:00\n"
|
||||
"PO-Revision-Date: 1999-12-13 23:40+01:00\n"
|
||||
"Last-Translator: Lorint Hendschel <LorintHendschel@skynet.be>\n"
|
||||
"Language-Team: walon <linux-wa@chanae.alphanet.ch>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@ -4982,9 +4982,3 @@ msgstr "Dji n' sai c
|
||||
#: src/text.C:3927
|
||||
msgid "Float would include float!"
|
||||
msgstr "I gn åreut on flotant di stitchî dins èn ôte flotant !"
|
||||
|
||||
#~ msgid "Error! Could not close file properly: "
|
||||
#~ msgstr "Aroke! Dji n' sai cloyu ci fitchî la comufåt: "
|
||||
|
||||
#~ msgid "Error! Could not close file properly:"
|
||||
#~ msgstr "Aroke! Dji n' sai cloyu ci fitchî ci comufåt: "
|
||||
|
@ -264,6 +264,10 @@ void InsetLatexAccent::checkContents()
|
||||
|
||||
int InsetLatexAccent::Ascent(LyXFont const & font) const
|
||||
{
|
||||
// This function is a bit too simplistix and is just a
|
||||
// "try to make a fit for all accents" approach, to
|
||||
// make it better we need to know what kind of accent is
|
||||
// used and add to max based on that.
|
||||
int max;
|
||||
if (candisp) {
|
||||
if (ic == ' ')
|
||||
@ -303,6 +307,18 @@ int InsetLatexAccent::Width(LyXFont const & font) const
|
||||
}
|
||||
|
||||
|
||||
int InsetLatexAccent::Lbearing(LyXFont const & font) const
|
||||
{
|
||||
return font.lbearing(ic);
|
||||
}
|
||||
|
||||
|
||||
int InsetLatexAccent::Rbearing(LyXFont const & font) const
|
||||
{
|
||||
return font.rbearing(ic);
|
||||
}
|
||||
|
||||
|
||||
bool InsetLatexAccent::DisplayISO8859_9(LyXFont font,
|
||||
LyXScreen & scr,
|
||||
int baseline,
|
||||
@ -357,73 +373,80 @@ void InsetLatexAccent::Draw(LyXFont font,
|
||||
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 + float(wid/2);
|
||||
float x2 = x + (Rbearing(font) - Lbearing(font)) / 2.0;
|
||||
float hg35;
|
||||
int hg, y;
|
||||
float hg;
|
||||
int y;
|
||||
if (plusasc) {
|
||||
// mark at the top
|
||||
hg = font.maxDescent();
|
||||
y = baseline - asc;
|
||||
|
||||
if (font.shape() == LyXFont::ITALIC_SHAPE) x2 += (4*hg)/5; // italic
|
||||
if (font.shape() == LyXFont::ITALIC_SHAPE)
|
||||
x2 += (4.0 * hg) / 5.0; // italic
|
||||
} else {
|
||||
// at the bottom
|
||||
hg = desc;
|
||||
y = baseline;
|
||||
}
|
||||
|
||||
hg35 = float(hg*3)/5;
|
||||
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, (hg+3)/5);
|
||||
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*hg)/10; // italic
|
||||
if (font.shape() == LyXFont::ITALIC_SHAPE)
|
||||
tmpx += (8.0 * hg) / 10.0; // italic
|
||||
lyxerr.debug() << "Removing dot." << endl;
|
||||
// remove the dot first
|
||||
scr.fillRectangle(gc_clear, int(x + tmpx),
|
||||
tmpvar, wid,
|
||||
font.ascent('i') -
|
||||
font.ascent('x')-1);
|
||||
|
||||
font.ascent('x') - 1);
|
||||
}
|
||||
// now the rest - draw within (x, y, x+wid, y+hg)
|
||||
switch (modtype) {
|
||||
case ACUTE: // acute
|
||||
{
|
||||
scr.drawLine(pgc, int(x2), int(y+hg35),
|
||||
int(x2+hg35), y);
|
||||
scr.drawLine(pgc, int(x2), int(y + hg35),
|
||||
int(x2 + hg35), y);
|
||||
break;
|
||||
}
|
||||
case GRAVE: // grave
|
||||
{
|
||||
scr.drawLine(pgc, int(x2), int(y+hg35),
|
||||
int(x2-hg35), y);
|
||||
scr.drawLine(pgc, int(x2), int(y + hg35),
|
||||
int(x2 - hg35), y);
|
||||
break;
|
||||
}
|
||||
case MACRON: // macron
|
||||
{
|
||||
scr.drawLine(pgc,
|
||||
int(x2-(3*wid/7)), int(y+(hg/2) + hg35),
|
||||
int(x2+(3*wid/7)), int(y+(hg/2) + hg35));
|
||||
int(x2 - (3.0 * wid / 7.0)),
|
||||
int(y + (hg / 2.0) + hg35),
|
||||
int(x2 + (3.0 * wid / 7.0)),
|
||||
int(y + (hg / 2.0) + hg35));
|
||||
break;
|
||||
}
|
||||
case TILDE: // tilde
|
||||
{
|
||||
if (hg35 > 2) --hg35;
|
||||
x2 += (hg35/2);
|
||||
if (hg35 > 2.0) hg35 -= 1.0;
|
||||
x2 += (hg35 / 2.0);
|
||||
XPoint p[4];
|
||||
p[0].x = int(x2 - 2*hg35); p[0].y = int(y + hg);
|
||||
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);
|
||||
@ -433,44 +456,48 @@ void InsetLatexAccent::Draw(LyXFont font,
|
||||
case UNDERBAR: // underbar
|
||||
{
|
||||
scr.drawLine(pgc,
|
||||
int(x2-(3*wid/7)), y+(hg/2),
|
||||
int(x2+(3*wid/7)), y+(hg/2));
|
||||
int(x2 - (3.0 * wid / 7.0)),
|
||||
y + (hg / 2.0),
|
||||
int(x2 + (3.0 * wid / 7.0)),
|
||||
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 + (hg/3);
|
||||
p[2].x = int(x2 + (hg/3)); p[2].y = y + (hg/2);
|
||||
p[3].x = int(x2 - (hg/4)); p[3].y = y + hg;
|
||||
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
|
||||
case DOT: // dot
|
||||
{
|
||||
scr.drawArc(pgc, int(x2), y+(hg/2),
|
||||
scr.drawArc(pgc, int(x2), y + (hg / 2.0),
|
||||
1, 1, 0, 360*64);
|
||||
break;
|
||||
}
|
||||
case CIRCLE: // circle
|
||||
{
|
||||
scr.drawArc(pgc, int(x2-(hg/2)), y, hg, hg, 0,
|
||||
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), y+(hg/4),
|
||||
int(x2), y + (hg / 4.0),
|
||||
hg, hg, 0, 11519);
|
||||
break;
|
||||
}
|
||||
case BREVE: // breve
|
||||
{
|
||||
scr.drawArc(pgc,
|
||||
int(x2-(hg/2)), y-(hg/4),
|
||||
int(x2 - (hg / 2.0)), y - (hg / 4.0),
|
||||
hg, hg, 0, -11519);
|
||||
break;
|
||||
}
|
||||
@ -478,7 +505,7 @@ void InsetLatexAccent::Draw(LyXFont font,
|
||||
{
|
||||
XPoint p[3];
|
||||
p[0].x = int(x2 - hg35); p[0].y = y;
|
||||
p[1].x = int(x2); p[1].y = int(y+hg35);
|
||||
p[1].x = int(x2); p[1].y = int(y + hg35);
|
||||
p[2].x = int(x2 + hg35); p[2].y = y;
|
||||
scr.drawLines(pgc, p, 3);
|
||||
break;
|
||||
@ -486,49 +513,60 @@ void InsetLatexAccent::Draw(LyXFont font,
|
||||
case SPECIAL_CARON: // special caron
|
||||
{
|
||||
switch (ic) {
|
||||
case 'L': wid = 4*wid/5; break;
|
||||
case 't': y -= int(hg35/2); break;
|
||||
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)); p[1].y = int(y+ hg+(hg35/2));
|
||||
p[2].x = int(x+wid+(hg35/2)); p[2].y = y + hg;
|
||||
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)); s[0].y1 = int(y + hg35);
|
||||
s[0].x2= int(x2+hg35-(hg/2)); s[0].y2 = y;
|
||||
s[1].x1= int(x2+(hg/2)); s[1].y1 = int(y + hg35);
|
||||
s[1].x2= int(x2+hg35+(hg/2)); s[1].y2 = y;
|
||||
s[0].x1= int(x2 - (hg / 2.0)); s[0].y1 = int(y + hg35);
|
||||
s[0].x2= int(x2 + hg35 - (hg / 2.0)); s[0].y2 = y;
|
||||
s[1].x1= int(x2 + (hg / 2.0));
|
||||
s[1].y1 = int(y + hg35);
|
||||
s[1].x2= int(x2 + hg35 + (hg / 2.0)); s[1].y2 = y;
|
||||
|
||||
scr.drawSegments(pgc, s, 2);
|
||||
break;
|
||||
}
|
||||
case UMLAUT: // umlaut
|
||||
{
|
||||
int tmpadd = y;
|
||||
tmpadd += (remdot) ? ((19*hg)/10) : ((20*hg)/27); // if (remdot) -> i or j
|
||||
int rad = ((hg*4)/8);
|
||||
if (rad <= 1) {
|
||||
scr.drawPoint(pgc, int(x2-((4*hg)/7)), tmpadd);
|
||||
scr.drawPoint(pgc, int(x2+((4*hg)/7)), tmpadd);
|
||||
float tmpadd = y;
|
||||
tmpadd += (remdot) ?
|
||||
asc/3.0 :
|
||||
asc/5.0; // if (remdot) -> i or j
|
||||
float rad = ((hg * 4.0) / 8.0);
|
||||
if (rad <= 1.0) {
|
||||
scr.drawPoint(pgc,
|
||||
int(x2 - ((4.0 * hg) / 7.0)),
|
||||
tmpadd);
|
||||
scr.drawPoint(pgc,
|
||||
int(x2 + ((4.0 * hg) / 7.0)),
|
||||
tmpadd);
|
||||
} else {
|
||||
scr.drawArc(pgc, int(x2-((2*hg)/4)), tmpadd,
|
||||
rad-1, rad-1, 0, 360*64);
|
||||
scr.drawArc(pgc, int(x2+((2*hg)/4)), tmpadd,
|
||||
rad-1, rad-1, 0, 360*64);
|
||||
scr.drawArc(pgc, int(x2 - ((2.0 * hg) / 4.0)),
|
||||
tmpadd,
|
||||
rad - 1, rad - 1, 0, 360*64);
|
||||
scr.drawArc(pgc, int(x2 + ((2.0 * hg) / 4.0)),
|
||||
tmpadd,
|
||||
rad - 1, rad - 1, 0, 360*64);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CIRCUMFLEX: // circumflex
|
||||
{
|
||||
XPoint p[3];
|
||||
p[0].x = int(x2 - hg35); p[0].y = y + hg;
|
||||
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 + hg;
|
||||
p[2].x = int(x2 + hg35); p[2].y = y + int(hg);
|
||||
scr.drawLines(pgc, p, 3);
|
||||
break;
|
||||
}
|
||||
@ -538,9 +576,10 @@ void InsetLatexAccent::Draw(LyXFont font,
|
||||
// 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 + (hg/3);
|
||||
p[2].x = int(x2 - (hg/3)); p[2].y = y + (hg/2);
|
||||
p[3].x = int(x2 + (hg/4)); p[3].y = y + hg;
|
||||
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;
|
||||
}
|
||||
@ -548,8 +587,10 @@ void InsetLatexAccent::Draw(LyXFont font,
|
||||
case LSLASH:
|
||||
{
|
||||
XPoint p[2];
|
||||
p[0].x = int(x); p[0].y = y+3*hg;
|
||||
p[1].x = int(x+float(wid)*.75); p[1].y = y+hg;
|
||||
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;
|
||||
}
|
||||
@ -562,15 +603,15 @@ void InsetLatexAccent::Draw(LyXFont font,
|
||||
}
|
||||
} else {
|
||||
scr.fillRectangle(gc_lighted,
|
||||
int(x+1), baseline - Ascent(font)+1,
|
||||
Width(font)-2,
|
||||
Ascent(font)+Descent(font)-2);
|
||||
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));
|
||||
Width(font) - 1,
|
||||
Ascent(font) + Descent(font) - 1);
|
||||
scr.drawString(font, contents, baseline, int(x + 2));
|
||||
}
|
||||
x += Width(font);
|
||||
}
|
||||
|
@ -42,6 +42,10 @@ public:
|
||||
///
|
||||
int Width(LyXFont const & font) const;
|
||||
///
|
||||
int Lbearing(LyXFont const & font) const;
|
||||
///
|
||||
int Rbearing(LyXFont const & font) const;
|
||||
///
|
||||
bool DisplayISO8859_9(LyXFont font, LyXScreen & scr,
|
||||
int baseline, float & x);
|
||||
///
|
||||
|
@ -432,7 +432,7 @@ GC GetColorGC(LyXFont::FONT_COLOR color)
|
||||
|
||||
GC GetAccentGC(LyXFont const &f, int line_width)
|
||||
{
|
||||
if (line_width>= 10) line_width = 9;
|
||||
if (line_width >= 10) line_width = 9;
|
||||
|
||||
if (accent_gc[line_width]) return accent_gc[line_width];
|
||||
|
||||
|
@ -376,14 +376,14 @@ LyXFont & LyXFont::setLyXFamily(string const & fam)
|
||||
{
|
||||
string s = lowercase(fam);
|
||||
|
||||
int i= 0;
|
||||
while (s != LyXFamilyNames[i] && LyXFamilyNames[i] != "error") i++;
|
||||
int i = 0;
|
||||
while (s != LyXFamilyNames[i] && LyXFamilyNames[i] != "error") ++i;
|
||||
if (s == LyXFamilyNames[i]) {
|
||||
setFamily(LyXFont::FONT_FAMILY(i));
|
||||
} else
|
||||
lyxerr << "LyXFont::setLyXFamily: Unknown family `"
|
||||
<< s << '\'' << endl;
|
||||
return (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -392,14 +392,14 @@ LyXFont & LyXFont::setLyXSeries(string const & ser)
|
||||
{
|
||||
string s = lowercase(ser);
|
||||
|
||||
int i= 0;
|
||||
while (s != LyXSeriesNames[i] && LyXSeriesNames[i] != "error") i++;
|
||||
int i = 0;
|
||||
while (s != LyXSeriesNames[i] && LyXSeriesNames[i] != "error") ++i;
|
||||
if (s == LyXSeriesNames[i]) {
|
||||
setSeries(LyXFont::FONT_SERIES(i));
|
||||
} else
|
||||
lyxerr << "LyXFont::setLyXSeries: Unknown series `"
|
||||
<< s << '\'' << endl;
|
||||
return (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -408,14 +408,14 @@ LyXFont & LyXFont::setLyXShape(string const & sha)
|
||||
{
|
||||
string s = lowercase(sha);
|
||||
|
||||
int i= 0;
|
||||
while (s != LyXShapeNames[i] && LyXShapeNames[i] != "error") i++;
|
||||
int i = 0;
|
||||
while (s != LyXShapeNames[i] && LyXShapeNames[i] != "error") ++i;
|
||||
if (s == LyXShapeNames[i]) {
|
||||
setShape(LyXFont::FONT_SHAPE(i));
|
||||
} else
|
||||
lyxerr << "LyXFont::setLyXShape: Unknown shape `"
|
||||
<< s << '\'' << endl;
|
||||
return (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -423,14 +423,14 @@ LyXFont & LyXFont::setLyXShape(string const & sha)
|
||||
LyXFont & LyXFont::setLyXSize(string const & siz)
|
||||
{
|
||||
string s = lowercase(siz);
|
||||
int i= 0;
|
||||
while (s != LyXSizeNames[i] && LyXSizeNames[i] != "error") i++;
|
||||
int i = 0;
|
||||
while (s != LyXSizeNames[i] && LyXSizeNames[i] != "error") ++i;
|
||||
if (s == LyXSizeNames[i]) {
|
||||
setSize(LyXFont::FONT_SIZE(i));
|
||||
} else
|
||||
lyxerr << "LyXFont::setLyXSize: Unknown size `"
|
||||
<< s << '\'' << endl;
|
||||
return (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Set size according to lyx format string
|
||||
@ -438,7 +438,7 @@ LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz)
|
||||
{
|
||||
string s = lowercase(siz);
|
||||
int i= 0;
|
||||
while (s != LyXMiscNames[i] && LyXMiscNames[i] != "error") i++;
|
||||
while (s != LyXMiscNames[i] && LyXMiscNames[i] != "error") ++i;
|
||||
if (s == LyXMiscNames[i])
|
||||
return FONT_MISC_STATE(i);
|
||||
lyxerr << "LyXFont::setLyXMisc: Unknown misc flag `"
|
||||
@ -451,13 +451,13 @@ LyXFont & LyXFont::setLyXColor(string const & col)
|
||||
{
|
||||
string s = lowercase(col);
|
||||
int i= 0;
|
||||
while (s != LyXColorNames[i] && LyXColorNames[i] != "error") i++;
|
||||
while (s != LyXColorNames[i] && LyXColorNames[i] != "error") ++i;
|
||||
if (s == LyXColorNames[i]) {
|
||||
setColor(LyXFont::FONT_COLOR(i));
|
||||
} else
|
||||
lyxerr << "LyXFont::setLyXColor: Unknown Color `"
|
||||
<< s << '\'' << endl;
|
||||
return (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -465,16 +465,16 @@ LyXFont & LyXFont::setLyXColor(string const & col)
|
||||
LyXFont & LyXFont::setGUISize(string const & siz)
|
||||
{
|
||||
string s = lowercase(siz);
|
||||
int i= 0;
|
||||
int i = 0;
|
||||
while (!lGUISizeNames[i].empty() &&
|
||||
s != _(lGUISizeNames[i].c_str()))
|
||||
i++;
|
||||
++i;
|
||||
if (s == _(lGUISizeNames[i].c_str())) {
|
||||
setSize(LyXFont::FONT_SIZE(i));
|
||||
} else
|
||||
lyxerr << "LyXFont::setGUISize: Unknown Size `"
|
||||
<< s << '\'' << endl;
|
||||
return (*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -813,8 +813,8 @@ int LyXFont::ascent(char c) const
|
||||
{
|
||||
XFontStruct * finfo = getXFontstruct();
|
||||
if (finfo->per_char
|
||||
&& c >= static_cast<char>(finfo->min_char_or_byte2)
|
||||
&& c <= static_cast<char>(finfo->max_char_or_byte2)) {
|
||||
&& static_cast<unsigned char>(c) >= finfo->min_char_or_byte2
|
||||
&& static_cast<unsigned char>(c) <= finfo->max_char_or_byte2) {
|
||||
unsigned int index = c - finfo->min_char_or_byte2;
|
||||
return finfo->per_char[index].ascent;
|
||||
} else
|
||||
@ -826,8 +826,8 @@ int LyXFont::descent(char c) const
|
||||
{
|
||||
XFontStruct * finfo = getXFontstruct();
|
||||
if (finfo->per_char
|
||||
&& c >= static_cast<char>(finfo->min_char_or_byte2)
|
||||
&& c <= static_cast<char>(finfo->max_char_or_byte2)) {
|
||||
&& static_cast<unsigned char>(c) >= finfo->min_char_or_byte2
|
||||
&& static_cast<unsigned char>(c) <= finfo->max_char_or_byte2) {
|
||||
unsigned int index = c - finfo->min_char_or_byte2;
|
||||
return finfo->per_char[index].descent;
|
||||
} else
|
||||
@ -846,6 +846,32 @@ int LyXFont::width(char c) const
|
||||
}
|
||||
|
||||
|
||||
int LyXFont::lbearing(char c) const
|
||||
{
|
||||
XFontStruct * finfo = getXFontstruct();
|
||||
if (finfo->per_char
|
||||
&& static_cast<unsigned char>(c) >= finfo->min_char_or_byte2
|
||||
&& static_cast<unsigned char>(c) <= finfo->max_char_or_byte2) {
|
||||
unsigned int index = c - finfo->min_char_or_byte2;
|
||||
return finfo->per_char[index].lbearing;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int LyXFont::rbearing(char c) const
|
||||
{
|
||||
XFontStruct * finfo = getXFontstruct();
|
||||
if (finfo->per_char
|
||||
&& static_cast<unsigned char>(c) >= finfo->min_char_or_byte2
|
||||
&& static_cast<unsigned char>(c) <= finfo->max_char_or_byte2) {
|
||||
unsigned int index = c - finfo->min_char_or_byte2;
|
||||
return finfo->per_char[index].rbearing;
|
||||
} else
|
||||
return width(c);
|
||||
}
|
||||
|
||||
|
||||
int LyXFont::textWidth(char const * s, int n) const
|
||||
{
|
||||
if (realShape() != LyXFont::SMALLCAPS_SHAPE){
|
||||
@ -858,7 +884,7 @@ int LyXFont::textWidth(char const * s, int n) const
|
||||
smallfont.decSize();
|
||||
smallfont.decSize();
|
||||
smallfont.setShape(LyXFont::UP_SHAPE);
|
||||
for (int i= 0; i < n; i++){
|
||||
for (int i = 0; i < n; ++i) {
|
||||
c = s[i];
|
||||
if (islower(c)){
|
||||
c = toupper(c);
|
||||
@ -909,7 +935,7 @@ int LyXFont::drawText(char const * s, int n, Pixmap pm,
|
||||
smallfont.decSize();
|
||||
smallfont.decSize();
|
||||
smallfont.setShape(LyXFont::UP_SHAPE);
|
||||
for (int i = 0; i < n; ++i){
|
||||
for (int i = 0; i < n; ++i) {
|
||||
c = s[i];
|
||||
if (islower(c)){
|
||||
c = toupper(c);
|
||||
|
@ -330,6 +330,12 @@ public:
|
||||
///
|
||||
int width(char c) const;
|
||||
|
||||
///
|
||||
int lbearing(char c) const;
|
||||
|
||||
///
|
||||
int rbearing(char c) const;
|
||||
|
||||
///
|
||||
int textWidth(char const *s, int n) const;
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "LRegex.h"
|
||||
|
||||
using std::count;
|
||||
using std::transform;
|
||||
|
||||
bool isStrInt(string const & str)
|
||||
{
|
||||
@ -44,17 +45,31 @@ int strToInt(string const & str)
|
||||
|
||||
string lowercase(string const & a)
|
||||
{
|
||||
#if 0
|
||||
string tmp;
|
||||
string::const_iterator cit = a.begin();
|
||||
for(; cit != a.end(); ++cit) {
|
||||
tmp += static_cast<char>(tolower(*cit));
|
||||
}
|
||||
return tmp;
|
||||
#endif
|
||||
string tmp(a);
|
||||
transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
string uppercase(string const & a)
|
||||
{
|
||||
string tmp(a);
|
||||
transform(tmp.begin(), tmp.end(), tmp.begin(), toupper);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
string tostr(long i)
|
||||
{
|
||||
// should use string stream
|
||||
char str[30];
|
||||
sprintf(str, "%ld", i);
|
||||
return string(str);
|
||||
@ -63,6 +78,7 @@ string tostr(long i)
|
||||
|
||||
string tostr(unsigned long i)
|
||||
{
|
||||
// should use string stream
|
||||
char str[30];
|
||||
sprintf(str, "%lu", i);
|
||||
return string(str);
|
||||
@ -109,6 +125,7 @@ string tostr(float f)
|
||||
|
||||
string tostr(double d)
|
||||
{
|
||||
// should use string stream
|
||||
char tmp[40];
|
||||
sprintf(tmp, "%f", d);
|
||||
return string(tmp);
|
||||
|
@ -99,6 +99,9 @@ int strToInt(string const & str);
|
||||
///
|
||||
string lowercase(string const &);
|
||||
|
||||
///
|
||||
string uppercase(string const &);
|
||||
|
||||
/// int to string
|
||||
string tostr(int i);
|
||||
|
||||
|
@ -271,7 +271,7 @@ void lyxstring::Srep::reserve(lyxstring::size_type res_arg)
|
||||
|
||||
|
||||
void lyxstring::Srep::replace(lyxstring::size_type i, lyxstring::size_type n,
|
||||
value_type const * p, size_type n2)
|
||||
value_type const * p, size_type n2)
|
||||
{
|
||||
// can be called with p= 0 and n2= 0
|
||||
n = min(sz - i, n);
|
||||
|
Loading…
Reference in New Issue
Block a user