Skip to content

Commit

Permalink
[drape] Restored accidentally dropped forceNoWrap
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Borsuk <me@alex.bio>
  • Loading branch information
biodranik committed Jul 27, 2024
1 parent a3b6d53 commit e7d3735
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drape_frontend/text_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ struct LineMetrics
};

// Scan longer shaped glyphs, and try to split them into two strings if a space glyph is present.
buffer_vector<LineMetrics, 2> SplitText(float textScale, dp::GlyphFontAndId space, dp::text::TextMetrics const & str)
buffer_vector<LineMetrics, 2> SplitText(bool forceNoWrap, float textScale, dp::GlyphFontAndId space, dp::text::TextMetrics const & str)
{
// Add the whole line by default.
buffer_vector<LineMetrics, 2> lines{{str.m_glyphs.size(),
textScale * str.m_lineWidthInPixels, textScale * str.m_maxLineHeightInPixels}};

size_t const count = str.m_glyphs.size();
if (count <= 15)
if (forceNoWrap || count <= 15)
return lines;

auto const begin = str.m_glyphs.begin();
Expand Down Expand Up @@ -289,7 +289,7 @@ StraightTextLayout::StraightTextLayout(std::string const & text, float fontSize,
m_shapedGlyphs = textures->ShapeSingleTextLine(dp::kBaseFontSizePixels, text, &m_glyphRegions);

// TODO(AB): Use ICU's BreakIterator to split text properly in different languages without spaces.
auto const lines = SplitText(m_textSizeRatio, textures->GetSpaceGlyph(), m_shapedGlyphs);
auto const lines = SplitText(forceNoWrap, m_textSizeRatio, textures->GetSpaceGlyph(), m_shapedGlyphs);
m_rowsCount = lines.size();

float summaryHeight = 0.;
Expand Down

0 comments on commit e7d3735

Please sign in to comment.