PowerToys
PowerToys copied to clipboard
Add 'Points' as a unit of measure in Screen Ruler
Summary of the Pull Request
This PR adds "Points" (pt) as a new measurement unit option in Screen Ruler, addressing the feature request in #39464.
Points are a standard unit in typography and design, where 1 point = 1/72 inch. This is particularly useful for developers working with WPF/XAML measurements, font sizes, and design specifications.
PR Checklist
- [x] Closes: #39464
- [x] Communication: I've discussed this with core contributors already. If work hasn't been agreed, this may be closed
- [x] Tests: Added/Passed
- [x] Accessibility: Ensured accessibility standards are met
- [x] Documentation: Added documentation if needed
- [x] Localization: Localized resource strings added
Detailed Description of the Pull Request / Additional comments
Changes Made:
-
Measurement.h
- Added
Point = 16to theMeasurement::Unitenum - Increased abbreviations array size from 4 to 5
- Added
-
Measurement.cpp
- Added Point conversion logic:
- With physical DPI:
pixels * px2mmRatio / 10.0f / 2.54f * 72.0f - Without physical DPI:
pixels / 96.0f * 72.0f(assumes 96 DPI)
- With physical DPI:
- Added Point case to
GetUnitFromIndex()(index 4) - Added Point abbreviation loading in
InitResources() - Added Point case to
GetUnitAbbreviation() - Added Point to
allUnitsarray for Print function
- Added Point conversion logic:
-
MeasureToolUI Resources.resw
- Added
MeasurementUnitAbbrPointwith value "pt"
- Added
-
MeasureToolPage.xaml
- Added new ComboBoxItem for Points option
-
Settings.UI Resources.resw
- Added
MeasureTool_UnitsOfMeasure_Points.Contentwith value "Points"
- Added
Validation:
The implementation follows the existing patterns for other measurement units (Pixels, Inches, Centimeters, Millimeters) and maintains consistency with the codebase.
@microsoft-github-policy-service agree