diff --git a/src/gfx_layout.h b/src/gfx_layout.h index f635d80dc3..90aa7bd84b 100644 --- a/src/gfx_layout.h +++ b/src/gfx_layout.h @@ -96,10 +96,10 @@ public: virtual ~VisualRun() = default; virtual const Font *GetFont() const = 0; virtual int GetGlyphCount() const = 0; - virtual const std::vector &GetGlyphs() const = 0; - virtual const std::vector &GetPositions() const = 0; + virtual std::span GetGlyphs() const = 0; + virtual std::span GetPositions() const = 0; virtual int GetLeading() const = 0; - virtual const std::vector &GetGlyphToCharMap() const = 0; + virtual std::span GetGlyphToCharMap() const = 0; }; /** A single line worth of VisualRuns. */ diff --git a/src/gfx_layout_fallback.cpp b/src/gfx_layout_fallback.cpp index 2b8fc617eb..a169cb75b6 100644 --- a/src/gfx_layout_fallback.cpp +++ b/src/gfx_layout_fallback.cpp @@ -49,10 +49,10 @@ public: FallbackVisualRun(Font *font, const char32_t *chars, int glyph_count, int char_offset, int x); const Font *GetFont() const override { return this->font; } int GetGlyphCount() const override { return static_cast(this->glyphs.size()); } - const std::vector &GetGlyphs() const override { return this->glyphs; } - const std::vector &GetPositions() const override { return this->positions; } + std::span GetGlyphs() const override { return this->glyphs; } + std::span GetPositions() const override { return this->positions; } int GetLeading() const override { return this->GetFont()->fc->GetHeight(); } - const std::vector &GetGlyphToCharMap() const override { return this->glyph_to_char; } + std::span GetGlyphToCharMap() const override { return this->glyph_to_char; } }; /** A single line worth of VisualRuns. */ diff --git a/src/gfx_layout_icu.cpp b/src/gfx_layout_icu.cpp index a300d9a255..9947e62391 100644 --- a/src/gfx_layout_icu.cpp +++ b/src/gfx_layout_icu.cpp @@ -71,9 +71,9 @@ public: public: ICUVisualRun(const ICURun &run, int x); - const std::vector &GetGlyphs() const override { return this->glyphs; } - const std::vector &GetPositions() const override { return this->positions; } - const std::vector &GetGlyphToCharMap() const override { return this->glyph_to_char; } + std::span GetGlyphs() const override { return this->glyphs; } + std::span GetPositions() const override { return this->positions; } + std::span GetGlyphToCharMap() const override { return this->glyph_to_char; } const Font *GetFont() const override { return this->font; } int GetLeading() const override { return this->font->fc->GetHeight(); } diff --git a/src/os/macosx/string_osx.cpp b/src/os/macosx/string_osx.cpp index 6a7a45285e..08cf974f23 100644 --- a/src/os/macosx/string_osx.cpp +++ b/src/os/macosx/string_osx.cpp @@ -81,9 +81,9 @@ public: CoreTextVisualRun(CTRunRef run, Font *font, const CoreTextParagraphLayoutFactory::CharType *buff); CoreTextVisualRun(CoreTextVisualRun &&other) = default; - const std::vector &GetGlyphs() const override { return this->glyphs; } - const std::vector &GetPositions() const override { return this->positions; } - const std::vector &GetGlyphToCharMap() const override { return this->glyph_to_char; } + std::span GetGlyphs() const override { return this->glyphs; } + std::span GetPositions() const override { return this->positions; } + std::span GetGlyphToCharMap() const override { return this->glyph_to_char; } const Font *GetFont() const override { return this->font; } int GetLeading() const override { return this->font->fc->GetHeight(); } diff --git a/src/os/windows/string_uniscribe.cpp b/src/os/windows/string_uniscribe.cpp index 2baace1eda..7b289734d2 100644 --- a/src/os/windows/string_uniscribe.cpp +++ b/src/os/windows/string_uniscribe.cpp @@ -88,9 +88,9 @@ public: UniscribeVisualRun(const UniscribeRun &range, int x); UniscribeVisualRun(UniscribeVisualRun &&other) noexcept; - const std::vector &GetGlyphs() const override { return this->glyphs; } - const std::vector &GetPositions() const override { return this->positions; } - const std::vector &GetGlyphToCharMap() const override; + std::span GetGlyphs() const override { return this->glyphs; } + std::span GetPositions() const override { return this->positions; } + std::span GetGlyphToCharMap() const override; const Font *GetFont() const override { return this->font; } int GetLeading() const override { return this->font->fc->GetHeight(); } @@ -493,7 +493,7 @@ UniscribeParagraphLayout::UniscribeVisualRun::UniscribeVisualRun(UniscribeVisual { } -const std::vector &UniscribeParagraphLayout::UniscribeVisualRun::GetGlyphToCharMap() const +std::span UniscribeParagraphLayout::UniscribeVisualRun::GetGlyphToCharMap() const { if (this->glyph_to_char.empty()) { this->glyph_to_char.resize(this->GetGlyphCount());