[JW Lua] Long-standing bug in GetAdvanceWidthPoints

Robert Patterson robert at robertgpatterson.com
Mon Sep 18 04:57:36 CEST 2023


Hello List,

I have just discovered that GetAdvanceWidthPoints is misnamed. The unit is
actually being returned is a platform-dependent value that may be the pixel
width. (On macOS it is actually points, but on Windows it is something else
wildly other than points.)

To get actual 72 dpi points, you need to divide GetAdvanceWidthEVPUs by 4.
This will give the correct value on both platforms. My question for this
group is how to mitigate/address this bug.

   - At a minimum, I could add a warning in the docs.
   - I could rename the function to match what it returns.
   - I could modify the function to actually return 72 dpi points.

What is the wisest approach?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20230917/0b26dbb6/attachment.html>


More information about the JWLua mailing list