diff --git a/core/indigo-core/molecule/src/molecule_cdxml_loader.cpp b/core/indigo-core/molecule/src/molecule_cdxml_loader.cpp index ddd5971cd8..eed093647a 100644 --- a/core/indigo-core/molecule/src/molecule_cdxml_loader.cpp +++ b/core/indigo-core/molecule/src/molecule_cdxml_loader.cpp @@ -1220,51 +1220,56 @@ void MoleculeCdxmlLoader::_parseText(CDXElement elem, std::vector label_part.size()) // line break - ket_text_lines.emplace_back(); + auto initial_size = label_part.size(); - ket_text_style.offset = ket_text_line.text.size(); - ket_text_style.size = label_part.size(); - ket_text_line.text += label_part; + ket_text_style.offset = ket_text_line.text.size(); + ket_text_style.size = label_part.size(); + ket_text_line.text += label_part; - font_face = 0; - font_size = 0.0; - auto style = text_style.firstProperty(); - applyDispatcher(style, style_dispatcher); + font_face = 0; + font_size = 0.0; + auto style = text_style.firstProperty(); + applyDispatcher(style, style_dispatcher); - CDXMLFontStyle fs(font_face); - if (font_face == KCDXMLChemicalFontStyle) - { - // special case - } - else - { - if (fs.is_bold) - ket_text_style.styles.push_back(KETFontBoldStr); - if (fs.is_italic) - ket_text_style.styles.push_back(KETFontItalicStr); - if (fs.is_superscript) - ket_text_style.styles.push_back(KETFontSuperscriptStr); - if (fs.is_subscript) - ket_text_style.styles.push_back(KETFontSubscriptStr); + CDXMLFontStyle fs(font_face); + if (font_face == KCDXMLChemicalFontStyle) + { + // special case + } + else + { + if (fs.is_bold) + ket_text_style.styles.push_back(KETFontBoldStr); + if (fs.is_italic) + ket_text_style.styles.push_back(KETFontItalicStr); + if (fs.is_superscript) + ket_text_style.styles.push_back(KETFontSuperscriptStr); + if (fs.is_subscript) + ket_text_style.styles.push_back(KETFontSubscriptStr); + } + if (font_size > 0 && (int)font_size != KETDefaultFontSize) + ket_text_style.styles.push_back(std::string(KETFontCustomSizeStr) + "_" + std::to_string((int)ceil(font_size)) + "px"); + + if (i < lines.size() - 1) + ket_text_lines.emplace_back(); } - if (font_size > 0 && (int)font_size != KETDefaultFontSize) - ket_text_style.styles.push_back(std::string(KETFontCustomSizeStr) + "_" + std::to_string((int)ceil(font_size)) + "px"); } }