+//int lyxfont::width(wstring const & s, int n, LyXFont const & f)
+int lyxfont::width(XChar2b const * s, int n, LyXFont const & f)
+{
+ if (!lyxrc.use_gui)
+ return n;
+
+ if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
+ return ::XTextWidth16(getXFontstruct(f), s, n);
+ } else {
+ // emulate smallcaps since X doesn't support this
+ unsigned int result = 0;
+ static XChar2b c = {0, 0};
+ LyXFont smallfont(f);
+ smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
+ for (int i = 0; i < n; ++i) {
+ if (s[i].byte1 == 0 && islower(s[i].byte2)) {
+ c.byte2 = toupper(s[i].byte2);
+ result += ::XTextWidth16(getXFontstruct(smallfont), &c, 1);
+ } else {
+ result += ::XTextWidth16(getXFontstruct(f), &s[i], 1);
+ }
+ }
+ return result;
+ }
+}
+
+int lyxfont::XTextWidth(LyXFont const & f, char const * str, int count)