]> git.lyx.org Git - lyx.git/blobdiff - src/Font.h
Fix bug #12772
[lyx.git] / src / Font.h
index 97d403627ecd1087ada19c1e54b155946d7974da..b59f015eca7d9318deb5ec513f6755681c45e453 100644 (file)
 #ifndef FONT_H
 #define FONT_H
 
-#ifdef TEX2LYX
-#include "tex2lyx/Font.h"
-#else
-
-#include "ColorCode.h"
 #include "FontInfo.h"
 
 #include "support/strfwd.h"
 
 namespace lyx {
 
-class Lexer;
 class BufferParams;
 class Language;
 class LaTeXFeatures;
 class OutputParams;
+class otexstream;
 
 ///
 class Font {
 
 public:
        ///
-       explicit Font(FontInfo = sane_font, Language const * l = 0);
+       explicit Font(FontInfo = sane_font, Language const * l = nullptr);
 
        ///
        FontInfo & fontInfo() { return bits_; }
@@ -47,20 +42,12 @@ public:
        ///
        Language const * language() const { return lang_; }
        ///
-       void setMisspelled(bool misspelled) { misspelled_ = misspelled; }
-       ///
-       bool isMisspelled() const { return misspelled_; }
-       ///
        bool isRightToLeft() const;
        ///
        bool isVisibleRightToLeft() const;
        ///
        void setLanguage(Language const * l);
 
-       /// Returns misc flag after LyX text format
-       FontState setLyXMisc(std::string const &);
-
-
        /// Returns size of font in LaTeX text notation
        std::string const latexSize() const;
 
@@ -85,24 +72,27 @@ public:
            to this font. Returns number of chars written. Base is the
            font state active now.
        */
-       int latexWriteStartChanges(odocstream &, BufferParams const & bparams,
+       int latexWriteStartChanges(otexstream &, BufferParams const & bparams,
                                   OutputParams const & runparams,
                                   Font const & base,
-                                  Font const & prev) const;
+                                  Font const & prev,
+                                  bool non_inherit_inset = false,
+                                  bool needs_cprotection = false) const;
 
        /** Writes the tail of the LaTeX needed to change to this font.
            Returns number of chars written. Base is the font state we want
            to achieve.
        */
-       int latexWriteEndChanges(odocstream &, BufferParams const & bparams,
+       int latexWriteEndChanges(otexstream &, BufferParams const & bparams,
                                 OutputParams const & runparams,
                                 Font const & base,
                                 Font const & next,
-                                bool const & closeLanguage = true) const;
+                                bool & needPar,
+                                bool closeLanguage = true) const;
 
 
        /// Build GUI description of font state
-       docstring const stateText(BufferParams * params) const;
+       docstring const stateText(BufferParams * params = nullptr, bool const terse = false) const;
 
        ///
        void validate(LaTeXFeatures & features) const;
@@ -125,20 +115,19 @@ private:
        FontInfo bits_;
        ///
        Language const * lang_;
-       ///
-       bool misspelled_;
-
        /// Did latexWriteStartChanges open an encoding environment?
        mutable bool open_encoding_;
 };
 
+///
+std::ostream & operator<<(std::ostream & os, FontInfo const & f);
+
 
 ///
 inline
 bool operator==(Font const & font1, Font const & font2)
 {
-       return font1.bits_ == font2.bits_ && font1.lang_ == font2.lang_
-           && font1.misspelled_ == font2.misspelled_;
+       return font1.bits_ == font2.bits_ && font1.lang_ == font2.lang_;
 }
 
 ///
@@ -148,31 +137,6 @@ bool operator!=(Font const & font1, Font const & font2)
        return !(font1 == font2);
 }
 
-/** Returns the current freefont, encoded as a std::string to be passed to the
- *  frontends. Implemented in Text3.cpp.
- */
-std::string const freefont2string();
-
-
-/// Set family after LyX text format
-void setLyXFamily(std::string const &, FontInfo &);
-
-/// Set series after LyX text format
-void setLyXSeries(std::string const &, FontInfo &);
-
-/// Set shape after LyX text format
-void setLyXShape(std::string const &, FontInfo &);
-
-/// Set size after LyX text format
-void setLyXSize(std::string const &, FontInfo &);
-
-/// Sets color after LyX text format
-void setLyXColor(std::string const &, FontInfo &);
-
-/// Read a font specification from Lexer. Used for layout files.
-FontInfo lyxRead(Lexer &, FontInfo const & fi = sane_font);
-
 } // namespace lyx
 
-#endif // TEX2LYX
 #endif