HyperHCl / gdipp

Automatically exported from code.google.com/p/gdipp
0 stars 0 forks source link

Width of CJK character in UltraEdit is too short #98

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Render UltraEdit (tested on version 14, 15 and 16) with gdipp.
2. Type any CJK character.

What is the expected output? What do you see instead?
The width of all CJK characters are too short, which makes cursor position 
incorrect. Worse, text on certain controls are clipped at the tail.

Original issue reported on code.google.com by crendk...@gmail.com on 22 Aug 2010 at 11:52

GoogleCodeExporter commented 8 years ago
gdipp 0.8.2 or earlier versions are not affected.

Original comment by crendk...@gmail.com on 23 Aug 2010 at 12:06

GoogleCodeExporter commented 8 years ago
Only the FreeType renderer is affected.

From the result of black box test, I think it is UltraEdit who made the 
mistake. (Technical details ahead. Ignore if you don't aware) The width of 
glyph runs are firstly retrieved by calling GetTextExtentPoint32W, then drawn 
by calling ExtTextOutW. In gdipp 0.9, both APIs are replaced. The new 
GetTextExtentPoint32W returns raw width of the FreeType glyphs, each of which 
is 1 pixel shorter than the glyphs rendered by ClearType. UltraEdit appoints 
lpDx array when calling ExtTextOutW, whose elements are the width of ClearType 
glyphs. Therefore, while GetTextExtentPoint32W returns FreeType width, which is 
used to clip text rectangle, ExtTextOutW actually renders in the ClearType 
width. UltraEdit should either call ExtTextOutW without lpDx array, or clip 
text rectangle in the width of the sum of lpDx array.

To fix it, choose a renderer other than FreeType, or simply exclude UltraEdit 
from rendering.

Original comment by crendk...@gmail.com on 23 Aug 2010 at 12:17

GoogleCodeExporter commented 8 years ago
After observing same symptom in other applications and revisiting this problem, 
I found a problem cure. Working on it.

Original comment by crendk...@gmail.com on 5 Sep 2010 at 2:30

GoogleCodeExporter commented 8 years ago
Done by replacing ScriptPlace.

Original comment by crendk...@gmail.com on 15 Sep 2010 at 8:33