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)
611 style_(InsetQuotesParams::EnglishQuotes), side_(InsetQuotesParams::OpeningQuote),
615 global_style_ = buf->masterBuffer()->params().quotes_style;
616 fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
619 global_style_ = InsetQuotesParams::EnglishQuotes;
627 InsetQuotes::InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLevel level,
628 string const & side, string const & style)
629 : Inset(buf), level_(level), pass_thru_(false), fontspec_(false)
631 bool dynamic = false;
633 global_style_ = buf->masterBuffer()->params().quotes_style;
634 fontenc_ = buf->masterBuffer()->params().main_font_encoding();
635 dynamic = buf->masterBuffer()->params().dynamic_quotes;
636 fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
638 global_style_ = InsetQuotesParams::EnglishQuotes;
639 fontenc_ = lyxrc.fontenc;
643 style_ = dynamic ? InsetQuotesParams::DynamicQuotes : global_style_;
645 style_ = getStyle(style);
647 if (side == "left" || side == "opening")
648 side_ = InsetQuotesParams::OpeningQuote;
649 else if (side == "right" || side == "closing")
650 side_ = InsetQuotesParams::ClosingQuote;
656 docstring InsetQuotes::layoutName() const
658 return from_ascii("Quotes");
662 void InsetQuotes::setSide(char_type c)
664 // Decide whether opening or closing quote
665 if (lyx::isSpace(c) || isOpenPunctuation(c))
666 side_ = InsetQuotesParams::OpeningQuote;// opening quote
668 side_ = InsetQuotesParams::ClosingQuote;// closing quote
672 void InsetQuotes::parseString(string const & s, bool const allow_wildcards)
674 style_ = quoteparams.getQuoteStyle(s, allow_wildcards, style_);
675 side_ = quoteparams.getQuoteSide(s, allow_wildcards, side_);
676 level_ = quoteparams.getQuoteLevel(s, allow_wildcards, level_);
680 InsetQuotesParams::QuoteStyle InsetQuotes::getStyle(string const & s)
682 InsetQuotesParams::QuoteStyle qs = InsetQuotesParams::EnglishQuotes;
685 qs = InsetQuotesParams::EnglishQuotes;
686 else if (s == "swedish")
687 qs = InsetQuotesParams::SwedishQuotes;
688 else if (s == "german")
689 qs = InsetQuotesParams::GermanQuotes;
690 else if (s == "polish")
691 qs = InsetQuotesParams::PolishQuotes;
692 else if (s == "swiss")
693 qs = InsetQuotesParams::SwissQuotes;
694 else if (s == "danish")
695 qs = InsetQuotesParams::DanishQuotes;
696 else if (s == "plain")
697 qs = InsetQuotesParams::PlainQuotes;
698 else if (s == "british")
699 qs = InsetQuotesParams::BritishQuotes;
700 else if (s == "swedishg")
701 qs = InsetQuotesParams::SwedishGQuotes;
702 else if (s == "french")
703 qs = InsetQuotesParams::FrenchQuotes;
704 else if (s == "frenchin")
705 qs = InsetQuotesParams::FrenchINQuotes;
706 else if (s == "russian")
707 qs = InsetQuotesParams::RussianQuotes;
709 qs = InsetQuotesParams::CJKQuotes;
710 else if (s == "cjkangle")
711 qs = InsetQuotesParams::CJKAngleQuotes;
712 else if (s == "dynamic")
713 qs = InsetQuotesParams::DynamicQuotes;
719 docstring InsetQuotes::displayString() const
721 // In PassThru, we use straight quotes
723 return (level_ == InsetQuotesParams::PrimaryQuotes) ?
724 from_ascii("\"") : from_ascii("'");
726 InsetQuotesParams::QuoteStyle style =
727 (style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_;
729 docstring retdisp = docstring(1, quoteparams.getQuoteChar(style, level_, side_));
731 // in French, thin spaces are added inside double guillemets
732 if (prefixIs(context_lang_, "fr")
733 && level_ == InsetQuotesParams::PrimaryQuotes
734 && (style == InsetQuotesParams::SwissQuotes
735 || style == InsetQuotesParams::FrenchQuotes
736 || style == InsetQuotesParams::FrenchINQuotes)) {
737 // THIN SPACE (U+2009)
738 char_type const thin_space = 0x2009;
739 if (side_ == InsetQuotesParams::OpeningQuote)
740 retdisp += thin_space;
742 retdisp = thin_space + retdisp;
749 void InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const
751 FontInfo & font = mi.base.font;
752 frontend::FontMetrics const & fm = theFontMetrics(font);
753 dim.asc = fm.maxAscent();
754 dim.des = fm.maxDescent();
755 dim.wid = fm.width(displayString());
759 void InsetQuotes::draw(PainterInfo & pi, int x, int y) const
761 FontInfo font = pi.base.font;
762 if (style_ == InsetQuotesParams::DynamicQuotes)
763 font.setPaintColor(Color_special);
765 font.setPaintColor(pi.textColor(font.realColor()));
766 pi.pain.text(x, y, displayString(), font);
770 string InsetQuotes::getType() const
773 text += style_char[style_];
774 text += side_char[side_];
775 text += level_char[level_];
780 void InsetQuotes::write(ostream & os) const
782 os << "Quotes " << getType();
786 void InsetQuotes::read(Lexer & lex)
788 lex.setContext("InsetQuotes::read");
790 parseString(lex.getString());
791 lex >> "\\end_inset";
795 void InsetQuotes::doDispatch(Cursor & cur, FuncRequest & cmd)
797 switch (cmd.action()) {
798 case LFUN_INSET_MODIFY: {
799 string const first_arg = cmd.getArg(0);
800 bool const change_type = first_arg == "changetype";
803 // this will not be handled higher up
807 cur.recordUndoInset(this);
808 parseString(cmd.getArg(1), true);
809 cur.buffer()->updateBuffer();
813 Inset::doDispatch(cur, cmd);
819 bool InsetQuotes::getStatus(Cursor & cur, FuncRequest const & cmd,
820 FuncStatus & flag) const
822 switch (cmd.action()) {
824 case LFUN_INSET_MODIFY: {
825 string const first_arg = cmd.getArg(0);
826 if (first_arg == "changetype") {
827 string const type = cmd.getArg(1);
828 flag.setOnOff(type == getType());
829 flag.setEnabled(!pass_thru_);
832 return Inset::getStatus(cur, cmd, flag);
836 return Inset::getStatus(cur, cmd, flag);
841 void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
843 InsetQuotesParams::QuoteStyle style =
844 (style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_;
845 char_type quotechar = quoteparams.getQuoteChar(style, level_, side_);
848 // In pass-thru context, we output plain quotes
849 if (runparams.pass_thru)
850 qstr = (level_ == InsetQuotesParams::PrimaryQuotes) ? from_ascii("\"") : from_ascii("'");
851 else if (style == InsetQuotesParams::PlainQuotes && fontspec_) {
852 // For XeTeX and LuaTeX,we need to disable mapping to get straight
853 // quotes. We define our own commands that do this
854 qstr = (level_ == InsetQuotesParams::PrimaryQuotes) ?
855 from_ascii("\\textquotedblplain") : from_ascii("\\textquotesingleplain");
857 else if (runparams.use_polyglossia) {
858 // For polyglossia, we directly output the respective unicode chars
859 // (spacing and kerning is then handled respectively)
860 qstr = docstring(1, quotechar);
862 else if (style == InsetQuotesParams::CJKQuotes || style == InsetQuotesParams::CJKAngleQuotes) {
863 if (runparams.encoding && runparams.encoding->encodable(quotechar))
864 qstr = docstring(1, quotechar);
866 qstr = quoteparams.getLaTeXQuote(quotechar, "int");
868 else if ((style == InsetQuotesParams::SwissQuotes
869 || style == InsetQuotesParams::FrenchQuotes
870 || style == InsetQuotesParams::FrenchINQuotes)
871 && level_ == InsetQuotesParams::PrimaryQuotes
872 && prefixIs(runparams.local_font->language()->code(), "fr")) {
873 // Specific guillemets of French babel
874 // including correct French spacing
875 if (side_ == InsetQuotesParams::OpeningQuote)
876 qstr = from_ascii("\\og");
878 qstr = from_ascii("\\fg");
879 } else if (fontenc_ == "T1"
880 && !runparams.local_font->language()->internalFontEncoding()) {
881 // Quotation marks for T1 font encoding
883 qstr = quoteparams.getLaTeXQuote(quotechar, "t1");
884 } else if (runparams.local_font->language()->internalFontEncoding()) {
885 // Quotation marks for internal font encodings
886 // (ligatures not featured)
887 qstr = quoteparams.getLaTeXQuote(quotechar, "int");
888 #ifdef DO_USE_DEFAULT_LANGUAGE
889 } else if (doclang == "default") {
891 } else if (!runparams.use_babel || runparams.isFullUnicode()) {
893 // Standard quotation mark macros
894 // These are also used by babel
895 // without fontenc (XeTeX/LuaTeX)
896 qstr = quoteparams.getLaTeXQuote(quotechar, "ot1");
898 // Babel shorthand quotation marks (for T1/OT1)
899 qstr = quoteparams.getLaTeXQuote(quotechar, "babel");
902 if (!runparams.pass_thru) {
903 // Guard against unwanted ligatures with preceding text
904 char_type const lastchar = os.lastChar();
905 // !` ?` => !{}` ?{}`
906 if (prefixIs(qstr, from_ascii("`"))
907 && (lastchar == '!' || lastchar == '?'))
909 // ``` ''' ,,, <<< >>>
910 // => `{}`` '{}'' ,{},, <{}<< >{}>>
911 if (contains(from_ascii(",'`<>"), lastchar)
912 && prefixIs(qstr, lastchar))
918 if (prefixIs(qstr, from_ascii("\\")) && !suffixIs(qstr, '}'))
919 // properly terminate the command depending on the context
924 int InsetQuotes::plaintext(odocstringstream & os,
925 OutputParams const &, size_t) const
927 docstring const str = displayString();
933 docstring InsetQuotes::getQuoteEntity() const {
934 InsetQuotesParams::QuoteStyle style =
935 (style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_;
936 docstring res = quoteparams.getHTMLQuote(quoteparams.getQuoteChar(style, level_, side_));
937 // in French, thin spaces are added inside double guillemets
938 if (prefixIs(context_lang_, "fr")
939 && level_ == InsetQuotesParams::PrimaryQuotes
940 && (style == InsetQuotesParams::FrenchQuotes
941 || style == InsetQuotesParams::FrenchINQuotes
942 || style == InsetQuotesParams::SwissQuotes)) {
943 // THIN SPACE (U+2009)
944 docstring const thin_space = from_ascii(" ");
945 if (side_ == InsetQuotesParams::OpeningQuote)
948 res = thin_space + res;
954 int InsetQuotes::docbook(odocstream & os, OutputParams const &) const
956 os << getQuoteEntity();
961 docstring InsetQuotes::xhtml(XHTMLStream & xs, OutputParams const &) const
963 xs << XHTMLStream::ESCAPE_NONE << getQuoteEntity();
968 void InsetQuotes::toString(odocstream & os) const
970 os << displayString();
974 void InsetQuotes::forOutliner(docstring & os, size_t const, bool const) const
976 os += displayString();
980 void InsetQuotes::updateBuffer(ParIterator const & it, UpdateType /* utype*/)
982 BufferParams const & bp = buffer().masterBuffer()->params();
983 pass_thru_ = it.paragraph().isPassThru();
984 context_lang_ = it.paragraph().getFontSettings(bp, it.pos()).language()->code();
985 fontenc_ = bp.main_font_encoding();
986 global_style_ = bp.quotes_style;
987 fontspec_ = bp.useNonTeXFonts;
991 void InsetQuotes::validate(LaTeXFeatures & features) const
993 InsetQuotesParams::QuoteStyle style =
994 (style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_;
995 char_type type = quoteparams.getQuoteChar(style, level_, side_);
997 // Handle characters that are not natively supported by
998 // specific font encodings (we roll our own definitions)
999 #ifdef DO_USE_DEFAULT_LANGUAGE
1000 if (features.bufferParams().language->lang() == "default"
1002 if (!features.useBabel()
1004 && !features.runparams().isFullUnicode() && fontenc_ != "T1") {
1007 features.require("quotesinglbase");
1010 features.require("guilsinglleft");
1013 features.require("guilsinglright");
1016 features.require("quotedblbase");
1019 features.require("guillemotleft");
1022 features.require("guillemotright");
1028 // Handle straight quotation marks. These need special care
1029 // in most output formats
1032 if (features.runparams().isFullUnicode() && fontspec_)
1033 features.require("textquotesinglep");
1035 features.require("textcomp");
1039 if (features.runparams().isFullUnicode() && fontspec_)
1040 features.require("textquotedblp");
1041 else if (fontenc_ != "T1")
1042 features.require("textquotedbl");
1045 // we fake these from math
1046 case 0x300e: // LEFT WHITE CORNER BRACKET
1047 case 0x300f: // RIGHT WHITE CORNER BRACKET
1048 if (!features.runparams().encoding
1049 || !features.runparams().encoding->encodable(type))
1050 features.require("stmaryrd");
1058 string InsetQuotes::contextMenuName() const
1060 return "context-quote";