Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the text fields font size based on their height #14936

Merged
merged 1 commit into from
May 28, 2022

Conversation

calixteman
Copy link
Contributor

  • right now we're using the font size from the pdf itself but we use an other font
    in the annotation layer. So this size doesn't really make sense and leads to bad
    rendering (see pdf in [annotation] Text widget background color is not taken into account when printed #14928);
  • use a sans-serif font for the fields containing text;
  • text fields allow/disallow scrolling bars (see bit 24 in Ff entry), so use this
    value to hide/show scrollbars in annotation layer.

Comment on lines 922 to 924
// We don't use in the input the font which is in the pdf, so
// using the fontSize can lead to bad display.
// Hence, we set the fontSize in based on the field height.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's improve the grammar a little bit here, e.g. like so:

// We don't use the font, as specified in the PDF document, for the <input>
// element. Hence using the original `fontSize` could look bad, which is why
// it's instead based on the field height.

@@ -18,6 +18,11 @@ import "./compatibility.js";
const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];

// Represent the percentage of the height of a single-line field over
// the font size.
// Acrobat seems to use this value.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Can be moved to the previous line.

@@ -59,10 +59,9 @@
background-image: var(--annotation-unfocused-field-background);
border: 1px solid transparent;
box-sizing: border-box;
font-size: 9px;
font: 9px sans-serif;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this essentially "sneaking" in a fix for issue #14736 here?

If so, that's probably good to mention explicitly in the commit message (and linking the issue such that it's closed).

height: 100%;
margin: 0;
padding: 0 3px;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this essentially "sneaking" in a fix for issue #14301 here?

If so, that's probably good to mention explicitly in the commit message (and linking the issue such that it's closed).


Given the discussion in the issue, does this generally work without problems?
Is this properly covered by existing tests, or does new reference test(s) need to be added?

@calixteman
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/5b8a9612200a823/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/17a3ca8a91f3fef/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/5b8a9612200a823/output.txt

Total script time: 27.11 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 52

Image differences available at: http://54.241.84.105:8877/5b8a9612200a823/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/17a3ca8a91f3fef/output.txt

Total script time: 29.61 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 22

Image differences available at: http://54.193.163.58:8877/17a3ca8a91f3fef/reftest-analyzer.html#web=eq.log

@calixteman calixteman force-pushed the input_font_size branch 2 times, most recently from c5a64db to 52aa598 Compare May 20, 2022 16:44
@calixteman
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/45c80418c2cccaa/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/8157e09d3166735/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/45c80418c2cccaa/output.txt

Total script time: 19.48 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 709
  different ref/snapshot: 21

Image differences available at: http://54.241.84.105:8877/45c80418c2cccaa/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/8157e09d3166735/output.txt

Total script time: 27.73 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 14

Image differences available at: http://54.193.163.58:8877/8157e09d3166735/reftest-analyzer.html#web=eq.log

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented May 20, 2022

  • It seems that a border in issue13447-annotations-page1 is now missing, was that intended?
  • There are some missing borders in issue12716-page1 and issue12716-hidpi-page1, which I'm guessing isn't intended?

@calixteman
Copy link
Contributor Author

About:

  • issue13447-annotations-page1: in Acrobat there are no yellow border around the icon and and in specs, in Table 164, the C entry is used here for "The title bar of the annotation’s pop-up window". The C entry is only used as the border color for the Link annotation.
  • issue12716-page1 there is a very small text field with dimensions 0.025in x 0.025in, before the patch it looks rectangular
    image
    and with the patch it looks like a square
    image
    and it's likely due to the padding change

@calixteman
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 1

Live output at: http://54.241.84.105:8877/fb19329172665ce/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 1

Live output at: http://54.193.163.58:8877/1f1126e3bb423ec/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/fb19329172665ce/output.txt

Total script time: 25.93 mins

  • Font tests: Passed
  • Unit tests: FAILED
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 52

Image differences available at: http://54.241.84.105:8877/fb19329172665ce/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/1f1126e3bb423ec/output.txt

Total script time: 28.15 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 14

Image differences available at: http://54.193.163.58:8877/1f1126e3bb423ec/reftest-analyzer.html#web=eq.log

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm overlooking something, I don't believe that the following override is necessary now:

r=me, with the above fixed since this looks overall reasonable to me; thank you!

- right now we're using the font size from the pdf itself but we use an other font
  in the annotation layer. So this size doesn't really make sense and leads to bad
  rendering (see pdf in mozilla#14928);
- use a sans-serif font for the fields containing text (fix issue mozilla#14736);
- remove useless padding in text-based fields (fix issue mozilla#14301);
- text fields allow/disallow scrolling bars (see bit 24 in Ff entry), so use this
  value to hide/show scrollbars in annotation layer.
@calixteman
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/30ebe9859ac825f/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/b5e56710e3a4703/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/30ebe9859ac825f/output.txt

Total script time: 26.10 mins

  • Font tests: Passed
  • Unit tests: FAILED
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 51

Image differences available at: http://54.241.84.105:8877/30ebe9859ac825f/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/b5e56710e3a4703/output.txt

Total script time: 28.04 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 14

Image differences available at: http://54.193.163.58:8877/b5e56710e3a4703/reftest-analyzer.html#web=eq.log

@calixteman calixteman merged commit 9bdf27e into mozilla:master May 28, 2022
@calixteman
Copy link
Contributor Author

/botio makeref

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_makeref from @calixteman received. Current queue size: 1

Live output at: http://54.193.163.58:8877/3c9f771ca4dcdaa/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_makeref from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/39b0d65d21af1af/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/39b0d65d21af1af/output.txt

Total script time: 22.75 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/3c9f771ca4dcdaa/output.txt

Total script time: 21.78 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants