mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-31 15:12:28 +00:00 
			
		
		
		
	Font width is customizable. Introducing non squared pixels resolutions.
This commit is contained in:
		| @@ -120,6 +120,9 @@ Item{ | |||||||
|     property var fontScalingList: [0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5] |     property var fontScalingList: [0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5] | ||||||
|     property int fontScalingIndex: 5 |     property int fontScalingIndex: 5 | ||||||
|  |  | ||||||
|  |     property real fontWidth: 1.0 | ||||||
|  |     onFontWidthChanged: handleFontChanged(); | ||||||
|  |  | ||||||
|     function setScalingIndex(newScaling){ |     function setScalingIndex(newScaling){ | ||||||
|         fontScalingIndex = newScaling; |         fontScalingIndex = newScaling; | ||||||
|         fontScalingChanged(); |         fontScalingChanged(); | ||||||
|   | |||||||
| @@ -32,13 +32,6 @@ Item{ | |||||||
|  |  | ||||||
|     ListModel{ |     ListModel{ | ||||||
|         id: fontlist |         id: fontlist | ||||||
|         ListElement{ |  | ||||||
|             text: "Commodore PET 2Y (1977)" |  | ||||||
|             source: "fonts/1977-commodore-pet/COMMODORE_PET_2y.ttf" |  | ||||||
|             lineSpacing: 2 |  | ||||||
|             pixelSize: 16 |  | ||||||
|             baseScaling: 3.0 |  | ||||||
|         } |  | ||||||
|         ListElement{ |         ListElement{ | ||||||
|             text: "Commodore PET (1977)" |             text: "Commodore PET (1977)" | ||||||
|             source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf" |             source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf" | ||||||
|   | |||||||
| @@ -32,13 +32,6 @@ Item{ | |||||||
|  |  | ||||||
|     ListModel{ |     ListModel{ | ||||||
|         id: fontlist |         id: fontlist | ||||||
|         ListElement{ |  | ||||||
|             text: "Commodore PET 2Y (1977)" |  | ||||||
|             source: "fonts/1977-commodore-pet/COMMODORE_PET_2y.ttf" |  | ||||||
|             lineSpacing: 2 |  | ||||||
|             pixelSize: 16 |  | ||||||
|             baseScaling: 3.0 |  | ||||||
|         } |  | ||||||
|         ListElement{ |         ListElement{ | ||||||
|             text: "Commodore PET (1977)" |             text: "Commodore PET (1977)" | ||||||
|             source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf" |             source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf" | ||||||
|   | |||||||
| @@ -104,7 +104,9 @@ Item{ | |||||||
|             font.pixelSize = pixelSize; |             font.pixelSize = pixelSize; | ||||||
|             font.family = fontLoader.name; |             font.family = fontLoader.name; | ||||||
|  |  | ||||||
|             width = Qt.binding(function() {return Math.floor(terminalContainer.width / screenScaling);}); |             var fontWidth = 1.0 / shadersettings.fontWidth; | ||||||
|  |  | ||||||
|  |             width = Qt.binding(function() {return Math.floor(fontWidth * terminalContainer.width / screenScaling);}); | ||||||
|             height = Qt.binding(function() {return Math.floor(terminalContainer.height / screenScaling);}); |             height = Qt.binding(function() {return Math.floor(terminalContainer.height / screenScaling);}); | ||||||
|  |  | ||||||
|             setLineSpacing(lineSpacing); |             setLineSpacing(lineSpacing); | ||||||
|   | |||||||
| @@ -87,6 +87,21 @@ Tab{ | |||||||
|                         text: shadersettings.fontScalingList[scalingChanger.value].toFixed(2) |                         text: shadersettings.fontScalingList[scalingChanger.value].toFixed(2) | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  |                 Text{ text: qsTr("Font Width") } | ||||||
|  |                 RowLayout{ | ||||||
|  |                     Layout.fillWidth: true | ||||||
|  |                     Slider{ | ||||||
|  |                         Layout.fillWidth: true | ||||||
|  |                         id: widthChanger | ||||||
|  |                         onValueChanged: shadersettings.fontWidth = value; | ||||||
|  |                         value: shadersettings.fontWidth | ||||||
|  |                         stepSize: 0.05 | ||||||
|  |                         Component.onCompleted: minimumValue = 0.5 //Without this value gets set to 0.5 | ||||||
|  |                     } | ||||||
|  |                     Text{ | ||||||
|  |                         text: Math.round(widthChanger.value * 100) + "%" | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         GroupBox{ |         GroupBox{ | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ Window { | |||||||
|     id: settings_window |     id: settings_window | ||||||
|     title: qsTr("Settings") |     title: qsTr("Settings") | ||||||
|     width: 640 |     width: 640 | ||||||
|     height: 450 |     height: 480 | ||||||
|  |  | ||||||
|     property int tabmargins: 15 |     property int tabmargins: 15 | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user