]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
Remove hardcoded values
[lyx.git] / src / Cursor.cpp
index 6f393e3799b7242f0b8c41e48195dc4ec639e80e..e2d1f893ae120d986073905fe3ef217c38b02192 100644 (file)
@@ -15,6 +15,7 @@
 #include <config.h>
 
 #include "Buffer.h"
+#include "BufferParams.h"
 #include "BufferView.h"
 #include "CoordCache.h"
 #include "Cursor.h"
@@ -2066,10 +2067,14 @@ Encoding const * Cursor::getEncoding() const
 {
        if (empty())
                return 0;
+       BufferParams const & bp = bv().buffer().params();
+       if (bp.useNonTeXFonts)
+               return encodings.fromLyXName("utf8-plain");
+
        CursorSlice const & sl = innerTextSlice();
        Text const & text = *sl.text();
-       Font font = text.getPar(sl.pit()).getFont(
-               bv().buffer().params(), sl.pos(), text.outerFont(sl.pit()));
+       Font font = text.getPar(sl.pit()).getFont(bp, sl.pos(),
+                                                 text.outerFont(sl.pit()));
        return font.language()->encoding();
 }
 
@@ -2121,6 +2126,7 @@ Font Cursor::getFont() const
        // The logic here should more or less match to the
        // Cursor::setCurrentFont logic, i.e. the cursor height should
        // give a hint what will happen if a character is entered.
+       // FIXME: this is not the case, what about removing this method ? (see #10478).
 
        // HACK. far from being perfect...