Skip to content

Make font size measurements translatable#13575

Merged
seanbudd merged 9 commits into
masterfrom
fix-13573
Jun 17, 2022
Merged

Make font size measurements translatable#13575
seanbudd merged 9 commits into
masterfrom
fix-13573

Conversation

@seanbudd

@seanbudd seanbudd commented Apr 4, 2022

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #13573

Summary of the issue:

"pt" when reporting font size measurements is not translatable.
Font size measurements are reported inconsistently, for example in excel and PowerPoint are reported as "11.0" instead of "11 pt".

Description of how this pull request fixes the issue:

Makes the font size measurement "pt" translatable across APIs.

Browsers provide "font-size" attribute directly as "12pt|px|em|%|rem|ex" or "large", "small", etc.
This requires a more strategic approach for catching each font-size case and replacing it with a translated string.
Documentation has been added for this.
https://developer.mozilla.org/en-US/docs/Web/CSS/font-size

Testing strategy:

Unit testing has been added to test the more complicated parsing of the browser font-size attribute.

Manual testing

  • Enable "font size" reporting in "Document Formatting".
  • Added a translation to /de/nvda.po.
    msgctxt "font size"
    msgid "%s pt"
    msgstr "%s Punkt"
  • Switched NVDA language to German.
  • Confirm that font-size is reported as "xx Punkt" when navigating text in:
    • adobe reader (unable to test due to x64 bug, 774f1ea has been tested)
    • word (with and without UIA)
    • excel (with and without UIA)
    • powerpoint
    • Wordpad
    • Libre Office Writer (soffice)
    • Notepad++ (scintilla)
    • JAB (unable to test, unknown relevant software)
    • MSHTML (tested with IE mode for Edge on Win 11)
    • IAccessible (Chrome, Firefox)

Known issues with pull request:

None

Change log entries:

Changes
- Font size measurements are now translatable in NVDA. (#13573)

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English

@seanbudd seanbudd requested a review from a team as a code owner April 4, 2022 05:19
@seanbudd seanbudd requested a review from michaelDCurran April 4, 2022 05:19
@AppVeyorBot

This comment was marked as off-topic.

@AppVeyorBot

This comment was marked as off-topic.

@lukaszgo1 lukaszgo1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This fix is incomplete as it affects only UIA controls. The same should be done for all other places where NVDA can report font size.

@seanbudd seanbudd requested a review from michaelDCurran April 6, 2022 03:29
Comment thread source/appModules/powerpnt.py

@michaelDCurran michaelDCurran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Okay. If I ignore the line ending changes, everything looks good to me.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit c6eb17399b

@CyrilleB79

Copy link
Copy Markdown
Contributor

Regarding tests, all the modified code paths are not tested. It would be interesting to test them (and indicate it) or at least indicate that they are not tested (and why). Exemples of untested code paths:

  • edit (e.g. Wordpad & Wordpad + trick)
  • soffice (e.g. Libre Office Writer)
  • JAB
    Not tested, but the font size in browsers does not seem to be translated (MSHtml, IAccessible).
    For a more exhaustive of all the interface that should be considered and tested, please look at Do not report "baseline" on formatting information request #11897's initial description (test paragraph).

Comment thread source/NVDAObjects/window/excel.py Outdated
@seanbudd seanbudd marked this pull request as draft April 7, 2022 23:20
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 930ca8d353

@seanbudd seanbudd changed the title Make font size pt translatable Make font size measurements translatable Jun 16, 2022
@seanbudd seanbudd marked this pull request as ready for review June 16, 2022 04:03
@seanbudd seanbudd requested a review from feerrenrut June 16, 2022 04:03
@seanbudd

Copy link
Copy Markdown
Member Author

Thanks @CyrilleB79 - I've fixed this up now. The case for browsers is quite complex, a start for covering each font-size case for browser has been added to this PR.

Comment thread nvdaHelper/remote/displayModel.cpp Outdated
Comment thread source/controlTypes/formatFields.py Outdated

@feerrenrut feerrenrut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Generally looks good (assuming actions from your self review are committed).

You might consider adding an integration test with chrome to ensure that the font-size is reported correctly end-to-end.

Comment thread source/NVDAObjects/window/winword.py
@CyrilleB79

Copy link
Copy Markdown
Contributor

@seanbudd, @lukaszgo1 I feel a bit picky with such remark but prefer to have things explicit.

Technically, do we consider that removing imports (or converting star imports in explicit imports) are an API change?
Or do only the variable / class / function directly defined in a module belong to its API (off course if they are not defined as private, i.e. starting with underscore)?

Thanks for clarification.

@lukaszgo1

Copy link
Copy Markdown
Contributor

I feel a bit picky with such remark but prefer to have things explicit.

Technically, do we consider that removing imports (or converting star imports in explicit imports) are an API change? Or do only the variable / class / function directly defined in a module belong to its API (off course if they are not defined as private, i.e. starting with underscore)?

Unused imports were removed in various PR's for non compatibility breaking releases, so IMO these are not a part of public API. Removing star imports is just another case of removing unused imports, and should not be treated differently. For one example where similar cleanup was performed in non compat breaking release see #12924.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 497665179d

@seanbudd seanbudd merged commit 6f211a1 into master Jun 17, 2022
@seanbudd seanbudd deleted the fix-13573 branch June 17, 2022 08:20
@nvaccessAuto nvaccessAuto added this to the 2022.3 milestone Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The name of the unit for the font size in the formatting information provided by NVDA is not localized

7 participants