Le 08/05/2013 11:45, Sam Edwards a écrit :
After feedback from Dmitry (thanks!), I redid this patch with the following changes:
- I misunderstood before what the test did; I initially thought this
was just a workaround to get aveWidth to behave, but as it turns out, Windows has the same "maximum ratio of 100" limit. I changed the comment to reflect that; hopefully this stops someone else from making my mistake. :)
- Negative aveWidth checking is removed. I agree that there should be
a test to put this in, but Windows treats negative aveWidths as invalid (according to Aric), so it can't be tested on Windows. That's a much bigger mess than a simple "fix divide by zero" patch is worth.
- The division is done differently, to avoid potential overflow
problems. The result of the comparison is still exactly the same as before the patch, except zero values are now handled gracefully.
This supersedes 96111 (which, I forgot to mention before, supersedes 96053 and 96047).
Best, Sam
+ if (font->aveWidth && + (font->aveWidth - 1) / 100 >= font->potm->otmTextMetrics.tmHeight) { - if ((font->aveWidth + font->potm->otmTextMetrics.tmHeight - 1) / font->potm->otmTextMetrics.tmHeight > 100) - {
Hi Sam,
The test in the if is not that long. Shouldn't this fit into a single like as the previous test?
Christian