Skip to content

Conversation

@ThanhNguyxn
Copy link

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

  • Closes: Screen Ruler: Please add "points" as an available unit. #39464
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this may be closed
  • Tests: Added/Passed
  • Accessibility: Ensured accessibility standards are met
  • Documentation: Added documentation if needed
  • Localization: Localized resource strings added

Detailed Description of the Pull Request / Additional comments

Changes Made:

  1. Measurement.h

    • Added Point = 16 to the Measurement::Unit enum
    • Increased abbreviations array size from 4 to 5
  2. 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)
    • Added Point case to GetUnitFromIndex() (index 4)
    • Added Point abbreviation loading in InitResources()
    • Added Point case to GetUnitAbbreviation()
    • Added Point to allUnits array for Print function
  3. MeasureToolUI Resources.resw

    • Added MeasurementUnitAbbrPoint with value "pt"
  4. MeasureToolPage.xaml

    • Added new ComboBoxItem for Points option
  5. Settings.UI Resources.resw

    • Added MeasureTool_UnitsOfMeasure_Points.Content with value "Points"

Validation:

The implementation follows the existing patterns for other measurement units (Pixels, Inches, Centimeters, Millimeters) and maintains consistency with the codebase.

Copilot AI review requested due to automatic review settings December 3, 2025 08:16
@ThanhNguyxn
Copy link
Author

@microsoft-github-policy-service agree

Copilot finished reviewing on behalf of ThanhNguyxn December 3, 2025 08:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds "Points" (pt) as a new measurement unit option in Screen Ruler. Points are a standard typography unit where 1 point = 1/72 inch, making this particularly useful for developers working with WPF/XAML, font sizes, and design specifications. The implementation correctly follows the existing pattern used for other measurement units and includes proper conversion logic for both physical DPI and 96 DPI fallback scenarios.

Key Changes

  • Added Point enum value (16) following power-of-2 pattern for bitwise operations
  • Implemented dual-path conversion logic (physical DPI and 96 DPI fallback)
  • Added localized resource strings for UI and abbreviation ("pt")

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/modules/MeasureTool/MeasureToolCore/Measurement.h Added Point=16 to enum and expanded abbreviations array to 5 elements
src/modules/MeasureTool/MeasureToolCore/Measurement.cpp Implemented Point conversion logic, added to GetUnitFromIndex, InitResources, GetUnitAbbreviation, Print function, and allUnits array
src/modules/MeasureTool/MeasureToolUI/Strings/en-us/Resources.resw Added "pt" abbreviation resource string
src/settings-ui/Settings.UI/SettingsXAML/Views/MeasureToolPage.xaml Added Points ComboBoxItem to measurement units dropdown
src/settings-ui/Settings.UI/Strings/en-us/Resources.resw Added "Points" display name resource string

@ThanhNguyxn ThanhNguyxn force-pushed the fix/screen-ruler-points-unit branch 3 times, most recently from 220105e to 5a28b42 Compare December 5, 2025 10:54
This adds 'Points' (pt) as a new measurement unit option in Screen Ruler.
Points are commonly used in typography and design (1 point = 1/72 inch).

- Add Point enum value (16) to Measurement::Unit
- Add conversion logic for Points based on pixel-to-mm ratio
- Add 'pt' abbreviation string resource
- Add Points option to Settings UI ComboBox

Fixes microsoft#39464
@ThanhNguyxn ThanhNguyxn force-pushed the fix/screen-ruler-points-unit branch from 5a28b42 to 1abaf0c Compare December 5, 2025 11:21
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.

1 participant