mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-08 20:53:54 +00:00
Just show "Invalid formula" if needed.
This commit is contained in:
@@ -797,15 +797,17 @@ LaidOutBlock LayoutDisplayMathBlock(
|
||||
const auto &fallbackPadding = st.displayMath.fallbackPadding;
|
||||
const auto fallbackPaddingWidth = fallbackPadding.left()
|
||||
+ fallbackPadding.right();
|
||||
const auto fallbackText = formula
|
||||
? formula->measured.fallbackText
|
||||
: prepared.formulaTex.trimmed();
|
||||
auto fallbackText = TextWithEntities::Simple(u"Invalid formula"_q);
|
||||
fallbackText.entities.push_back(EntityInText(
|
||||
EntityType::Italic,
|
||||
0,
|
||||
fallbackText.text.size()));
|
||||
block.textWidth = std::max(contentWidth - fallbackPaddingWidth, 1);
|
||||
block.fallbackLeaf = Ui::Text::String(
|
||||
TextMinResizeWidth(block.textWidth));
|
||||
block.fallbackLeaf.setMarkedText(
|
||||
st.displayMath.fallbackStyle,
|
||||
TextWithEntities::Simple(fallbackText),
|
||||
std::move(fallbackText),
|
||||
kIvMarkedTextOptions);
|
||||
block.textWidth = std::min(
|
||||
block.textWidth,
|
||||
|
||||
@@ -1172,15 +1172,6 @@ void PaintDisplayMathBlock(
|
||||
p.pen().color()));
|
||||
}
|
||||
if (!rendered.success) {
|
||||
const auto radius = st.displayMath.fallbackRadius;
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(paintSt.displayMath.fallbackBg->c);
|
||||
if (radius > 0) {
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
p.drawRoundedRect(block.formulaRect, radius, radius);
|
||||
} else {
|
||||
p.fillRect(block.formulaRect, paintSt.displayMath.fallbackBg->c);
|
||||
}
|
||||
p.setPen(paintSt.textColor->c);
|
||||
PaintTextLeaf(
|
||||
p,
|
||||
|
||||
Reference in New Issue
Block a user