mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
ShapedText: Break ligatures into multiple iterable placeholder glyphs
This commit is contained in:
parent
bc093fa64c
commit
427852836c
8 changed files with 282 additions and 70 deletions
|
|
@ -182,6 +182,9 @@ static void addGlyphsFromShapedText (GlyphArrangement& ga, const detail::ShapedT
|
|||
auto& glyph = shapedGlyphs[i];
|
||||
auto& position = positions[i];
|
||||
|
||||
if (glyph.isPlaceholderForLigature())
|
||||
continue;
|
||||
|
||||
PositionedGlyph pg { font,
|
||||
st.getText()[(int) st.getTextRange (glyphIndex).getStart()],
|
||||
(int) glyph.glyphId,
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ static Range<int64> getLineInputRange (const detail::ShapedText& st, int64 lineN
|
|||
using namespace detail;
|
||||
|
||||
return getInputRange (st, st.getSimpleShapedText()
|
||||
.getLineNumbers()
|
||||
.getLineNumbersForGlyphRanges()
|
||||
.getItem ((size_t) lineNumber).range);
|
||||
}
|
||||
|
||||
|
|
@ -360,7 +360,7 @@ static MaxFontAscentAndDescent getMaxFontAscentAndDescentInEnclosingLine (const
|
|||
{
|
||||
const auto sst = st.getSimpleShapedText();
|
||||
|
||||
const auto lineRange = sst.getLineNumbers()
|
||||
const auto lineRange = sst.getLineNumbersForGlyphRanges()
|
||||
.getItemWithEnclosingRange (lineChunkRange.getStart())->range;
|
||||
|
||||
const auto fonts = sst.getResolvedFonts().getIntersectionsWith (lineRange);
|
||||
|
|
@ -427,7 +427,7 @@ void TextLayout::createStandardLayout (const AttributedString& text)
|
|||
std::unique_ptr<Line> line;
|
||||
|
||||
st.accessTogetherWith ([&] (Span<const ShapedGlyph> glyphs,
|
||||
Span<Point<float>> positions,
|
||||
Span<const Point<float>> positions,
|
||||
Font font,
|
||||
Range<int64> glyphRange,
|
||||
LineMetrics lineMetrics,
|
||||
|
|
@ -470,7 +470,14 @@ void TextLayout::createStandardLayout (const AttributedString& text)
|
|||
}();
|
||||
|
||||
for (size_t i = 0; i < beyondLastNonWhitespace; ++i)
|
||||
run->glyphs.add ({ (int) glyphs[i].glyphId, positions[i] - line->lineOrigin, glyphs[i].advance.x });
|
||||
{
|
||||
if (glyphs[i].isPlaceholderForLigature())
|
||||
continue;
|
||||
|
||||
run->glyphs.add ({ (int) glyphs[i].glyphId,
|
||||
positions[i] - line->lineOrigin,
|
||||
glyphs[i].advance.x });
|
||||
}
|
||||
|
||||
line->runs.add (std::move (run));
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue