-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1cb1a2
commit bba2f5b
Showing
4 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
include("engines.wine.engine.object"); | ||
|
||
/** | ||
* Force the Font smoothing | ||
* @param {string} mode ("RGB", "BGR" or "Gray Scale") | ||
* @returns {Wine} Wine object | ||
*/ | ||
Wine.prototype.fontSmoothing = function (mode) { | ||
let fontSmoothingType; | ||
let fontSmoothingOrientation; | ||
if (mode === "RGB") { | ||
fontSmoothingType = "2"; | ||
fontSmoothingOrientation = "1"; | ||
} | ||
else if (mode === "BGR") { | ||
fontSmoothingType = "2"; | ||
fontSmoothingOrientation = "0"; | ||
} | ||
else if (mode === "Gray Scale"){ | ||
fontSmoothingType = "1"; | ||
fontSmoothingOrientation = "1"; | ||
} | ||
else { | ||
throw tr("Unknown font smoothing mode: \"{0}\"", mode); | ||
} | ||
|
||
const regeditFileContent = | ||
"REGEDIT4\n" + | ||
"\n" + | ||
"[HKEY_CURRENT_USER\\Control Panel\\Desktop]\n" + | ||
"\"FontSmoothing\"=\"2\"\n" + | ||
"\"FontSmoothingType\"=dword:0000000" + fontSmoothingType + "\n" + | ||
"\"FontSmoothingGamma\"=dword:00000578\n" + | ||
"\"FontSmoothingOrientation\"=dword:0000000" + fontSmoothingOrientation + "\n"; | ||
|
||
this.regedit().patch(regeditFileContent); | ||
return this; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"scriptName" : "Font smoothing", | ||
"id" : "engines.wine.plugins.font_smoothing", | ||
"compatibleOperatingSystems" : [ | ||
"MACOSX", | ||
"LINUX" | ||
], | ||
"testingOperatingSystems" : [], | ||
"free" : true, | ||
"requiresPatch" : false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
include("engines.wine.engine.object"); | ||
include("engines.wine.plugins.regedit"); | ||
include("engines.wine.plugins.font_smoothing"); | ||
|
||
/** | ||
* Setting to set the Fonts Smoothing | ||
*/ | ||
var settingImplementation = { | ||
_options: [tr("Default"), tr("RGB"), tr("BGR"), tr("Gray Scale")], | ||
|
||
getText: function () { | ||
return tr("Fonts Smoothing"); | ||
}, | ||
getOptions: function () { | ||
return this._options; | ||
}, | ||
getCurrentOption: function (container) { | ||
const fontSmoothing = new Wine() | ||
.prefix(container) | ||
.regedit() | ||
.fetchValue(["HKEY_CURRENT_USER", "Control Panel", "Desktop", "FontSmoothing"]); | ||
|
||
const fontSmoothingType = new Wine() | ||
.prefix(container) | ||
.regedit() | ||
.fetchValue(["HKEY_CURRENT_USER", "Control Panel", "Desktop", "FontSmoothingType"]); | ||
|
||
const fontSmoothingOrientation = new Wine() | ||
.prefix(container) | ||
.regedit() | ||
.fetchValue(["HKEY_CURRENT_USER", "Control Panel", "Desktop", "FontSmoothingOrientation"]); | ||
|
||
let index; | ||
|
||
if (fontSmoothing == 1) { | ||
index = 0; | ||
} | ||
else { | ||
if (fontSmoothingType == 2) { | ||
if (fontSmoothingOrientation == 1) { | ||
index = 1; | ||
} | ||
else { | ||
index = 2; | ||
} | ||
} | ||
else if (fontSmoothingType == 1) { | ||
index = 3; | ||
} | ||
} | ||
|
||
return this._options[index]; | ||
}, | ||
setOption: function (container, optionIndex) { | ||
if (0 === optionIndex) { | ||
const regeditFileContent = | ||
"REGEDIT4\n" + | ||
"\n" + | ||
"[HKEY_CURRENT_USER\\Control Panel\\Desktop]\n" + | ||
"\"FontSmoothing\"=\"1\"\n" + | ||
"\"FontSmoothingType\"=dword:00000001\n" + | ||
"\"FontSmoothingGamma\"=dword:00000000\n" + | ||
"\"FontSmoothingOrientation\"=dword:00000001"; | ||
|
||
new Wine() | ||
.prefix(container) | ||
.regedit() | ||
.patch(regeditFileContent); | ||
} | ||
else { | ||
new Wine() | ||
.prefix(container) | ||
.fontSmoothing(this._options[optionIndex]); | ||
} | ||
} | ||
}; | ||
|
||
/* exported Setting */ | ||
var Setting = Java.extend(org.phoenicis.engines.EngineSetting, settingImplementation); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"scriptName" : "Font smoothing", | ||
"id" : "engines.wine.settings.font_smoothing", | ||
"compatibleOperatingSystems" : [ | ||
"MACOSX", | ||
"LINUX" | ||
], | ||
"testingOperatingSystems" : [], | ||
"free" : true, | ||
"requiresPatch" : false | ||
} |