Edges of characters missing at color boundaries |
Post Reply |
Author | |
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
Posted: 11 June 2009 at 3:43am |
I've just noticed this with 13.1 beta, but it also happens with 13.0.
At the boundary between two differently colored regions of syntax, for some wide characters such as "w" the edge of the character is clipped.
For example:
Look at the right edge of the "w"
To show how this SHOULD appear, see the same file in the Visual Studio editor:
The comparison also shows that your color definitions are not quite the same as the visual studio defaults, which would be nice to fix, but is not a major issue
|
|
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit) Language: Visual Studio 2010 (C++) |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Can't cofirm - at least with existed syntax - color scheme (Top - SyntaxEdit, Bottom - VS2008. If you zoom snapshot you will find that "w" symmetric in both cases - no droped pixels
|
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
Try turning ClearType back on... your screen images suggest that you are not using this.
No ClearType: images display as you suggest
ClearType: clipping error
|
|
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit) Language: Visual Studio 2010 (C++) |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
I did not turn off Clear Type because I never turned it on - looks like this is not part of default setup.
Consider also that I attached jpg snapshots - not bmp!
But you are right - with ClearType it is different ("w" cutted from right side!)
The question - how to deal with it?
|
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
I don't know the code well enough, but it must be a question of clipping boundaries. Perhaps check the ExtTextOut calls in XTPSyntaxEditDrawTextProcessor.cpp, which use ETO_CLIPPED. Presumably you are being too strict about the clipping rectangle by a pixel?
|
|
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit) Language: Visual Studio 2010 (C++) |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
To determine the exact width of a string is extremely hard. You cannot rely on the GetTextExtentPoint32 API. It's not exact. Same goes for GDI+ equivalence. I sense ExtTextOut could suffer from the same...
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Sure - see: pDC->ExtTextOut(nX, nY, ETO_CLIPPED, &rcText, pcszText, nTextLen, NULL); //-------------------------------------------------------- if (m_arBuf_aDx.GetSize() < nTextLen)m_arBuf_aDx.SetSize(nTextLen + 100); int nMaxExtent = m_rcTextRect.Width() + m_nScrollXOffset - m_nNextRowPosX + 30; // 30 is a gap to be surenMaxExtent = max(nMaxExtent, 30); int nFit = 0;LPINT alpDx = ( int*)m_arBuf_aDx.GetData();CSize szText(0, 0); BOOL bResExt = GetTextExtentExPoint(pDC->m_hAttribDC, pcszText, nTextLen, 0, // nMaxExtent,NULL, // &nFit,alpDx, // array of partial string widths&szText // string dimensions); nFit = nTextLen; btw - ClearType is approximation method and it is not ideal for all cases - only as average
You can use ClearType but select in advance options Usual (non ClearType) font smoothing mode - after all works fine
|
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
Are you intending to incorporate this into 13.1.1....?
|
|
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit) Language: Visual Studio 2010 (C++) |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
I don't understand that to incorporate? Advance options is part of ClearType ControlPanel Wizard
|
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
Errr no... I wondered whether anything could be done to prevent the display problem.
|
|
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit) Language: Visual Studio 2010 (C++) |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
In the past I've played a lot with text measuring. So far, the only 100% working solution, I've seen, is to blit the text to a white bitmap and scan for non-white pixels from the right. |
|
PokerMemento - http://www.pokermemento.com/
|
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
I've found a way to fix this and produce much cleaner looking output. Unfortunately it requires a slight modification to CXTPSyntaxEditDrawTextProcessor::DrawRowPart (and probably CXTPSyntaxEditDrawTextProcessor::PrintRowPart) in XTPSyntaxEditDrawTextProcessor.cpp
The problem arises because each successive ExtTextOut call seems to overwrite part of the previous one. To prevent this, the clipping rectangle needs to be set to disallow the overwriting. This can be fixed with a single line of code!!!
Note to Mark Doubson: Could you incorporate this change into DrawRowPart and PrintRowPart for the next release?
|
|
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit) Language: Visual Studio 2010 (C++) |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
See results on XP with ClearType ON - I updated SVN. Thanks
|
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
Thanks! |
|
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit) Language: Visual Studio 2010 (C++) |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Done
|
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
Oops... I've just discovered that the "fix" I suggested introduces a problem if the control scrolls to the right.
The correct correction is as below:
Sorry about that... can you update this again
|
|
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit) Language: Visual Studio 2010 (C++) |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
OK, done
|
|
robin_l
Senior Member Joined: 15 October 2006 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
Thanks! I'll try not to have to change it again
|
|
Product: Xtreme ToolkitPro 2009 (13.4.1)
Platform: Windows 7 Ultimate(64bit) Language: Visual Studio 2010 (C++) |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |