1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-2000 The LyX Team.
9 * ====================================================== */
15 #pragma implementation "lyxfont.h"
25 #include "FontLoader.h"
26 #include "support/lstrings.h"
30 // The global fontloader
31 FontLoader fontloader;
38 char const * GUIFamilyNames[6] =
39 { N_("Roman"), N_("Sans serif"), N_("Typewriter"), N_("Symbol"), N_("Inherit"),
43 char const * GUISeriesNames[4] =
44 { N_("Medium"), N_("Bold"), N_("Inherit"), N_("Ignore") };
47 char const * GUIShapeNames[6] =
48 { N_("Upright"), N_("Italic"), N_("Slanted"), N_("Smallcaps"), N_("Inherit"),
52 char const * GUISizeNames[14] =
53 { N_("Tiny"), N_("Smallest"), N_("Smaller"), N_("Small"), N_("Normal"), N_("Large"),
54 N_("Larger"), N_("Largest"), N_("Huge"), N_("Huger"), N_("Increase"), N_("Decrease"),
55 N_("Inherit"), N_("Ignore") };
57 //char const * lGUISizeNames[15] =
58 //{ N_("tiny"), N_("smallest"), N_("smaller"), N_("small"), N_("normal"), N_("large"),
59 // N_("larger"), N_("largest"), N_("huge"), N_("huger"), N_("increase"), N_("decrease"),
60 // N_("inherit"), N_("ignore"), string() };
62 char const * GUIMiscNames[5] =
63 { N_("Off"), N_("On"), N_("Toggle"), N_("Inherit"), N_("Ignore") };
67 // Strings used to read and write .lyx format files
70 char const * LyXFamilyNames[6] =
71 { "roman", "sans", "typewriter", "symbol", "default", "error" };
74 char const * LyXSeriesNames[4] =
75 { "medium", "bold", "default", "error" };
78 char const * LyXShapeNames[6] =
79 { "up", "italic", "slanted", "smallcaps", "default", "error" };
82 char const * LyXSizeNames[14] =
83 { "tiny", "scriptsize", "footnotesize", "small", "normal", "large",
84 "larger", "largest", "huge", "giant",
85 "increase-error", "decrease-error", "default", "error" };
88 char const * LyXMiscNames[5] =
89 { "off", "on", "toggle", "default", "error" };
92 // Strings used to write LaTeX files
95 char const * LaTeXFamilyNames[6] =
96 { "textrm", "textsf", "texttt", "error1", "error2", "error3" };
99 char const * LaTeXSeriesNames[4] =
100 { "textmd", "textbf", "error4", "error5" };
103 char const * LaTeXShapeNames[6] =
104 { "textup", "textit", "textsl", "textsc", "error6", "error7" };
107 char const * LaTeXSizeNames[14] =
108 { "tiny", "scriptsize", "footnotesize", "small", "normalsize", "large",
109 "Large", "LARGE", "huge", "Huge", "error8", "error9", "error10", "error11" };
112 LyXFont::FontBits LyXFont::sane = {
123 LyXFont::FontBits LyXFont::inherit = {
134 LyXFont::FontBits LyXFont::ignore = {
146 /// Decreases font size by one
147 LyXFont & LyXFont::decSize()
150 case SIZE_HUGER: setSize(SIZE_HUGE); break;
151 case SIZE_HUGE: setSize(SIZE_LARGEST); break;
152 case SIZE_LARGEST: setSize(SIZE_LARGER); break;
153 case SIZE_LARGER: setSize(SIZE_LARGE); break;
154 case SIZE_LARGE: setSize(SIZE_NORMAL); break;
155 case SIZE_NORMAL: setSize(SIZE_SMALL); break;
156 case SIZE_SMALL: setSize(SIZE_FOOTNOTE); break;
157 case SIZE_FOOTNOTE: setSize(SIZE_SCRIPT); break;
158 case SIZE_SCRIPT: setSize(SIZE_TINY); break;
159 case SIZE_TINY: break;
161 lyxerr << "Can't LyXFont::decSize on INCREASE_SIZE" << endl;
164 lyxerr <<"Can't LyXFont::decSize on DECREASE_SIZE" << endl;
167 lyxerr <<"Can't LyXFont::decSize on INHERIT_SIZE" << endl;
170 lyxerr <<"Can't LyXFont::decSize on IGNORE_SIZE" << endl;
177 /// Increases font size by one
178 LyXFont & LyXFont::incSize()
181 case SIZE_HUGER: break;
182 case SIZE_HUGE: setSize(SIZE_HUGER); break;
183 case SIZE_LARGEST: setSize(SIZE_HUGE); break;
184 case SIZE_LARGER: setSize(SIZE_LARGEST); break;
185 case SIZE_LARGE: setSize(SIZE_LARGER); break;
186 case SIZE_NORMAL: setSize(SIZE_LARGE); break;
187 case SIZE_SMALL: setSize(SIZE_NORMAL); break;
188 case SIZE_FOOTNOTE: setSize(SIZE_SMALL); break;
189 case SIZE_SCRIPT: setSize(SIZE_FOOTNOTE); break;
190 case SIZE_TINY: setSize(SIZE_SCRIPT); break;
192 lyxerr <<"Can't LyXFont::incSize on INCREASE_SIZE" << endl;
195 lyxerr <<"Can't LyXFont::incSize on DECREASE_SIZE" << endl;
198 lyxerr <<"Can't LyXFont::incSize on INHERIT_SIZE" << endl;
201 lyxerr <<"Can't LyXFont::incSize on IGNORE_SIZE" << endl;
208 /// Updates a misc setting according to request
209 LyXFont::FONT_MISC_STATE LyXFont::setMisc(FONT_MISC_STATE newfont,
212 if (newfont == TOGGLE) {
218 lyxerr <<"LyXFont::setMisc: Need state"
219 " ON or OFF to toggle. Setting to ON" << endl;
222 } else if (newfont == IGNORE)
229 /// Updates font settings according to request
230 void LyXFont::update(LyXFont const & newfont,
231 Language const * document_language, bool toggleall)
233 if(newfont.family() == family() && toggleall)
234 setFamily(INHERIT_FAMILY); // toggle 'back'
235 else if (newfont.family() != IGNORE_FAMILY)
236 setFamily(newfont.family());
237 // else it's IGNORE_SHAPE
239 // "Old" behaviour: "Setting" bold will toggle bold on/off.
240 switch (newfont.series()) {
243 if (series() == BOLD_SERIES && toggleall)
244 setSeries(MEDIUM_SERIES);
246 setSeries(BOLD_SERIES);
250 setSeries(newfont.series());
256 if(newfont.shape() == shape() && toggleall)
257 setShape(INHERIT_SHAPE); // toggle 'back'
258 else if (newfont.shape() != IGNORE_SHAPE)
259 setShape(newfont.shape());
260 // else it's IGNORE_SHAPE
262 if (newfont.size() != IGNORE_SIZE) {
263 if (newfont.size() == INCREASE_SIZE)
265 else if (newfont.size() == DECREASE_SIZE)
267 else if (newfont.size() == size() && toggleall)
268 setSize(INHERIT_SIZE); // toggle 'back'
270 setSize(newfont.size());
273 setEmph(setMisc(newfont.emph(), emph()));
274 setUnderbar(setMisc(newfont.underbar(), underbar()));
275 setNoun(setMisc(newfont.noun(), noun()));
276 setLatex(setMisc(newfont.latex(), latex()));
278 if (newfont.language() != ignore_language)
279 if (language() == newfont.language())
280 if (language() == document_language)
281 setLanguage(default_language);
283 setLanguage(document_language);
285 setLanguage(newfont.language());
287 if (newfont.color() == color() && toggleall)
288 setColor(LColor::inherit); // toggle 'back'
289 else if (newfont.color() != LColor::ignore)
290 setColor(newfont.color());
294 /// Reduce font to fall back to template where possible
295 void LyXFont::reduce(LyXFont const & tmplt)
297 if (family() == tmplt.family())
298 setFamily(INHERIT_FAMILY);
299 if (series() == tmplt.series())
300 setSeries(INHERIT_SERIES);
301 if (shape() == tmplt.shape())
302 setShape(INHERIT_SHAPE);
303 if (size() == tmplt.size())
304 setSize(INHERIT_SIZE);
305 if (emph() == tmplt.emph())
307 if (underbar() == tmplt.underbar())
308 setUnderbar(INHERIT);
309 if (noun() == tmplt.noun())
311 if (latex() == tmplt.latex())
313 if (color() == tmplt.color())
314 setColor(LColor::inherit);
318 /// Realize font from a template
319 LyXFont & LyXFont::realize(LyXFont const & tmplt)
321 if (bits == inherit) {
326 if (bits.family == INHERIT_FAMILY) {
327 bits.family = tmplt.bits.family;
329 if (bits.series == INHERIT_SERIES) {
330 bits.series = tmplt.bits.series;
332 if (bits.shape == INHERIT_SHAPE) {
333 bits.shape = tmplt.bits.shape;
335 if (bits.size == INHERIT_SIZE) {
336 bits.size = tmplt.bits.size;
338 if (bits.emph == INHERIT) {
339 bits.emph = tmplt.bits.emph;
341 if (bits.underbar == INHERIT) {
342 bits.underbar = tmplt.bits.underbar;
344 if (bits.noun == INHERIT) {
345 bits.noun = tmplt.bits.noun;
347 if (bits.latex == INHERIT) {
348 bits.latex = tmplt.bits.latex;
350 if (bits.color == LColor::inherit) {
351 bits.color = tmplt.bits.color;
358 /// Is font resolved?
359 bool LyXFont::resolved() const
361 return (family() != INHERIT_FAMILY && series() != INHERIT_SERIES &&
362 shape() != INHERIT_SHAPE && size() != INHERIT_SIZE &&
363 emph() != INHERIT && underbar() != INHERIT &&
364 noun() != INHERIT && latex() != INHERIT &&
365 color() != LColor::inherit);
369 /// Build GUI description of font state
370 string LyXFont::stateText() const
376 ostrstream ost(str, 1024);
378 if (family() != INHERIT_FAMILY)
379 ost << _(GUIFamilyNames[family()]) << ", ";
380 if (series() != INHERIT_SERIES)
381 ost << _(GUISeriesNames[series()]) << ", ";
382 if (shape() != INHERIT_SHAPE)
383 ost << _(GUIShapeNames[shape()]) << ", ";
384 if (size() != INHERIT_SIZE)
385 ost << _(GUISizeNames[size()]) << ", ";
386 if (color() != LColor::inherit)
387 ost << lcolor.getGUIName(color()) << ", ";
388 if (emph() != INHERIT)
389 ost << _("Emphasis ")
390 << _(GUIMiscNames[emph()]) << ", ";
391 if (underbar() != INHERIT)
392 ost << _("Underline ")
393 << _(GUIMiscNames[underbar()]) << ", ";
394 if (noun() != INHERIT)
395 ost << _("Noun ") << _(GUIMiscNames[noun()]) << ", ";
396 if (latex() != INHERIT)
397 ost << _("Latex ") << _(GUIMiscNames[latex()]) << ", ";
399 // ost << _("Default");
400 unsigned int opos = ost.tellp();
401 lyxerr << "Opos: " << opos << endl;
403 ost << _("Default") << ", ";
404 ost << _("Language: ") << _(language()->display.c_str());
406 string buf(ost.str().c_str());
409 string buf(ost.str());
411 buf = strip(buf, ' ');
412 buf = strip(buf, ',');
417 // Set family according to lyx format string
418 LyXFont & LyXFont::setLyXFamily(string const & fam)
420 string s = lowercase(fam);
423 while (s != LyXFamilyNames[i] && LyXFamilyNames[i] != "error") ++i;
424 if (s == LyXFamilyNames[i]) {
425 setFamily(LyXFont::FONT_FAMILY(i));
427 lyxerr << "LyXFont::setLyXFamily: Unknown family `"
428 << s << '\'' << endl;
433 // Set series according to lyx format string
434 LyXFont & LyXFont::setLyXSeries(string const & ser)
436 string s = lowercase(ser);
439 while (s != LyXSeriesNames[i] && LyXSeriesNames[i] != "error") ++i;
440 if (s == LyXSeriesNames[i]) {
441 setSeries(LyXFont::FONT_SERIES(i));
443 lyxerr << "LyXFont::setLyXSeries: Unknown series `"
444 << s << '\'' << endl;
449 // Set shape according to lyx format string
450 LyXFont & LyXFont::setLyXShape(string const & sha)
452 string s = lowercase(sha);
455 while (s != LyXShapeNames[i] && LyXShapeNames[i] != "error") ++i;
456 if (s == LyXShapeNames[i]) {
457 setShape(LyXFont::FONT_SHAPE(i));
459 lyxerr << "LyXFont::setLyXShape: Unknown shape `"
460 << s << '\'' << endl;
465 // Set size according to lyx format string
466 LyXFont & LyXFont::setLyXSize(string const & siz)
468 string s = lowercase(siz);
470 while (s != LyXSizeNames[i] && LyXSizeNames[i] != "error") ++i;
471 if (s == LyXSizeNames[i]) {
472 setSize(LyXFont::FONT_SIZE(i));
474 lyxerr << "LyXFont::setLyXSize: Unknown size `"
475 << s << '\'' << endl;
479 // Set size according to lyx format string
480 LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz)
482 string s = lowercase(siz);
484 while (s != LyXMiscNames[i] && LyXMiscNames[i] != "error") ++i;
485 if (s == LyXMiscNames[i])
486 return FONT_MISC_STATE(i);
487 lyxerr << "LyXFont::setLyXMisc: Unknown misc flag `"
488 << s << '\'' << endl;
492 /// Sets color after LyX text format
493 LyXFont & LyXFont::setLyXColor(string const & col)
495 setColor(lcolor.getFromLyXName(col));
500 /// Sets size after GUI name
501 LyXFont & LyXFont::setGUISize(string const & siz)
503 #warning this might be wrong.
505 // this is how it was how it was done in the lyx repository...
506 // but this does not make sense.
507 setColor(lcolor.getFromGUIName(siz));
512 // Returns size in latex format
513 string LyXFont::latexSize() const
515 return LaTeXSizeNames[size()];
519 // Read a font definition from given file in lyx format
521 LyXFont & LyXFont::lyxRead(LyXLex & lex)
524 bool finished = false;
525 while (!finished && lex.IsOK() && !error) {
527 string tok = lowercase(lex.GetString());
531 } else if (tok == "endfont") {
533 } else if (tok == "family") {
535 string tok = lex.GetString();
537 } else if (tok == "series") {
539 string tok = lex.GetString();
541 } else if (tok == "shape") {
543 string tok = lex.GetString();
545 } else if (tok == "size") {
547 string tok = lex.GetString();
549 } else if (tok == "latex") {
551 string tok = lowercase(lex.GetString());
553 if (tok == "no_latex") {
555 } else if (tok == "latex") {
558 lex.printError("Illegal LaTeX type`$$Token'");
560 } else if (tok == "misc") {
562 string tok = lowercase(lex.GetString());
564 if (tok == "no_bar") {
566 } else if (tok == "no_emph") {
568 } else if (tok == "no_noun") {
570 } else if (tok == "emph") {
572 } else if (tok == "underbar") {
574 } else if (tok == "noun") {
577 lex.printError("Illegal misc type `$$Token´");
579 } else if (tok == "color") {
581 string tok = lex.GetString();
584 lex.printError("Unknown tag `$$Token'");
592 /// Writes the changes from this font to orgfont in .lyx format in file
593 void LyXFont::lyxWriteChanges(LyXFont const & orgfont, ostream & os) const
596 if (orgfont.family() != family()) {
597 os << "\\family " << LyXFamilyNames[family()] << " \n";
599 if (orgfont.series() != series()) {
600 os << "\\series " << LyXSeriesNames[series()] << " \n";
602 if (orgfont.shape() != shape()) {
603 os << "\\shape " << LyXShapeNames[shape()] << " \n";
605 if (orgfont.size() != size()) {
606 os << "\\size " << LyXSizeNames[size()] << " \n";
608 if (orgfont.emph() != emph()) {
609 os << "\\emph " << LyXMiscNames[emph()] << " \n";
611 if (orgfont.underbar() != underbar()) {
612 // This is only for backwards compatibility
613 switch (underbar()) {
614 case OFF: os << "\\bar no \n"; break;
615 case ON: os << "\\bar under \n"; break;
616 case TOGGLE: lyxerr << "LyXFont::lyxWriteFontChanges: "
617 "TOGGLE should not appear here!"
620 case INHERIT: os << "\\bar default \n"; break;
621 case IGNORE: lyxerr << "LyXFont::lyxWriteFontChanges: "
622 "IGNORE should not appear here!"
627 if (orgfont.noun() != noun()) {
628 os << "\\noun " << LyXMiscNames[noun()] << " \n";
630 if (orgfont.latex() != latex()) {
631 // This is only for backwards compatibility
633 case OFF: os << "\\latex no_latex \n"; break;
634 case ON: os << "\\latex latex \n"; break;
635 case TOGGLE: lyxerr << "LyXFont::lyxWriteFontChanges: "
636 "TOGGLE should not appear here!"
639 case INHERIT: os << "\\latex default \n"; break;
640 case IGNORE: lyxerr << "LyXFont::lyxWriteFontChanges: "
641 "IGNORE should not appear here!"
646 if (orgfont.color() != color()) {
647 os << "\\color " << lcolor.getLyXName(color()) << "\n";
649 if (orgfont.language() != language()) {
651 os << "\\lang " << language()->lang << "\n";
653 os << "\\lang unknown\n";
658 /// Writes the head of the LaTeX needed to impose this font
659 // Returns number of chars written.
660 int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base,
661 LyXFont const & prev) const
666 if (language() != base.language() && language() != prev.language()) {
667 if (isRightToLeft() != prev.isRightToLeft()) {
668 if (isRightToLeft()) {
671 env = true; //We have opened a new environment
675 env = true; //We have opened a new environment
679 subst(lyxrc.language_command_begin,
680 "$$lang", language()->lang);
682 count += tmp.length();
683 env = true; //We have opened a new environment
690 if (f.family() != INHERIT_FAMILY) {
692 << LaTeXFamilyNames[f.family()]
694 count += strlen(LaTeXFamilyNames[f.family()]) + 2;
695 env = true; //We have opened a new environment
697 if (f.series() != INHERIT_SERIES) {
699 << LaTeXSeriesNames[f.series()]
701 count += strlen(LaTeXSeriesNames[f.series()]) + 2;
702 env = true; //We have opened a new environment
704 if (f.shape() != INHERIT_SHAPE) {
706 << LaTeXShapeNames[f.shape()]
708 count += strlen(LaTeXShapeNames[f.shape()]) + 2;
709 env = true; //We have opened a new environment
711 if (f.color() != LColor::inherit) {
713 << lcolor.getLaTeXName(f.color())
715 count += lcolor.getLaTeXName(f.color()).length() + 13;
716 env = true; //We have opened a new environment
718 if (f.emph() == ON) {
721 env = true; //We have opened a new environment
723 if (f.underbar() == ON) {
726 env = true; //We have opened a new environment
728 // \noun{} is a LyX special macro
729 if (f.noun() == ON) {
732 env = true; //We have opened a new environment
734 if (f.size() != INHERIT_SIZE) {
735 // If we didn't open an environment above, we open one here
741 << LaTeXSizeNames[f.size()]
743 count += strlen(LaTeXSizeNames[f.size()]) + 2;
749 /// Writes ending block of LaTeX needed to close use of this font
750 // Returns number of chars written
751 // This one corresponds to latexWriteStartChanges(). (Asger)
752 int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base,
753 LyXFont const & next) const
758 if (language() != base.language() && language() != next.language()) {
761 env = true; // Size change need not bother about closing env.
764 LyXFont f = *this; // why do you need this?
765 f.reduce(base); // why isn't this just "reduce(base);" (Lgb)
766 // Because this function is const. Everything breaks if this
767 // method changes the font it represents. There is no speed penalty
768 // by using the temporary. (Asger)
770 if (f.family() != INHERIT_FAMILY) {
773 env = true; // Size change need not bother about closing env.
775 if (f.series() != INHERIT_SERIES) {
778 env = true; // Size change need not bother about closing env.
780 if (f.shape() != INHERIT_SHAPE) {
783 env = true; // Size change need not bother about closing env.
785 if (f.color() != LColor::inherit) {
788 env = true; // Size change need not bother about closing env.
790 if (f.emph() == ON) {
793 env = true; // Size change need not bother about closing env.
795 if (f.underbar() == ON) {
798 env = true; // Size change need not bother about closing env.
800 if (f.noun() == ON) {
803 env = true; // Size change need not bother about closing env.
805 if (f.size() != INHERIT_SIZE) {
806 // We only have to close if only size changed
817 LColor::color LyXFont::realColor() const
820 return LColor::latex;
821 if (color() == LColor::none)
822 return LColor::foreground;
827 // Convert logical attributes to concrete shape attribute
828 LyXFont::FONT_SHAPE LyXFont::realShape() const
830 register FONT_SHAPE s = shape();
844 XFontStruct * LyXFont::getXFontstruct() const
846 return fontloader.load(family(), series(), realShape(), size());
850 int LyXFont::maxAscent() const
852 return getXFontstruct()->ascent;
856 int LyXFont::maxDescent() const
858 return getXFontstruct()->descent;
862 int LyXFont::ascent(char c) const
864 XFontStruct * finfo = getXFontstruct();
865 unsigned int uc = static_cast<unsigned char>(c);
867 && uc >= finfo->min_char_or_byte2
868 && uc <= finfo->max_char_or_byte2)
869 return finfo->per_char[uc - finfo->min_char_or_byte2].ascent;
871 return finfo->ascent;
875 int LyXFont::descent(char c) const
877 XFontStruct * finfo = getXFontstruct();
878 unsigned int uc = static_cast<unsigned char>(c);
880 && uc >= finfo->min_char_or_byte2
881 && uc <= finfo->max_char_or_byte2)
882 return finfo->per_char[uc - finfo->min_char_or_byte2].descent;
884 return finfo->descent;
888 int LyXFont::lbearing(char c) const
890 XFontStruct * finfo = getXFontstruct();
891 unsigned int uc = static_cast<unsigned char>(c);
893 && uc >= finfo->min_char_or_byte2
894 && uc <= finfo->max_char_or_byte2)
895 return finfo->per_char[uc - finfo->min_char_or_byte2].lbearing;
901 int LyXFont::rbearing(char c) const
903 XFontStruct * finfo = getXFontstruct();
904 unsigned int uc = static_cast<unsigned char>(c);
906 && uc >= finfo->min_char_or_byte2
907 && uc <= finfo->max_char_or_byte2)
908 return finfo->per_char[uc - finfo->min_char_or_byte2].rbearing;
914 // Specialized after profiling. (Asger)
915 int LyXFont::width(char c) const
917 if (realShape() != LyXFont::SMALLCAPS_SHAPE){
918 return lyxrc.use_gui ? XTextWidth(getXFontstruct(), &c, 1) : 1;
920 return textWidth(&c, 1);
925 int LyXFont::textWidth(char const * s, int n) const
930 if (realShape() != LyXFont::SMALLCAPS_SHAPE){
931 return XTextWidth(getXFontstruct(), s, n);
933 // emulate smallcaps since X doesn't support this
934 unsigned int result = 0;
936 LyXFont smallfont = *this;
939 smallfont.setShape(LyXFont::UP_SHAPE);
940 for (int i = 0; i < n; ++i) {
942 // when islower is a macro, the cast is needed (JMarc)
943 if (islower(static_cast<unsigned char>(c))){
945 result += XTextWidth(smallfont.getXFontstruct(), &c, 1);
947 result += XTextWidth(getXFontstruct(), &c, 1);
955 int LyXFont::stringWidth(string const & s) const
957 if (s.empty()) return 0;
958 return textWidth(s.c_str(), s.length());
962 int LyXFont::signedStringWidth(string const & s) const
964 if (s.empty()) return 0;
965 if (s.c_str()[0] == '-')
966 return -textWidth(s.c_str()+1, s.length()-1);
968 return textWidth(s.c_str(), s.length());
972 int LyXFont::drawText(char const * s, int n, Pixmap,
975 if (realShape() != LyXFont::SMALLCAPS_SHAPE) {
976 return XTextWidth(getXFontstruct(), s, n);
978 // emulate smallcaps since X doesn't support this
981 LyXFont smallfont = *this;
984 smallfont.setShape(LyXFont::UP_SHAPE);
985 for (int i = 0; i < n; ++i) {
987 if (islower(static_cast<unsigned char>(c))){
989 x += XTextWidth(smallfont.getXFontstruct(),
992 x += XTextWidth(getXFontstruct(), &c, 1);
1000 int LyXFont::drawString(string const & s, Pixmap pm, int baseline, int x) const
1002 return drawText(s.c_str(), s.length(), pm, baseline, x);
1006 bool LyXFont::equalExceptLatex(LyXFont const & f) const
1009 f1.setLatex(f.latex());
1014 ostream & operator<<(ostream & o, LyXFont::FONT_MISC_STATE fms)
1016 return o << int(fms);