From d689117719f2cec9c74aec96cfc59700e1421957 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 2 Aug 2011 11:24:48 +1000 Subject: Allow floating point text positioning. --- src/PositionCache.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/PositionCache.cxx') diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 2105c292f..614e6b8bf 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -86,7 +86,7 @@ void LineLayout::Resize(int maxLineLength_) { indicators = new char[maxLineLength_ + 1]; // Extra position allocated as sometimes the Windows // GetTextExtentExPoint API writes an extra element. - positions = new int[maxLineLength_ + 1 + 1]; + positions = new XYPOSITION[maxLineLength_ + 1 + 1]; maxLineLength = maxLineLength_; } } @@ -503,15 +503,15 @@ PositionCacheEntry::PositionCacheEntry() : } void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_, - unsigned int len_, int *positions_, unsigned int clock_) { + unsigned int len_, XYPOSITION *positions_, unsigned int clock_) { Clear(); styleNumber = styleNumber_; len = len_; clock = clock_; if (s_ && positions_) { - positions = new short[len + (len + 1) / 2]; + positions = new XYPOSITION[len + (len + 1) / 2]; for (unsigned int i=0; i(positions_[i]); + positions[i] = static_cast(positions_[i]); } memcpy(reinterpret_cast(positions + len), s_, len); } @@ -530,7 +530,7 @@ void PositionCacheEntry::Clear() { } bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, - unsigned int len_, int *positions_) const { + unsigned int len_, XYPOSITION *positions_) const { if ((styleNumber == styleNumber_) && (len == len_) && (memcmp(reinterpret_cast(positions + len), s_, len)== 0)) { for (unsigned int i=0; i BreakFinder::lengthStartSubdivision) { // Break up into segments unsigned int startSegment = 0; - int xStartSegment = 0; + XYPOSITION xStartSegment = 0; while (startSegment < len) { unsigned int lenSegment = pdoc->SafeSegment(s + startSegment, len - startSegment, BreakFinder::lengthEachSubdivision); surface->MeasureWidths(vstyle.styles[styleNumber].font, s + startSegment, lenSegment, positions + startSegment); -- cgit v1.2.3