From 2e003602f29edff5d38137472edee82fab9f5376 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 2 Jun 2018 08:37:47 +1000 Subject: Define IScreenLineLayout as the main interface for implementing bidirectional features by platform code. Implement IScreenLineLayout for Win32 / DirectWrite as ScreenLineLayout. --- include/Platform.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/Platform.h b/include/Platform.h index 30f05d88a..a70a00b78 100644 --- a/include/Platform.h +++ b/include/Platform.h @@ -336,6 +336,14 @@ struct Interval { XYPOSITION right; }; +class IScreenLineLayout { +public: + virtual ~IScreenLineLayout() = default; + virtual size_t PositionFromX(XYPOSITION xDistance, bool charPosition) = 0; + virtual XYPOSITION XFromPosition(size_t caretPosition) = 0; + virtual std::vector FindRangeIntervals(size_t start, size_t end) = 0; +}; + /** * A surface abstracts a place to draw. */ @@ -373,9 +381,7 @@ public: virtual void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back)=0; virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0; - virtual size_t PositionFromX(const IScreenLine *screenLine, XYPOSITION xDistance, bool charPosition)=0; - virtual XYPOSITION XFromPosition(const IScreenLine *screenLine, size_t caretPosition)=0; - virtual std::vector FindRangeIntervals(const IScreenLine *screenLine, size_t start, size_t end)=0; + virtual std::unique_ptr Layout(const IScreenLine *screenLine) = 0; virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) = 0; virtual void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) = 0; -- cgit v1.2.3