]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetCaptionable.cpp
Circumvent odd stmary font metrics (part of #9990).
[lyx.git] / src / insets / InsetCaptionable.cpp
index f90776ab0408541f1dd672470239359efbd7ac97..0434c2eb2f7f235b78b72454f560135bb48014f3 100644 (file)
@@ -40,22 +40,25 @@ docstring InsetCaptionable::floatName(string const & type) const
        BufferParams const & bp = buffer().params();
        FloatList const & floats = bp.documentClass().floats();
        FloatList::const_iterator it = floats[type];
-       // FIXME UNICODE
-       return (it == floats.end()) ? from_ascii(type) : bp.B_(it->second.name());
+       return (it == floats.end()) ? from_utf8(type) : bp.B_(it->second.name());
 }
 
 
-void InsetCaptionable::addToToc(DocIterator const & cpit, bool output_active) const
+void InsetCaptionable::addToToc(DocIterator const & cpit, bool output_active,
+                                                               UpdateType utype) const
 {
        DocIterator pit = cpit;
        pit.push_back(CursorSlice(const_cast<InsetCaptionable &>(*this)));
        docstring str;
-       int length = output_active ? INT_MAX : TOC_ENTRY_LENGTH;
-       text().forOutliner(str, length);
+       // Leave str empty if we generate for output (e.g. xhtml lists of figures).
+       // This ensures that there is a caption if and only if the string is
+       // non-empty.
+       if (utype != OutputUpdate)
+               text().forOutliner(str, TOC_ENTRY_LENGTH);
        shared_ptr<TocBuilder> b = buffer().tocBackend().builder(caption_type_);
        b->pushItem(pit, str, output_active);
        // Proceed with the rest of the inset.
-       InsetCollapsable::addToToc(cpit, output_active);
+       InsetCollapsable::addToToc(cpit, output_active, utype);
        b->pop();
 }