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

GPII-1716: Windows font-size #506

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d4d416f
GPII-1716: Added font-size support, via SPI_SETNONCLIENTMETRICS and S…
stegru Mar 8, 2017
34e40f2
GPII-1716: Using the appropriate value for the font-size.
stegru Mar 9, 2017
6f77671
Merge remote-tracking branch 'upstream/master' into GPII-1716
stegru Jun 21, 2017
74a7630
GPII-1716: Improved comments.
stegru Jun 23, 2017
02f9c4f
Merge remote-tracking branch 'upstream/master' into GPII-1716
stegru Aug 2, 2017
f54ebf7
Merge remote-tracking branch 'upstream/master' into GPII-1716
stegru Aug 7, 2017
bd67cb1
Merge remote-tracking branch 'upstream/master' into GPII-1716
stegru Sep 8, 2017
e261f54
Merge remote-tracking branch 'upstream/master' into GPII-1716
stegru Oct 10, 2017
52f0a12
Merge remote-tracking branch 'upstream/master' into GPII-1716
stegru Feb 19, 2018
0f96070
GPII-1716: Added solution description
stegru Feb 20, 2018
9f67b19
Merge remote-tracking branch 'upstream/master' into GPII-1716
stegru Apr 3, 2018
1ef6bab
GPII-1716: Improved comment for strange action.
stegru Apr 4, 2018
50ff3f0
GPII-1716: Added fontsize test.
stegru Apr 5, 2018
542ba7a
GPII-1716: Added note about the height hack for font size.
stegru Apr 5, 2018
eeac4eb
GPII-1716: Acceptance tests that work.
stegru Apr 12, 2018
05ad1e7
Merge remote-tracking branch 'upstream/master' into GPII-1716
stegru May 7, 2018
79fe482
Merge remote-tracking branch 'upstream/master' into GPII-1716
stegru Jun 20, 2018
bba86ec
GPII-1716: Fixed test fault
stegru Jun 21, 2018
81da090
GPII-1716: Fixed test fault again
stegru Jun 21, 2018
44308d3
GPII-1716: Fixed test fault again
stegru Jun 21, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gpii/node_modules/matchMakerFramework/test/data/os_win7.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions testData/deviceReporter/acceptanceTests/win7_builtIn.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@

{
"id": "com.microsoft.windows.typingEnhancement"
},

{
"id": "com.microsoft.windows.fontSize"
}

]
4 changes: 4 additions & 0 deletions testData/deviceReporter/installedSolutions.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
"id": "com.microsoft.windows.highContrastTheme"
},

{
"id": "com.microsoft.windows.fontSize"
},

{
"id": "com.microsoft.windows.stickyKeys"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Windows Screen Scaling

## Details

* __Name__: Windows Font Size
* __Id__: com.microsoft.windows.fontSize
* __Platform__: Windows
* __Contact__: Steve Grundell <[email protected]>

## Description

This solution enables the resizing of the font in certain Windows components, without effecting the resolution or DPI setting.

The text of the following elements are re-sized, where the native component is used:
* Window title bar.
* Menus.
* Status bars.
* Icon labels.
* Tooltips.
* Message boxes.

See also:

* [GPII-1716](https://issues.gpii.net/browse/GPII-1716)
* [NONCLIENTMETRICS structure](https://msdn.microsoft.com/library/ff729175)
* [screenDPI solution](com_microsoft_windows_screenDPI.md), to resize all fonts.

## Integration

SystemParametersInfo is called, with SPI_SETNONCLIENTMETRICS. The unit is the approximate height of the font in pixels.

This solution also sets the pixel height of each display element to the its current value. This is because increasing
the font size causes the heights to grow, but decreasing the font (when restoring) leaves the enlarged sizes.

## Testing

The user [gert](../../preferences/gert.json) can be used to test this solution. The font-size should increase.

## Limitations

This doesn't set the size of all text, only those listed above. Some applications may ignore this setting.
189 changes: 189 additions & 0 deletions testData/solutions/win32.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2021,6 +2021,195 @@
]
},

"com.microsoft.windows.fontSize": {
"name": "Windows Font Size",
"contexts": {
"OS": [
{
"id": "win32",
"version": ">=5.0"
}
]
},
"settingsHandlers": {
"configure.NonClientMetrics": {
"type": "gpii.windows.spiSettingsHandler",
"options": {
"getAction": "SPI_GETNONCLIENTMETRICS",
"setAction": "SPI_SETNONCLIENTMETRICS",
"uiParam": "struct_size",
"pvParam": {
"type": "struct",
"name": "NONCLIENTMETRICS"
},
"fWinIni": "SPIF_UPDATEINIFILE|SPIF_SENDCHANGE", // It won't update if these flags aren't set.
Copy link
Member

Choose a reason for hiding this comment

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

Thank God we now have comments!

// The next GET will be different to the last SET, because the value of lfHeight sets the character
// height (negated), but receives it as the cell height.
"verifySettings": false
},
"supportedSettings": {
"CaptionFont": {},
"SmallCaptionFont": {},
"MenuFont": {},
"StatusFont": {},
"MessageFont": {},
"CaptionHeight": {},
"SmCaptionHeight": {},
"MenuHeight": {}
},
"capabilities": [
"http://registry\\.gpii\\.net/common/fontSize"
],
"capabilitiesTransformations": {
"CaptionFont": {
"transform": {
"type": "fluid.transforms.linearScale",
"factor": -1,
"inputPath": "http://registry\\.gpii\\.net/common/fontSize",
"outputPath": "value"
},
"path": {
"literalValue": "pvParam.lfCaptionFont.lfHeight"
}
},
"SmallCaptionFont": {
"transform": {
"type": "fluid.transforms.linearScale",
"factor": -1,
"inputPath": "http://registry\\.gpii\\.net/common/fontSize",
"outputPath": "value"
},
"path": {
"literalValue": "pvParam.lfSmCaptionFont.lfHeight"
}
},
"MenuFont": {
"transform": {
"type": "fluid.transforms.linearScale",
"factor": -1,
"inputPath": "http://registry\\.gpii\\.net/common/fontSize",
"outputPath": "value"
},
"path": {
"literalValue": "pvParam.lfMenuFont.lfHeight"
}
},
"StatusFont": {
"transform": {
"type": "fluid.transforms.linearScale",
"factor": -1,
"inputPath": "http://registry\\.gpii\\.net/common/fontSize",
"outputPath": "value"
},
"path": {
"literalValue": "pvParam.lfStatusFont.lfHeight"
}
},
"MessageFont": {
"transform": {
"type": "fluid.transforms.linearScale",
"factor": -1,
"inputPath": "http://registry\\.gpii\\.net/common/fontSize",
"outputPath": "value"
},
"path": {
"literalValue": "pvParam.lfMessageFont.lfHeight"
}
},
// The following three values are no-ops, which set the value to the same value. The reason behind
// them is that these heights will grow with a larger font, but will not shrink back with a smaller
// one. They're set here so GPII will restore them.
"CaptionHeight": {
"transform": {
"type": "fluid.transforms.literalValue",
"inputPath": "pvParam.iCaptionHeight",
"outputPath": "value"
},
"path": {
"literalValue": "pvParam.iCaptionHeight"
}
},
"SmCaptionHeight": {
"transform": {
"type": "fluid.transforms.literalValue",
"inputPath": "pvParam.iSmCaptionHeight",
"outputPath": "value"
},
"path": {
"literalValue": "pvParam.iSmCaptionHeight"
}
},
"MenuHeight": {
"transform": {
"type": "fluid.transforms.literalValue",
"inputPath": "pvParam.iMenuHeight",
"outputPath": "value"
},
"path": {
"literalValue": "pvParam.iMenuHeight"
}
}
},
"inverseCapabilitiesTransformations": {
"http://registry\\.gpii\\.net/common/fontSize": {
"transform": {
"type": "fluid.transforms.linearScale",
"factor": -1,
"inputPath": "CaptionFont.value"
}
}
}

},
"configure.IconTitle": {
"type": "gpii.windows.spiSettingsHandler",
"options": {
"getAction": "SPI_GETICONTITLELOGFONT",
"setAction": "SPI_SETICONTITLELOGFONT",
"uiParam": "struct_size",
"pvParam": {
"type": "struct",
"name": "LOGFONT"
},
// Because configure.NonClientMetrics is called after this one, fWinIni doesn't need to be set here.
"verifySettings": true
},
"supportedSettings": {
"IconTitleFont": {}
},
"capabilities": [
"http://registry\\.gpii\\.net/common/fontSize"
],
"capabilitiesTransformations": {
"IconTitleFont": {
"transform": {
"type": "fluid.transforms.linearScale",
"factor": -1,
"inputPath": "http://registry\\.gpii\\.net/common/fontSize",
"outputPath": "value"
},
"path": {
"literalValue": "pvParam.lfHeight"
}
}
}
}
},
"configure": [
"settings.configure.IconTitle",
"settings.configure.NonClientMetrics"
],
"restore": [
"settings.configure.IconTitle",
"settings.configure.NonClientMetrics"
],
"isInstalled": [
{
"type": "gpii.deviceReporter.alwaysInstalled"
}
]
},

"com.microsoft.windows.stickyKeys": {
"name": "Windows StickyKeys",
"contexts": {
Expand Down
8 changes: 7 additions & 1 deletion tests/data/preferences/os_win7.json5
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
"value": true
}
},
"http://registry.gpii.net/applications/com.microsoft.windows.fontSize": {
"CaptionFont": {
"path": "pvParam.lfCaptionFont.lfHeight",
"value": -9
},
},
"http://registry.gpii.net/applications/com.microsoft.windows.cursors": {
"No": "%SystemRoot%\\cursors\\aero_unavail_xl.cur",
"Hand": "%SystemRoot%\\cursors\\aero_link_xl.cur",
Expand Down Expand Up @@ -100,7 +106,7 @@
"EnableAutoShiftEngage": 1,
"EnableShiftLock": 1,
"EnableCompatibilityKeyboard": 1,
"EnableDesktopModeAutoInvoke": 1
"EnableDesktopModeAutoInvoke": 1
}
}
}
Expand Down
38 changes: 38 additions & 0 deletions tests/platform/windows/windows-builtIn-testSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,25 @@ gpii.tests.windows.builtIn = [
}
}
}
],
"com.microsoft.windows.fontSize": [
{ // font size settings
"settings": {
"CaptionFont": {
"path": "pvParam.lfCaptionFont.lfHeight",
"value": -9
}
},
"options": {
"getAction": "SPI_GETNONCLIENTMETRICS",
"setAction": "SPI_SETNONCLIENTMETRICS",
"uiParam": "struct_size",
"pvParam": {
"type": "struct",
"name": "NONCLIENTMETRICS"
}
}
}
]
},
"gpii.windows.registrySettingsHandler": {
Expand Down Expand Up @@ -710,6 +729,25 @@ gpii.tests.windows.builtIn = [
}
}
}
],
"com.microsoft.windows.fontSize": [
{ // font size settings
"settings": {
"CaptionFont": {
"path": "pvParam.lfCaptionFont.lfHeight",
"value": -9
}
},
"options": {
"getAction": "SPI_GETNONCLIENTMETRICS",
"setAction": "SPI_SETNONCLIENTMETRICS",
"uiParam": "struct_size",
"pvParam": {
"type": "struct",
"name": "NONCLIENTMETRICS"
}
}
}
]
},
"gpii.windows.registrySettingsHandler": {
Expand Down