Vincent Povirk madewokherd@gmail.com wrote:
For instance accoding to the tests MeasureCharacterRanges adds extra space only to X, while GdipMeasureString and GdipDrawString also add extra space to Height and Width of the bounding rectangle.
That doesn't sound inconsistent to me, it's just that those functions are measuring different things. CharacterRanges tells you where the individual characters are (and is resolution-dependent as I understand it), while MeasureString/DrawString only give information about full lines and are resolution-independent (they may have to cut into the padding depending on the hinting at that resolution, but users of these functions can ignore that and assume the entire line will scale to any resolution).
Probably the callback just needs another argument specifying where the first character is. (For tabs we may need a position for subsequent characters as well, or multiple callbacks for a single line.)
That's the whole reason of my comment: "at the moment I don't see how gdip_format_string() can be used to do this in one place, but if somebody has an idea how to do that - patches are welcome."
Right now I just want to implement correct behaviour to make the tests pass, nothing more. Any optimizations, simplifications, or even redesign could be done later.
I don't think we should make MeasureString/DrawString resolution-independent because that also makes native's text incredibly ugly, and would greatly increase the complexity of gdip_format_string.
That sounds like a pure guess, not related to my patches.