+static FontState getBar(FontInfo const & fi)
+{
+ if (fi.emph() == FONT_TOGGLE)
+ return EMPH_TOGGLE;
+
+ if (fi.underbar() == FONT_TOGGLE)
+ return UNDERBAR_TOGGLE;
+
+ if (fi.strikeout() == FONT_TOGGLE)
+ return STRIKEOUT_TOGGLE;
+
+ if (fi.uuline() == FONT_TOGGLE)
+ return UULINE_TOGGLE;
+
+ if (fi.uwave() == FONT_TOGGLE)
+ return UWAVE_TOGGLE;
+
+ if (fi.noun() == FONT_TOGGLE)
+ return NOUN_TOGGLE;
+
+ if (fi.emph() == FONT_IGNORE
+ && fi.underbar() == FONT_IGNORE
+ && fi.noun() == FONT_IGNORE)
+ return IGNORE;
+
+ return INHERIT;
+}
+
+
+static void setBar(FontInfo & fi, FontState val)
+{
+ switch (val) {
+ case IGNORE:
+ fi.setEmph(FONT_IGNORE);
+ fi.setUnderbar(FONT_IGNORE);
+ fi.setStrikeout(FONT_IGNORE);
+ fi.setNoun(FONT_IGNORE);
+ break;
+
+ case EMPH_TOGGLE:
+ fi.setEmph(FONT_TOGGLE);
+ break;
+
+ case UNDERBAR_TOGGLE:
+ fi.setUnderbar(FONT_TOGGLE);
+ break;
+
+ case STRIKEOUT_TOGGLE:
+ fi.setStrikeout(FONT_TOGGLE);
+ break;
+
+ case UULINE_TOGGLE:
+ fi.setUuline(FONT_TOGGLE);
+ break;
+
+ case UWAVE_TOGGLE:
+ fi.setUwave(FONT_TOGGLE);
+ break;
+
+ case NOUN_TOGGLE:
+ fi.setNoun(FONT_TOGGLE);
+ break;
+
+ case INHERIT:
+ fi.setEmph(FONT_INHERIT);
+ fi.setUnderbar(FONT_INHERIT);
+ fi.setStrikeout(FONT_INHERIT);
+ fi.setUuline(FONT_INHERIT);
+ fi.setUwave(FONT_INHERIT);
+ fi.setNoun(FONT_INHERIT);
+ break;
+ }
+}
+
+
+void GuiCharacter::paramsToDialog(Font const & font)
+{
+ FontInfo const & fi = font.fontInfo();
+ familyCO->setCurrentIndex(findPos2nd(family, fi.family()));
+ seriesCO->setCurrentIndex(findPos2nd(series, fi.series()));
+ shapeCO->setCurrentIndex(findPos2nd(shape, fi.shape()));
+ sizeCO->setCurrentIndex(findPos2nd(size, fi.size()));
+ miscCO->setCurrentIndex(findPos2nd(bar, getBar(fi)));
+ colorCO->setCurrentIndex(findPos2nd(color, fi.color()));
+
+ // reset_language is a null pointer.
+ QString const lang = (font.language() == reset_language)
+ ? "reset" : toqstr(font.language()->lang());
+ langCO->setCurrentIndex(findPos2nd(language, lang));
+
+ toggleallCB->setChecked(toggleall_);