Re: [3/3] gdiplus: GdipMeasureCharacterRanges should respect device units and transformations.
GetTextExtentExPointW(hdc, string + index, range_start - index, INT_MAX, NULL, NULL, &range_size); - range_rect.X = bounds->X + range_size.cx; + range_rect.X = bounds->X / args->rel_width + range_size.cx;
GetTextExtentExPointW(hdc, string + index, range_end - index, INT_MAX, NULL, NULL, &range_size); - range_rect.Width = (bounds->X + range_size.cx) - range_rect.X; + range_rect.Width = (bounds->X / args->rel_width + range_size.cx) - range_rect.X;
Shouldn't you be scaling range_size.cx as well?
Vincent Povirk <madewokherd(a)gmail.com> wrote:
GetTextExtentExPointW(hdc, string + index, range_start - index, INT_MAX, NULL, NULL, &range_size); - range_rect.X = bounds->X + range_size.cx; + range_rect.X = bounds->X / args->rel_width + range_size.cx;
GetTextExtentExPointW(hdc, string + index, range_end - index, INT_MAX, NULL, NULL, &range_size); - range_rect.Width = (bounds->X + range_size.cx) - range_rect.X; + range_rect.Width = (bounds->X / args->rel_width + range_size.cx) - range_rect.X;
Shouldn't you be scaling range_size.cx as well?
No, range_size is already in pixels. -- Dmitry.
Vincent Povirk <madewokherd(a)gmail.com> wrote:
Shouldn't you be scaling range_size.cx as well?
No, range_size is already in pixels.
So is bounds. I think you need to scale both of them to world units.
You are right, somehow I missed that, thanks. -- Dmitry.
participants (2)
-
Dmitry Timoshkov -
Vincent Povirk