mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
TextLayout: Tidy up special member functions
This commit is contained in:
parent
1cd5abe489
commit
55f6f3227d
2 changed files with 33 additions and 54 deletions
|
|
@ -36,43 +36,13 @@ TextLayout::Glyph::Glyph (int glyph, Point<float> anch, float w) noexcept
|
|||
{
|
||||
}
|
||||
|
||||
TextLayout::Glyph::Glyph (const Glyph& other) noexcept
|
||||
: glyphCode (other.glyphCode), anchor (other.anchor), width (other.width)
|
||||
{
|
||||
}
|
||||
|
||||
TextLayout::Glyph& TextLayout::Glyph::operator= (const Glyph& other) noexcept
|
||||
{
|
||||
glyphCode = other.glyphCode;
|
||||
anchor = other.anchor;
|
||||
width = other.width;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TextLayout::Glyph::~Glyph() noexcept {}
|
||||
|
||||
//==============================================================================
|
||||
TextLayout::Run::Run() noexcept
|
||||
: colour (0xff000000)
|
||||
{
|
||||
}
|
||||
|
||||
TextLayout::Run::Run (Range<int> range, int numGlyphsToPreallocate)
|
||||
: colour (0xff000000), stringRange (range)
|
||||
: stringRange (range)
|
||||
{
|
||||
glyphs.ensureStorageAllocated (numGlyphsToPreallocate);
|
||||
}
|
||||
|
||||
TextLayout::Run::Run (const Run& other)
|
||||
: font (other.font),
|
||||
colour (other.colour),
|
||||
glyphs (other.glyphs),
|
||||
stringRange (other.stringRange)
|
||||
{
|
||||
}
|
||||
|
||||
TextLayout::Run::~Run() noexcept {}
|
||||
|
||||
Range<float> TextLayout::Run::getRunBoundsX() const noexcept
|
||||
{
|
||||
Range<float> range;
|
||||
|
|
@ -97,11 +67,6 @@ Range<float> TextLayout::Run::getRunBoundsX() const noexcept
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
TextLayout::Line::Line() noexcept
|
||||
: ascent (0.0f), descent (0.0f), leading (0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
TextLayout::Line::Line (Range<int> range, Point<float> o, float asc, float desc,
|
||||
float lead, int numRunsToPreallocate)
|
||||
: stringRange (range), lineOrigin (o),
|
||||
|
|
@ -117,8 +82,11 @@ TextLayout::Line::Line (const Line& other)
|
|||
runs.addCopiesOf (other.runs);
|
||||
}
|
||||
|
||||
TextLayout::Line::~Line() noexcept
|
||||
TextLayout::Line& TextLayout::Line::operator= (const Line& other)
|
||||
{
|
||||
auto copy = other;
|
||||
swap (copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Range<float> TextLayout::Line::getLineBoundsX() const noexcept
|
||||
|
|
@ -158,6 +126,16 @@ Rectangle<float> TextLayout::Line::getLineBounds() const noexcept
|
|||
return { x.getStart(), y.getStart(), x.getLength(), y.getLength() };
|
||||
}
|
||||
|
||||
void TextLayout::Line::swap (Line& other) noexcept
|
||||
{
|
||||
std::swap (other.runs, runs);
|
||||
std::swap (other.stringRange, stringRange);
|
||||
std::swap (other.lineOrigin, lineOrigin);
|
||||
std::swap (other.ascent, ascent);
|
||||
std::swap (other.descent, descent);
|
||||
std::swap (other.leading, leading);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
TextLayout::TextLayout()
|
||||
: width (0), height (0), justification (Justification::topLeft)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue