]> git.lyx.org Git - lyx.git/blobdiff - src/font.C
small changes to ButtonController usage
[lyx.git] / src / font.C
index c17c8da8f8bbecfde85a835eca884a7dba7010c0..462241db9675eb7b1cb70853e239be2986f36f19 100644 (file)
@@ -1,5 +1,19 @@
+/* This file is part of
+ * ====================================================== 
+ * 
+ *           LyX, The Document Processor
+ *        
+ *           Copyright 1995 Matthias Ettrich
+ *           Copyright 1995-2000 The LyX Team.
+ *
+ * ====================================================== */
+
 #include <config.h>
 
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
 #include <cctype>
 
 #include "font.h"
@@ -94,13 +108,23 @@ int lyxfont::width(char const * s, int n, LyXFont const & f)
 
        if (lyxrc.font_norm_type == LyXRC::ISO_10646_1) {
                XChar2b * xs = new XChar2b[n];
-               Encoding const * enc = f.language()->encoding();
+               Encoding const * encoding = f.language()->encoding();
+               LyXFont const * font = &f; 
+               if (f.family() == LyXFont::SYMBOL_FAMILY) {
+#ifdef USE_UNICODE_FOR_SYMBOLS
+                       LyXFont font2 = f;
+                       font2.setFamily(LyXFont::ROMAN_FAMILY);
+                       font2.setShape(LyXFont::UP_SHAPE);
+                       font = &font2;
+#endif
+                       encoding = &symbol_encoding;
+               }
                for (int i = 0; i < n; ++i) {
-                       Uchar c = enc->ucs(s[i]);
+                       Uchar c = encoding->ucs(s[i]);
                        xs[i].byte1 = c >> 8;
                        xs[i].byte2 = c & 0xff;
                 }
-               int result = width(xs, n, f);
+               int result = width(xs, n, *font);
                delete[] xs;
                return result;
        }