THausherr commented on PR #532:
URL: https://github.com/apache/pdfbox/pull/532#issuecomment-5846165822

   Copilot writes this:
   
   fontbox/src/main/java/org/apache/fontbox/ttf/Fixed.java:83-85 — ceil() is 
incorrect for negative non-integral values. The implementation (value + 63) & 
~63 only behaves like a ceiling for some negative inputs. For example, 
ceil(-65) returns -128, but the mathematical ceiling in F26Dot6 should be -64. 
Since the interpreter exposes this through the TrueType CEILING opcode, fonts 
using CEILING with negative distances will receive a value one pixel too small, 
potentially shifting hinted points and causing incorrect outlines. Please 
implement ceiling explicitly for signed values and add negative-value tests, 
e.g. ceil(-1) == 0, ceil(-63) == 0, ceil(-65) == -64, and ceil(-128) == -128.
   
   I have no idea if this is realistic, i.e. if such values can occur (I tried 
with the regression tests and found nothing). Also this part of the code was 
there before so I wonder why copilot didn't complain until now.
   
   Btw fontbox has not only some more ttf fonts in the repository, it also 
loads some ttf fonts during the tests. There's a dejavu font you also did, plus 
Keyboard.ttf, NotoEmoji-Regular.ttf, NotoMono-Regular.ttf, ipag.ttf. They are 
in the directory target/fonts.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to