2 * \file InsetQuotes.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Jean-Marc Lasgouttes
7 * \author Jürgen Spitzmüller
9 * Full author contact details are available in file CREDITS.
14 #include "InsetQuotes.h"
17 #include "BufferParams.h"
18 #include "BufferView.h"
20 #include "Dimension.h"
23 #include "FuncStatus.h"
24 #include "FuncRequest.h"
26 #include "LaTeXFeatures.h"
29 #include "MetricsInfo.h"
30 #include "OutputParams.h"
31 #include "output_xhtml.h"
32 #include "Paragraph.h"
33 #include "ParIterator.h"
34 #include "texstream.h"
36 #include "frontends/FontMetrics.h"
37 #include "frontends/Painter.h"
39 #include "support/debug.h"
40 #include "support/docstring.h"
41 #include "support/docstream.h"
42 #include "support/gettext.h"
43 #include "support/lstrings.h"
44 #include "support/textutils.h"
49 using namespace lyx::support;
55 /* codes used to read/write quotes to LyX files
57 * e ``english'' (`inner quotation')
58 * s ''swedish'' ('inner quotation')
59 * g ,,german`` (,inner quotation`)
60 * p ,,polish'' (,inner quotation')
61 * c <<swiss>> (<inner quotation>)
62 * a >>danish<< (>inner quotation<)
63 * q "plain" ('inner quotation')
64 * b `british' (``inner quotation'')
65 * w >>swedishg>> ('inner quotation') ["g" = Guillemets]
66 * f <<french>> (``inner quotation'')
67 * i <<frenchin>> (<<inner quotation>>) ["in" = Imprimerie Nationale]
68 * r <<russian>> (,,inner quotation``)
69 * j [U+300C]cjk[U+300D] ([U+300E]inner quotation[U+300F]) [CORNER BRACKETS]
70 * k [U+300A]cjkangle[U+300B] ([U+3008]inner quotation[U+3009]) [ANGLE BRACKETS]
71 * x dynamic style (inherits document settings)
74 char const * const style_char = "esgpcaqbwfirjkx";
75 char const * const side_char = "lr" ;
76 char const * const level_char = "sd";
81 /////////////////////////////////////////////////////////////////////
85 ///////////////////////////////////////////////////////////////////////
87 InsetQuotesParams quoteparams;
90 int InsetQuotesParams::stylescount() const
92 return strlen(style_char);
96 char InsetQuotesParams::getStyleChar(QuoteStyle const & style) const
98 return style_char[style];
102 InsetQuotesParams::QuoteStyle InsetQuotesParams::getQuoteStyle(string const & s,
103 bool const allow_wildcards, QuoteStyle fb)
108 if (str.length() != 3) {
109 LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
110 " bad string length.");
116 // '.' wildcard means: keep current style
117 if (!allow_wildcards || str[0] != '.') {
118 for (i = 0; i < stylescount(); ++i) {
119 if (str[0] == style_char[i]) {
124 if (i >= stylescount()) {
125 LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
126 " bad style specification.");
135 InsetQuotesParams::QuoteSide InsetQuotesParams::getQuoteSide(string const & s,
136 bool const allow_wildcards, QuoteSide fb)
141 if (str.length() != 3) {
142 LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
143 " bad string length.");
149 // '.' wildcard means: keep current side
150 if (!allow_wildcards || str[1] != '.') {
151 for (i = 0; i < 2; ++i) {
152 if (str[1] == side_char[i]) {
153 res = InsetQuotesParams::QuoteSide(i);
158 LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
159 " bad side specification.");
168 InsetQuotesParams::QuoteLevel InsetQuotesParams::getQuoteLevel(string const & s,
169 bool const allow_wildcards, QuoteLevel fb)
174 if (str.length() != 3) {
175 LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
176 " bad string length.");
182 // '.' wildcard means: keep current level
183 if (!allow_wildcards || str[2] != '.') {
184 for (i = 0; i < 2; ++i) {
185 if (str[2] == level_char[i]) {
186 res = InsetQuotesParams::QuoteLevel(i);
191 LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
192 " bad level specification.");
193 res = InsetQuotesParams::PrimaryQuotes;
201 char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel const & level,
202 QuoteSide const & side) const
204 // main opening quotation mark
205 char_type left_primary;
206 // main closing quotation mark
207 char_type right_primary;
208 // secondary (inner, 'single') opening quotation mark
209 char_type left_secondary;
210 // secondary (inner, 'single') closing quotation mark
211 char_type right_secondary;
214 case EnglishQuotes: {
215 left_primary = 0x201c; // ``
216 right_primary = 0x201d; // ''
217 left_secondary = 0x2018; // `
218 right_secondary = 0x2019; // '
221 case SwedishQuotes: {
222 left_primary = 0x201d; // ''
223 right_primary = 0x201d; // ''
224 left_secondary = 0x2019; // '
225 right_secondary = 0x2019; // '
229 left_primary = 0x201e; // ,,
230 right_primary = 0x201c; // ``
231 left_secondary = 0x201a; // ,
232 right_secondary = 0x2018; // `
236 left_primary = 0x201e; // ,,
237 right_primary = 0x201d; // ''
238 left_secondary = 0x201a; // ,
239 right_secondary = 0x2019; // '
243 left_primary = 0x00ab; // <<
244 right_primary = 0x00bb; // >>
245 left_secondary = 0x2039; // <
246 right_secondary = 0x203a; // >
250 left_primary = 0x00bb; // >>
251 right_primary = 0x00ab; // <<
252 left_secondary = 0x203a; // >
253 right_secondary = 0x2039; // <
257 left_primary = 0x0022; // "
258 right_primary = 0x0022; // "
259 left_secondary = 0x0027; // '
260 right_secondary = 0x0027; // '
263 case BritishQuotes: {
264 left_primary = 0x2018; // `
265 right_primary = 0x2019; // '
266 left_secondary = 0x201c; // ``
267 right_secondary = 0x201d; // ''
270 case SwedishGQuotes: {
271 left_primary = 0x00bb; // >>
272 right_primary = 0x00bb; // >>
273 left_secondary = 0x2019; // '
274 right_secondary = 0x2019; // '
278 left_primary = 0x00ab; // <<
279 right_primary = 0x00bb; // >>
280 left_secondary = 0x201c; // ``
281 right_secondary = 0x201d; // ''
284 case FrenchINQuotes:{
285 left_primary = 0x00ab; // <<
286 right_primary = 0x00bb; // >>
287 left_secondary = 0x00ab; // <<
288 right_secondary = 0x00bb; // >>
292 left_primary = 0x00ab; // <<
293 right_primary = 0x00bb; // >>
294 left_secondary = 0x201e; // ,,
295 right_secondary = 0x201c; // ``
299 left_primary = 0x300c; // LEFT CORNER BRACKET
300 right_primary = 0x300d; // RIGHT CORNER BRACKET
301 left_secondary = 0x300e; // LEFT WHITE CORNER BRACKET
302 right_secondary = 0x300f; // RIGHT WHITE CORNER BRACKET
305 case CJKAngleQuotes:{
306 left_primary = 0x300a; // LEFT DOUBLE ANGLE BRACKET
307 right_primary = 0x300b; // RIGHT DOUBLE ANGLE BRACKET
308 left_secondary = 0x3008; // LEFT ANGLE BRACKET
309 right_secondary = 0x3009; // RIGHT ANGLE BRACKET
315 left_primary = 0x003f; // ?
316 right_primary = 0x003f; // ?
317 left_secondary = 0x003f; // ?
318 right_secondary = 0x003f; // ?
323 case SecondaryQuotes:
324 return (side == OpeningQuote) ? left_secondary : right_secondary;
326 return (side == OpeningQuote) ? left_primary : right_primary;
336 docstring InsetQuotesParams::getLaTeXQuote(char_type c, string const & op) const
345 res = "\\quotesinglbase";
350 res = "\\textquoteleft";
357 res = "\\textquoteright";
366 res = "\\guilsinglleft";
373 res = "\\guilsinglright";
376 case 0x0027: {// ' (plain)
378 res = "\\textquotesingle";
386 else if (op == "babel")
389 res = "\\quotedblbase";
394 res = "\\textquotedblleft";
401 res = "\\textquotedblright";
409 else if (op == "babel")
412 res = "\\guillemotleft";
418 else if (op == "babel")
421 res = "\\guillemotright";
426 res = "\\textquotedbl";
431 // The following are fakes
432 // This is just to get something symbolic
433 // in encodings where this chars would not be used ayway
434 case 0x300c: // LEFT CORNER BRACKET
435 res = "\\ensuremath{\\lceil}";
437 case 0x300d: // RIGHT CORNER BRACKET
438 res = "\\ensuremath{\\rfloor}";
440 case 0x300e: // LEFT WHITE CORNER BRACKET
441 res = "\\ensuremath{\\llceil}";
443 case 0x300f: // RIGHT WHITE CORNER BRACKET
444 res = "\\ensuremath{\\rrfloor}";
446 case 0x300a: // LEFT DOUBLE ANGLE BRACKET
447 res = "\\ensuremath{\\langle\\kern-2.5pt\\langle}";
449 case 0x300b: // RIGHT DOUBLE ANGLE BRACKET
450 res = "\\ensuremath{\\rangle\\kern-2.5pt\\rangle}";
452 case 0x3008: // LEFT ANGLE BRACKET
453 res = "\\ensuremath{\\langle}";
455 case 0x3009: // RIGHT ANGLE BRACKET
456 res = "\\ensuremath{\\rangle}";
462 return from_ascii(res);
466 docstring InsetQuotesParams::getHTMLQuote(char_type c) const
486 case 0x0027: // ' (plain)
507 case 0x300c: // LEFT CORNER BRACKET
510 case 0x300d: // RIGHT CORNER BRACKET
513 case 0x300e: // LEFT WHITE CORNER BRACKET
516 case 0x300f: // RIGHT WHITE CORNER BRACKET
519 case 0x300a: // LEFT DOUBLE ANGLE BRACKET
522 case 0x300b: // RIGHT DOUBLE ANGLE BRACKET
525 case 0x3008: // LEFT ANGLE BRACKET
528 case 0x3009: // RIGHT ANGLE BRACKET
535 return from_ascii(res);
539 map<string, docstring> InsetQuotesParams::getTypes() const
541 map<string, docstring> res;
549 // get all quote types
550 for (sty = 0; sty < stylescount(); ++sty) {
551 style = QuoteStyle(sty);
552 if (style == DynamicQuotes)
554 for (sid = 0; sid < 2; ++sid) {
555 side = QuoteSide(sid);
556 for (lev = 0; lev < 2; ++lev) {
557 type += style_char[style];
558 type += side_char[sid];
559 level = QuoteLevel(lev);
560 type += level_char[lev];
561 res[type] = docstring(1, getQuoteChar(style, level, side));
570 docstring const InsetQuotesParams::getGuiLabel(QuoteStyle const & qs, bool langdef)
572 docstring const styledesc =
573 bformat(_("%1$souter%2$s and %3$sinner%4$s[[quotation marks]]"),
574 docstring(1, getQuoteChar(qs, PrimaryQuotes, OpeningQuote)),
575 docstring(1, getQuoteChar(qs, PrimaryQuotes, ClosingQuote)),
576 docstring(1, getQuoteChar(qs, SecondaryQuotes, OpeningQuote)),
577 docstring(1, getQuoteChar(qs, SecondaryQuotes, ClosingQuote))
583 return bformat(_("%1$s[[quot. mark description]] (language default)"),
588 docstring const InsetQuotesParams::getShortGuiLabel(docstring const string)
590 std::string const s = to_ascii(string);
591 QuoteStyle const style = getQuoteStyle(s);
592 QuoteSide const side = getQuoteSide(s);
593 QuoteLevel const level = getQuoteLevel(s);
595 return (side == OpeningQuote) ?
596 bformat(_("%1$stext"),
597 docstring(1, getQuoteChar(style, level, side))) :
598 bformat(_("text%1$s"),
599 docstring(1, getQuoteChar(style, level, side)));
603 /////////////////////////////////////////////////////////////////////
607 ///////////////////////////////////////////////////////////////////////
609 InsetQuotes::InsetQuotes(Buffer * buf, string const & str) : Inset(buf)
612 global_style_ = buf->masterBuffer()->params().quotes_style;
613 fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
616 global_style_ = InsetQuotesParams::EnglishQuotes;
624 InsetQuotes::InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLevel level,
625 string const & side, string const & style)
626 : Inset(buf), level_(level), pass_thru_(false), fontspec_(false)
628 bool dynamic = false;
630 global_style_ = buf->masterBuffer()->params().quotes_style;
631 fontenc_ = buf->masterBuffer()->params().main_font_encoding();
632 dynamic = buf->masterBuffer()->params().dynamic_quotes;
633 fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
635 global_style_ = InsetQuotesParams::EnglishQuotes;
636 fontenc_ = lyxrc.fontenc;
640 style_ = dynamic ? InsetQuotesParams::DynamicQuotes : global_style_;
642 style_ = getStyle(style);
644 if (side == "left" || side == "opening")
645 side_ = InsetQuotesParams::OpeningQuote;
646 else if (side == "right" || side == "closing")
647 side_ = InsetQuotesParams::ClosingQuote;
653 docstring InsetQuotes::layoutName() const
655 return from_ascii("Quotes");
659 void InsetQuotes::setSide(char_type c)
661 // Decide whether opening or closing quote
662 if (lyx::isSpace(c) || isOpenPunctuation(c))
663 side_ = InsetQuotesParams::OpeningQuote;// opening quote
665 side_ = InsetQuotesParams::ClosingQuote;// closing quote
669 void InsetQuotes::parseString(string const & s, bool const allow_wildcards)
671 style_ = quoteparams.getQuoteStyle(s, allow_wildcards, style_);
672 side_ = quoteparams.getQuoteSide(s, allow_wildcards, side_);
673 level_ = quoteparams.getQuoteLevel(s, allow_wildcards, level_);
677 InsetQuotesParams::QuoteStyle InsetQuotes::getStyle(string const & s)
679 InsetQuotesParams::QuoteStyle qs = InsetQuotesParams::EnglishQuotes;
682 qs = InsetQuotesParams::EnglishQuotes;
683 else if (s == "swedish")
684 qs = InsetQuotesParams::SwedishQuotes;
685 else if (s == "german")
686 qs = InsetQuotesParams::GermanQuotes;
687 else if (s == "polish")
688 qs = InsetQuotesParams::PolishQuotes;
689 else if (s == "swiss")
690 qs = InsetQuotesParams::SwissQuotes;
691 else if (s == "danish")
692 qs = InsetQuotesParams::DanishQuotes;
693 else if (s == "plain")
694 qs = InsetQuotesParams::PlainQuotes;
695 else if (s == "british")
696 qs = InsetQuotesParams::BritishQuotes;
697 else if (s == "swedishg")
698 qs = InsetQuotesParams::SwedishGQuotes;
699 else if (s == "french")
700 qs = InsetQuotesParams::FrenchQuotes;
701 else if (s == "frenchin")
702 qs = InsetQuotesParams::FrenchINQuotes;
703 else if (s == "russian")
704 qs = InsetQuotesParams::RussianQuotes;
706 qs = InsetQuotesParams::CJKQuotes;
707 else if (s == "cjkangle")
708 qs = InsetQuotesParams::CJKAngleQuotes;
709 else if (s == "dynamic")
710 qs = InsetQuotesParams::DynamicQuotes;
716 docstring InsetQuotes::displayString() const
718 // In PassThru, we use straight quotes
720 return (level_ == InsetQuotesParams::PrimaryQuotes) ?
721 from_ascii("\"") : from_ascii("'");
723 InsetQuotesParams::QuoteStyle style =
724 (style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_;
726 docstring retdisp = docstring(1, quoteparams.getQuoteChar(style, level_, side_));
728 // in French, thin spaces are added inside double guillemets
729 if (prefixIs(context_lang_, "fr")
730 && level_ == InsetQuotesParams::PrimaryQuotes
731 && (style == InsetQuotesParams::SwissQuotes
732 || style == InsetQuotesParams::FrenchQuotes
733 || style == InsetQuotesParams::FrenchINQuotes)) {
734 // THIN SPACE (U+2009)
735 char_type const thin_space = 0x2009;
736 if (side_ == InsetQuotesParams::OpeningQuote)
737 retdisp += thin_space;
739 retdisp = thin_space + retdisp;
746 void InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const
748 FontInfo & font = mi.base.font;
749 frontend::FontMetrics const & fm = theFontMetrics(font);
750 dim.asc = fm.maxAscent();
751 dim.des = fm.maxDescent();
752 dim.wid = fm.width(displayString());
756 void InsetQuotes::draw(PainterInfo & pi, int x, int y) const
758 FontInfo font = pi.base.font;
759 if (style_ == InsetQuotesParams::DynamicQuotes)
760 font.setPaintColor(Color_special);
762 font.setPaintColor(pi.textColor(font.realColor()));
763 pi.pain.text(x, y, displayString(), font);
767 string InsetQuotes::getType() const
770 text += style_char[style_];
771 text += side_char[side_];
772 text += level_char[level_];
777 void InsetQuotes::write(ostream & os) const
779 os << "Quotes " << getType();
783 void InsetQuotes::read(Lexer & lex)
785 lex.setContext("InsetQuotes::read");
787 parseString(lex.getString());
788 lex >> "\\end_inset";
792 void InsetQuotes::doDispatch(Cursor & cur, FuncRequest & cmd)
794 switch (cmd.action()) {
795 case LFUN_INSET_MODIFY: {
796 string const first_arg = cmd.getArg(0);
797 bool const change_type = first_arg == "changetype";
800 // this will not be handled higher up
804 cur.recordUndoInset(this);
805 parseString(cmd.getArg(1), true);
806 cur.buffer()->updateBuffer();
810 Inset::doDispatch(cur, cmd);
816 bool InsetQuotes::getStatus(Cursor & cur, FuncRequest const & cmd,
817 FuncStatus & flag) const
819 switch (cmd.action()) {
821 case LFUN_INSET_MODIFY: {
822 string const first_arg = cmd.getArg(0);
823 if (first_arg == "changetype") {
824 string const type = cmd.getArg(1);
825 flag.setOnOff(type == getType());
826 flag.setEnabled(!pass_thru_);
829 return Inset::getStatus(cur, cmd, flag);
833 return Inset::getStatus(cur, cmd, flag);
838 void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
840 InsetQuotesParams::QuoteStyle style =
841 (style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_;
842 char_type quotechar = quoteparams.getQuoteChar(style, level_, side_);
845 // In pass-thru context, we output plain quotes
846 if (runparams.pass_thru)
847 qstr = (level_ == InsetQuotesParams::PrimaryQuotes) ? from_ascii("\"") : from_ascii("'");
848 else if (style == InsetQuotesParams::PlainQuotes && fontspec_) {
849 // For XeTeX and LuaTeX,we need to disable mapping to get straight
850 // quotes. We define our own commands that do this
851 qstr = (level_ == InsetQuotesParams::PrimaryQuotes) ?
852 from_ascii("\\textquotedblplain") : from_ascii("\\textquotesingleplain");
854 else if (runparams.use_polyglossia) {
855 // For polyglossia, we directly output the respective unicode chars
856 // (spacing and kerning is then handled respectively)
857 qstr = docstring(1, quotechar);
859 else if (style == InsetQuotesParams::CJKQuotes || style == InsetQuotesParams::CJKAngleQuotes) {
860 if (runparams.encoding && runparams.encoding->encodable(quotechar))
861 qstr = docstring(1, quotechar);
863 qstr = quoteparams.getLaTeXQuote(quotechar, "int");
865 else if ((style == InsetQuotesParams::SwissQuotes
866 || style == InsetQuotesParams::FrenchQuotes
867 || style == InsetQuotesParams::FrenchINQuotes)
868 && level_ == InsetQuotesParams::PrimaryQuotes
869 && prefixIs(runparams.local_font->language()->code(), "fr")) {
870 // Specific guillemets of French babel
871 // including correct French spacing
872 if (side_ == InsetQuotesParams::OpeningQuote)
873 qstr = from_ascii("\\og");
875 qstr = from_ascii("\\fg");
876 } else if (fontenc_ == "T1"
877 && !runparams.local_font->language()->internalFontEncoding()) {
878 // Quotation marks for T1 font encoding
880 qstr = quoteparams.getLaTeXQuote(quotechar, "t1");
881 } else if (runparams.local_font->language()->internalFontEncoding()) {
882 // Quotation marks for internal font encodings
883 // (ligatures not featured)
884 qstr = quoteparams.getLaTeXQuote(quotechar, "int");
885 #ifdef DO_USE_DEFAULT_LANGUAGE
886 } else if (doclang == "default") {
888 } else if (!runparams.use_babel || runparams.isFullUnicode()) {
890 // Standard quotation mark macros
891 // These are also used by babel
892 // without fontenc (XeTeX/LuaTeX)
893 qstr = quoteparams.getLaTeXQuote(quotechar, "ot1");
895 // Babel shorthand quotation marks (for T1/OT1)
896 qstr = quoteparams.getLaTeXQuote(quotechar, "babel");
899 if (!runparams.pass_thru) {
900 // Guard against unwanted ligatures with preceding text
901 char_type const lastchar = os.lastChar();
902 // !` ?` => !{}` ?{}`
903 if (prefixIs(qstr, from_ascii("`"))
904 && (lastchar == '!' || lastchar == '?'))
906 // ``` ''' ,,, <<< >>>
907 // => `{}`` '{}'' ,{},, <{}<< >{}>>
908 if (contains(from_ascii(",'`<>"), lastchar)
909 && prefixIs(qstr, lastchar))
915 if (prefixIs(qstr, from_ascii("\\")) && !suffixIs(qstr, '}'))
916 // properly terminate the command depending on the context
921 int InsetQuotes::plaintext(odocstringstream & os,
922 OutputParams const &, size_t) const
924 docstring const str = displayString();
930 docstring InsetQuotes::getQuoteEntity() const {
931 InsetQuotesParams::QuoteStyle style =
932 (style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_;
933 docstring res = quoteparams.getHTMLQuote(quoteparams.getQuoteChar(style, level_, side_));
934 // in French, thin spaces are added inside double guillemets
935 if (prefixIs(context_lang_, "fr")
936 && level_ == InsetQuotesParams::PrimaryQuotes
937 && (style == InsetQuotesParams::FrenchQuotes
938 || style == InsetQuotesParams::FrenchINQuotes
939 || style == InsetQuotesParams::SwissQuotes)) {
940 // THIN SPACE (U+2009)
941 docstring const thin_space = from_ascii(" ");
942 if (side_ == InsetQuotesParams::OpeningQuote)
945 res = thin_space + res;
951 int InsetQuotes::docbook(odocstream & os, OutputParams const &) const
953 os << getQuoteEntity();
958 docstring InsetQuotes::xhtml(XHTMLStream & xs, OutputParams const &) const
960 xs << XHTMLStream::ESCAPE_NONE << getQuoteEntity();
965 void InsetQuotes::toString(odocstream & os) const
967 os << displayString();
971 void InsetQuotes::forOutliner(docstring & os, size_t const, bool const) const
973 os += displayString();
977 void InsetQuotes::updateBuffer(ParIterator const & it, UpdateType /* utype*/)
979 BufferParams const & bp = buffer().masterBuffer()->params();
980 pass_thru_ = it.paragraph().isPassThru();
981 context_lang_ = it.paragraph().getFontSettings(bp, it.pos()).language()->code();
982 fontenc_ = bp.main_font_encoding();
983 global_style_ = bp.quotes_style;
984 fontspec_ = bp.useNonTeXFonts;
988 void InsetQuotes::validate(LaTeXFeatures & features) const
990 InsetQuotesParams::QuoteStyle style =
991 (style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_;
992 char_type type = quoteparams.getQuoteChar(style, level_, side_);
994 // Handle characters that are not natively supported by
995 // specific font encodings (we roll our own definitions)
996 #ifdef DO_USE_DEFAULT_LANGUAGE
997 if (features.bufferParams().language->lang() == "default"
999 if (!features.useBabel()
1001 && !features.runparams().isFullUnicode() && fontenc_ != "T1") {
1004 features.require("quotesinglbase");
1007 features.require("guilsinglleft");
1010 features.require("guilsinglright");
1013 features.require("quotedblbase");
1016 features.require("guillemotleft");
1019 features.require("guillemotright");
1025 // Handle straight quotation marks. These need special care
1026 // in most output formats
1029 if (features.runparams().isFullUnicode() && fontspec_)
1030 features.require("textquotesinglep");
1032 features.require("textcomp");
1036 if (features.runparams().isFullUnicode() && fontspec_)
1037 features.require("textquotedblp");
1038 else if (fontenc_ != "T1")
1039 features.require("textquotedbl");
1042 // we fake these from math
1043 case 0x300e: // LEFT WHITE CORNER BRACKET
1044 case 0x300f: // RIGHT WHITE CORNER BRACKET
1045 if (!features.runparams().encoding
1046 || !features.runparams().encoding->encodable(type))
1047 features.require("stmaryrd");
1055 string InsetQuotes::contextMenuName() const
1057 return "context-quote";