diff options
| author | nyamatongwe <devnull@localhost> | 2011-08-02 11:24:48 +1000 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2011-08-02 11:24:48 +1000 | 
| commit | c4ba4ab013dc711f9caa5521b635b68f92a87e33 (patch) | |
| tree | 10a509ac5f0ba26a8341efc475eed66efe9a44c0 | |
| parent | 6ef96951cabf9de853f7b40a9924c0f442e8fb50 (diff) | |
| download | scintilla-mirror-c4ba4ab013dc711f9caa5521b635b68f92a87e33.tar.gz | |
Allow floating point text positioning.
| -rw-r--r-- | include/Platform.h | 51 | ||||
| -rw-r--r-- | src/Editor.cxx | 10 | ||||
| -rw-r--r-- | src/PositionCache.cxx | 14 | ||||
| -rw-r--r-- | src/PositionCache.h | 10 | ||||
| -rw-r--r-- | win32/PlatWin.cxx | 81 | 
5 files changed, 88 insertions, 78 deletions
| diff --git a/include/Platform.h b/include/Platform.h index b0f3de0dc..d4c6bbfec 100644 --- a/include/Platform.h +++ b/include/Platform.h @@ -9,6 +9,9 @@  #ifndef PLATFORM_H  #define PLATFORM_H +#define XYPOSITION float +//#define XYPOSITION int +  // PLAT_GTK = GTK+ on Linux or Win32  // PLAT_GTK_WIN32 is defined additionally when running PLAT_GTK under Win32  // PLAT_WIN = Win32 API on Win32 OS @@ -76,10 +79,10 @@ typedef void *IdlerID;   */  class Point {  public: -	int x; -	int y; +	XYPOSITION x; +	XYPOSITION y; -	explicit Point(int x_=0, int y_=0) : x(x_), y(y_) { +	explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) : x(x_), y(y_) {  	}  	// Other automatically defined methods (assignment, copy constructor, destructor) are fine @@ -94,12 +97,12 @@ public:   */  class PRectangle {  public: -	int left; -	int top; -	int right; -	int bottom; +	XYPOSITION left; +	XYPOSITION top; +	XYPOSITION right; +	XYPOSITION bottom; -	PRectangle(int left_=0, int top_=0, int right_=0, int bottom_ = 0) : +	PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) :  		left(left_), top(top_), right(right_), bottom(bottom_) {  	} @@ -121,14 +124,14 @@ public:  		return (right > other.left) && (left < other.right) &&  			(bottom > other.top) && (top < other.bottom);  	} -	void Move(int xDelta, int yDelta) { +	void Move(XYPOSITION xDelta, XYPOSITION yDelta) {  		left += xDelta;  		top += yDelta;  		right += xDelta;  		bottom += yDelta;  	} -	int Width() { return right - left; } -	int Height() { return bottom - top; } +	XYPOSITION Width() { return right - left; } +	XYPOSITION Height() { return bottom - top; }  	bool Empty() {  		return (Height() <= 0) || (Width() <= 0);  	} @@ -300,7 +303,7 @@ public:  	Font();  	virtual ~Font(); -	virtual void Create(const char *faceName, int characterSet, int size, +	virtual void Create(const char *faceName, int characterSet, float size,  		bool bold, bool italic, int extraFontFlag=0);  	virtual void Release(); @@ -349,18 +352,18 @@ public:  	virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;  	virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0; -	virtual void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0; -	virtual void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0; -	virtual void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore)=0; -	virtual void MeasureWidths(Font &font_, const char *s, int len, int *positions)=0; -	virtual int WidthText(Font &font_, const char *s, int len)=0; -	virtual int WidthChar(Font &font_, char ch)=0; -	virtual int Ascent(Font &font_)=0; -	virtual int Descent(Font &font_)=0; -	virtual int InternalLeading(Font &font_)=0; -	virtual int ExternalLeading(Font &font_)=0; -	virtual int Height(Font &font_)=0; -	virtual int AverageCharWidth(Font &font_)=0; +	virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0; +	virtual void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0; +	virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore)=0; +	virtual void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions)=0; +	virtual XYPOSITION WidthText(Font &font_, const char *s, int len)=0; +	virtual XYPOSITION WidthChar(Font &font_, char ch)=0; +	virtual XYPOSITION Ascent(Font &font_)=0; +	virtual XYPOSITION Descent(Font &font_)=0; +	virtual XYPOSITION InternalLeading(Font &font_)=0; +	virtual XYPOSITION ExternalLeading(Font &font_)=0; +	virtual XYPOSITION Height(Font &font_)=0; +	virtual XYPOSITION AverageCharWidth(Font &font_)=0;  	virtual int SetPalette(Palette *pal, bool inBackGround)=0;  	virtual void SetClip(PRectangle rc)=0; diff --git a/src/Editor.cxx b/src/Editor.cxx index 452666be7..f44279bbd 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2216,7 +2216,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou  		// Layout the line, determining the position of each character,  		// with an extra element at the end for the end of the line.  		int startseg = 0;	// Start of the current segment, in char. number -		int startsegx = 0;	// Start of the current segment, in pixels +		XYPOSITION startsegx = 0;	// Start of the current segment, in pixels  		ll->positions[0] = 0;  		unsigned int tabWidth = vstyle.spaceWidth * pdoc->tabInChars;  		bool lastSegItalics = false; @@ -2902,8 +2902,10 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  		// draw strings that are completely past the right side of the window.  		if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) {  			// Clip to line rectangle, since may have a huge position which will not work with some platforms -			rcSegment.left = Platform::Maximum(rcSegment.left, rcLine.left); -			rcSegment.right = Platform::Minimum(rcSegment.right, rcLine.right); +			if (rcSegment.left < rcLine.left) +				rcSegment.left = rcLine.left; +			if (rcSegment.right > rcLine.right) +				rcSegment.right = rcLine.right;  			int styleMain = ll->styles[i];  			const int inSelection = hideSelection ? 0 : sel.CharacterInSelection(iDoc); @@ -3379,7 +3381,7 @@ void Editor::DrawCarets(Surface *surface, ViewStyle &vsDraw, int lineDoc, int xS  		const int spaceWidth = static_cast<int>(vsDraw.styles[ll->EndLineStyle()].spaceWidth);  		const int virtualOffset = posCaret.VirtualSpace() * spaceWidth;  		if (ll->InLine(offset, subLine) && offset <= ll->numCharsBeforeEOL) { -			int xposCaret = ll->positions[offset] + virtualOffset - ll->positions[ll->LineStart(subLine)]; +			XYPOSITION xposCaret = ll->positions[offset] + virtualOffset - ll->positions[ll->LineStart(subLine)];  			if (ll->wrapIndent != 0) {  				int lineStart = ll->LineStart(subLine);  				if (lineStart != 0)	// Wrapped 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<len; i++) { -			positions[i] = static_cast<short>(positions_[i]); +			positions[i] = static_cast<XYPOSITION>(positions_[i]);  		}  		memcpy(reinterpret_cast<char *>(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<char *>(positions + len), s_, len)== 0)) {  		for (unsigned int i=0; i<len; i++) { @@ -595,7 +595,7 @@ void PositionCache::SetSize(size_t size_) {  }  void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber, -	const char *s, unsigned int len, int *positions, Document *pdoc) { +	const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc) {  	allClear = false;  	int probe = -1; @@ -621,7 +621,7 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned  	if (len > 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); diff --git a/src/PositionCache.h b/src/PositionCache.h index c6076ea20..280446627 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -41,7 +41,7 @@ public:  	unsigned char *styles;  	int styleBitsSet;  	char *indicators; -	int *positions; +	XYPOSITION *positions;  	char bracePreviousStyles[2];  	// Hotspot support @@ -103,13 +103,13 @@ class PositionCacheEntry {  	unsigned int styleNumber:8;  	unsigned int len:8;  	unsigned int clock:16; -	short *positions; +	XYPOSITION *positions;  public:  	PositionCacheEntry();  	~PositionCacheEntry(); -	void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_, unsigned int clock); +	void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_, unsigned int clock);  	void Clear(); -	bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_) const; +	bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_) const;  	static int Hash(unsigned int styleNumber_, const char *s, unsigned int len);  	bool NewerThan(const PositionCacheEntry &other) const;  	void ResetClock(); @@ -155,7 +155,7 @@ public:  	void SetSize(size_t size_);  	size_t GetSize() const { return size; }  	void MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber, -		const char *s, unsigned int len, int *positions, Document *pdoc); +		const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc);  };  inline bool IsSpaceOrTab(int ch) { diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 2ba4ed374..d4a015cf9 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -273,20 +273,20 @@ class FontCached : Font {  	int usage;  	LOGFONTA lf;  	int hash; -	FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_, int extraFontFlag_); +	FontCached(const char *faceName_, int characterSet_, float size_, bool bold_, bool italic_, int extraFontFlag_);  	~FontCached() {} -	bool SameAs(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_, int extraFontFlag_); +	bool SameAs(const char *faceName_, int characterSet_, float size_, bool bold_, bool italic_, int extraFontFlag_);  	virtual void Release();  	static FontCached *first;  public: -	static FontID FindOrCreate(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_, int extraFontFlag_); +	static FontID FindOrCreate(const char *faceName_, int characterSet_, float size_, bool bold_, bool italic_, int extraFontFlag_);  	static void ReleaseId(FontID fid_);  };  FontCached *FontCached::first = 0; -FontCached::FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_, int extraFontFlag_) : +FontCached::FontCached(const char *faceName_, int characterSet_, float size_, bool bold_, bool italic_, int extraFontFlag_) :  	next(0), usage(0), hash(0) {  	SetLogFont(lf, faceName_, characterSet_, size_, bold_, italic_, extraFontFlag_);  	hash = HashFont(faceName_, characterSet_, size_, bold_, italic_, extraFontFlag_); @@ -338,7 +338,7 @@ FontCached::FontCached(const char *faceName_, int characterSet_, int size_, bool  	usage = 1;  } -bool FontCached::SameAs(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_, int extraFontFlag_) { +bool FontCached::SameAs(const char *faceName_, int characterSet_, float size_, bool bold_, bool italic_, int extraFontFlag_) {  	return  		(lf.lfHeight == -(abs(size_))) &&  		(lf.lfWeight == (bold_ ? FW_BOLD : FW_NORMAL)) && @@ -353,7 +353,7 @@ void FontCached::Release() {  	fid = 0;  } -FontID FontCached::FindOrCreate(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_, int extraFontFlag_) { +FontID FontCached::FindOrCreate(const char *faceName_, int characterSet_, float size_, bool bold_, bool italic_, int extraFontFlag_) {  	FontID ret = 0;  	::EnterCriticalSection(&crPlatformLock);  	int hashFind = HashFont(faceName_, characterSet_, size_, bold_, italic_, extraFontFlag_); @@ -404,7 +404,7 @@ Font::~Font() {  #define FONTS_CACHED -void Font::Create(const char *faceName, int characterSet, int size, +void Font::Create(const char *faceName, int characterSet, float size,  	bool bold, bool italic, int extraFontFlag) {  	Release();  	if (faceName) @@ -481,19 +481,19 @@ public:  	void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back);  	void Copy(PRectangle rc, Point from, Surface &surfaceSource); -	void DrawTextCommon(PRectangle rc, Font &font_, int ybase, const char *s, int len, UINT fuOptions); -	void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); -	void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); -	void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore); -	void MeasureWidths(Font &font_, const char *s, int len, int *positions); -	int WidthText(Font &font_, const char *s, int len); -	int WidthChar(Font &font_, char ch); -	int Ascent(Font &font_); -	int Descent(Font &font_); -	int InternalLeading(Font &font_); -	int ExternalLeading(Font &font_); -	int Height(Font &font_); -	int AverageCharWidth(Font &font_); +	void DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, UINT fuOptions); +	void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); +	void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); +	void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore); +	void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions); +	XYPOSITION WidthText(Font &font_, const char *s, int len); +	XYPOSITION WidthChar(Font &font_, char ch); +	XYPOSITION Ascent(Font &font_); +	XYPOSITION Descent(Font &font_); +	XYPOSITION InternalLeading(Font &font_); +	XYPOSITION ExternalLeading(Font &font_); +	XYPOSITION Height(Font &font_); +	XYPOSITION AverageCharWidth(Font &font_);  	int SetPalette(Palette *pal, bool inBackGround);  	void SetClip(PRectangle rc); @@ -664,6 +664,10 @@ static int Delta(int difference) {  		return 0;  } +static int RoundFloat(float f) { +	return int(f+0.5); +} +  void SurfaceImpl::LineTo(int x_, int y_) {  	if (pRenderTarget) {  		int xDiff = x_ - x; @@ -726,7 +730,7 @@ void SurfaceImpl::Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllo  void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back) {  	if (pRenderTarget) {  		D2DPenColour(back); -		D2D1_RECT_F rectangle1 = D2D1::RectF(rc.left + 0.5, rc.top+0.5, rc.right - 0.5, rc.bottom-0.5); +		D2D1_RECT_F rectangle1 = D2D1::RectF(RoundFloat(rc.left) + 0.5, rc.top+0.5, RoundFloat(rc.right) - 0.5, rc.bottom-0.5);  		D2DPenColour(back);  		pRenderTarget->FillRectangle(&rectangle1, pBrush);  		D2DPenColour(fore); @@ -737,7 +741,7 @@ void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAlloc  void SurfaceImpl::FillRectangle(PRectangle rc, ColourAllocated back) {  	if (pRenderTarget) {  		D2DPenColour(back); -        D2D1_RECT_F rectangle1 = D2D1::RectF(rc.left, rc.top, rc.right, rc.bottom); +        D2D1_RECT_F rectangle1 = D2D1::RectF(RoundFloat(rc.left), rc.top, RoundFloat(rc.right), rc.bottom);          pRenderTarget->FillRectangle(&rectangle1, pBrush);  	}  } @@ -903,9 +907,9 @@ public:  		}  	}  }; -typedef VarBuffer<int, stackBufferLength> TextPositions; +typedef VarBuffer<XYPOSITION, stackBufferLength> TextPositions; -void SurfaceImpl::DrawTextCommon(PRectangle rc, Font &font_, int ybase, const char *s, int len, UINT) { +void SurfaceImpl::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, UINT) {  	SetFont(font_);  	RECT rcw = RectFromPRectangle(rc); @@ -919,7 +923,7 @@ void SurfaceImpl::DrawTextCommon(PRectangle rc, Font &font_, int ybase, const ch  				rc.Width()+2, rc.Height(), &pTextLayout);  		if (SUCCEEDED(hr)) {  			D2D1_POINT_2F origin = {rc.left, ybase-baseline}; -			pRenderTarget->DrawTextLayout(origin, pTextLayout, pBrush); +			pRenderTarget->DrawTextLayout(origin, pTextLayout, pBrush, D2D1_DRAW_TEXT_OPTIONS_NONE);  		} else {  			D2D1_RECT_F layoutRect = D2D1::RectF(  				static_cast<FLOAT>(rcw.left) / dpiScaleX, @@ -931,7 +935,7 @@ void SurfaceImpl::DrawTextCommon(PRectangle rc, Font &font_, int ybase, const ch  	}  } -void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, +void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len,  	ColourAllocated fore, ColourAllocated back) {  	if (pRenderTarget) {  		FillRectangle(rc, back); @@ -940,7 +944,7 @@ void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const ch  	}  } -void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, +void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len,  	ColourAllocated fore, ColourAllocated back) {  	if (pRenderTarget) {  		FillRectangle(rc, back); @@ -949,7 +953,7 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const c  	}  } -void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, +void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len,  	ColourAllocated fore) {  	// Avoid drawing spaces in transparent mode  	for (int i=0;i<len;i++) { @@ -963,7 +967,7 @@ void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, int ybase, con  	}  } -int SurfaceImpl::WidthText(Font &font_, const char *s, int len) { +XYPOSITION SurfaceImpl::WidthText(Font &font_, const char *s, int len) {  	FLOAT width = 1.0;  	SetFont(font_);  	const TextWide tbuf(s, len, unicodeMode, codePage); @@ -981,7 +985,7 @@ int SurfaceImpl::WidthText(Font &font_, const char *s, int len) {  	return int(width + 0.5);  } -void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positions) { +void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions) {  	SetFont(font_);  	int fit = 0;  	const TextWide tbuf(s, len, unicodeMode, codePage); @@ -1004,7 +1008,8 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi  		for (size_t ci=0;ci<count;ci++) {  			position += clusterMetrics[ci].width;  			for (size_t inCluster=0; inCluster<clusterMetrics[ci].length; inCluster++) { -				poses.buffer[ti++] = int(position + 0.5); +				//poses.buffer[ti++] = int(position + 0.5); +				poses.buffer[ti++] = position;  			}  		}  		PLATFORM_ASSERT(ti == static_cast<size_t>(tbuf.tlen)); @@ -1064,7 +1069,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi  	}  } -int SurfaceImpl::WidthChar(Font &font_, char ch) { +XYPOSITION SurfaceImpl::WidthChar(Font &font_, char ch) {  	FLOAT width = 1.0;  	SetFont(font_);  	if (pIDWriteFactory && pTextFormat) { @@ -1082,7 +1087,7 @@ int SurfaceImpl::WidthChar(Font &font_, char ch) {  	return int(width + 0.5);  } -int SurfaceImpl::Ascent(Font &font_) { +XYPOSITION SurfaceImpl::Ascent(Font &font_) {  	FLOAT ascent = 1.0;  	SetFont(font_);  	if (pIDWriteFactory && pTextFormat) { @@ -1114,7 +1119,7 @@ int SurfaceImpl::Ascent(Font &font_) {  	return int(ascent + 0.5);  } -int SurfaceImpl::Descent(Font &font_) { +XYPOSITION SurfaceImpl::Descent(Font &font_) {  	FLOAT descent = 1.0;  	SetFont(font_);  	if (pIDWriteFactory && pTextFormat) { @@ -1135,15 +1140,15 @@ int SurfaceImpl::Descent(Font &font_) {  	return int(descent + 0.5);  } -int SurfaceImpl::InternalLeading(Font &) { +XYPOSITION SurfaceImpl::InternalLeading(Font &) {  	return 0;  } -int SurfaceImpl::ExternalLeading(Font &) { +XYPOSITION SurfaceImpl::ExternalLeading(Font &) {  	return 1;  } -int SurfaceImpl::Height(Font &font_) { +XYPOSITION SurfaceImpl::Height(Font &font_) {  	FLOAT height = 1.0;  	SetFont(font_);  	if (pIDWriteFactory && pTextFormat) { @@ -1165,7 +1170,7 @@ int SurfaceImpl::Height(Font &font_) {  	return int(height);  } -int SurfaceImpl::AverageCharWidth(Font &font_) { +XYPOSITION SurfaceImpl::AverageCharWidth(Font &font_) {  	FLOAT width = 1.0;  	SetFont(font_);  	if (pIDWriteFactory && pTextFormat) { | 
