win32u: Fix rendering of the rotated and scaled text.
These patches make a test case attached to the bug https://bugs.winehq.org/show_bug.cgi?id=33190 work.
Merge request reports
Activity
requested review from @huw
250 246 } 251 247 252 248 /* scale width and height but don't mirror them */ 253 249 254 250 static inline INT width_to_LP( DC *dc, INT width ) 255 251 { 256 return GDI_ROUND( (double)width * fabs( dc->xformVport2World.eM11 )); 252 return INTERNAL_XDSTOWS( dc, width ); 257 253 } 258 254 259 255 static inline INT height_to_LP( DC *dc, INT height ) 260 256 { 261 return GDI_ROUND( (double)height * fabs( dc->xformVport2World.eM22 )); 257 return INTERNAL_YDSTOWS( dc, height ); 258 } 259 Hi Huw,
thanks for the review.
/* scale width and height but don't mirror them */
static inline INT width_to_LP( DC *dc, INT width ) {
- return GDI_ROUND( (double)width * fabs( dc->xformVport2World.eM11 ));
- return INTERNAL_XDSTOWS( dc, width ); }
static inline INT height_to_LP( DC *dc, INT height ) {
- return GDI_ROUND( (double)height * fabs( dc->xformVport2World.eM22 ));
- return INTERNAL_YDSTOWS( dc, height ); +}
So now
INTERNAL_XDSTOWS()
andwidth_to_LP()
are the same. If this is really what we want we should unify them before changing the implementation.Do you mean by unifying adding a patch that replaces width_to_LP() by INTERNAL_XDSTOWS() and height_to_LP() by INTERNAL_YDSTOWS()? If yes, then with current implementation this leads to test failures.
Also,
hypot()
may be useful here.Thanks.
changed this line in version 2 of the diff
added 672 commits
-
209c75b1...174bb777 - 670 commits from branch
wine:master
- 6c8f9f11 - win32u: Fix device<->world width/height converters.
- 70fd2ace - win32u: NtGdiExtTextOutW() should translate x,y from logical to device units at the last step.
-
209c75b1...174bb777 - 670 commits from branch
Sorry about the delay.
It seems to me we could have some tests for this. e.g. create a font with an identity world transform, measure its metrics and some of its glyph widths, then add a transform and use the identity metrics/widths to compute the expected metrics/widths based on the new transform.
Also, if we're going to do some function renaming, could we go from e.g. INTERNAL_YDSTOWS to the vastly more readable height_to_LP rather than the other way around? Could we please do this renaming in a separate commit, so that the actual changes end up being in a smaller commit?
Edited by Huw DaviesThanks for the review. I considered adding some tests, however pretty soon figured out that Wine doesn't have a metrics compatible scaleable font with Windows, our Tahoma has pretty different metrics, and that makes the tests meaningless. So, instead I used a test application attached to the mentioned in the description bug report.
Using height_to_LP instead of INTERNAL_YDSTOWS sounds reasonable.
I considered adding some tests, however pretty soon figured out that Wine doesn't have a metrics compatible scaleable font with Windows, our Tahoma has pretty different metrics, and that makes the tests meaningless.
Did you try calculating the expected metrics from the metrics obtained without a world transform?
added 6306 commits
-
70fd2ace...f3843ea1 - 6301 commits from branch
wine:master
- 3435d156 - win32u: Use correct helper for converting width to device units.
- 0c28e56a - win32u: Use slightly more readable names for DP/LP converters.
- 4bdfcc54 - gdi32/tests: Add some tests for rotated font metrics.
- 3fa748cc - win32u: Fix device<->world width/height converters.
- 18668136 - win32u: NtGdiExtTextOutW() should translate x,y from logical to device units at the last step.
Toggle commit list-
70fd2ace...f3843ea1 - 6301 commits from branch