feat: add font size scaling setting

Adds an option in Appearance Settings to adjust font size scaling,
improving accessibility and user customization.
This commit is contained in:
Kristen McWilliam
2025-10-31 13:47:33 -04:00
parent 7def8c066c
commit 25c0bc131a
9 changed files with 48 additions and 1 deletions

View File

@@ -66,6 +66,10 @@
</entry>
</group>
<group name="Timeline">
<entry name="FontScale" type="double">
<label>Scaling factor for font sizes</label>
<default>1.0</default>
</entry>
<entry name="ShowAvatarInTimeline" type="bool">
<label>Show avatar in the timeline</label>
<default>true</default>

View File

@@ -91,6 +91,7 @@ Components.AbstractMaximizeComponent {
color: Kirigami.Theme.textColor
font.family: "monospace"
font.pointSize: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
Kirigami.SpellCheck.enabled: false

View File

@@ -263,6 +263,7 @@ QQC2.Control {
wrapMode: TextEdit.Wrap
// This has to stay PlainText or else formatting starts breaking in strange ways
textFormat: TextEdit.PlainText
font.pointSize: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
Accessible.description: placeholderText

View File

@@ -4,6 +4,7 @@
import QtQuick
import QtQuick.Controls as QQC2
import org.kde.kirigami as Kirigami
import org.kde.neochat
QQC2.ItemDelegate {
id: root
@@ -29,6 +30,7 @@ QQC2.ItemDelegate {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.family: "emoji"
font.pointSize: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
Kirigami.Icon {
width: Kirigami.Units.gridUnit * 0.5

View File

@@ -77,6 +77,7 @@ QQC2.Control {
color: Kirigami.Theme.textColor
font.family: "monospace"
font.pointSize: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
Kirigami.SpellCheck.enabled: false

View File

@@ -58,6 +58,7 @@ QQC2.Control {
selectionColor: Kirigami.Theme.highlightColor
font.italic: true
font.pointSize: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
onSelectedTextChanged: root.selectedTextChanged(selectedText)

View File

@@ -51,6 +51,7 @@ Flow {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: reactionDelegate.textContent
font.pointSize: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
background: null
wrapMode: TextEdit.NoWrap
textFormat: Text.RichText

View File

@@ -67,7 +67,9 @@ TextEdit {
selectedTextColor: Kirigami.Theme.highlightedTextColor
selectionColor: Kirigami.Theme.highlightColor
font {
pointSize: !root.isReply && QmlUtils.isEmoji(display) ? Kirigami.Theme.defaultFont.pointSize * 4 : Kirigami.Theme.defaultFont.pointSize
pointSize: !root.isReply && QmlUtils.isEmoji(display)
? Kirigami.Theme.defaultFont.pointSize * 4 * NeoChatConfig.fontScale
: Kirigami.Theme.defaultFont.pointSize * NeoChatConfig.fontScale
family: QmlUtils.isEmoji(display) ? 'emoji' : Kirigami.Theme.defaultFont.family
}
selectByMouse: !Kirigami.Settings.isMobile

View File

@@ -43,6 +43,40 @@ FormCard.FormCardPage {
NeoChatConfig.save();
}
}
FormCard.FormDelegateSeparator {
above: fontScaleSliderDelegate
below: compactRoomListDelegate
}
/*!
Font scale setting allows user to adjust the font size used in the app.
*/
FormCard.AbstractFormDelegate {
id: fontScaleSliderDelegate
background: Item {}
contentItem: ColumnLayout {
QQC2.Label {
text: i18nc("@label Font size for text in the chat pane", "Chat font scaling")
Layout.fillWidth: true
}
QQC2.Label {
text: i18nc("@label:slider Current font scale percentage. %1 is the numeric percentage value, the second % is the symbol e.g. 120%", "%1%", Math.round(NeoChatConfig.fontScale * 100))
Layout.fillWidth: true
}
QQC2.Slider {
from: 0.5
to: 3.0
stepSize: 0.1
value: NeoChatConfig.fontScale
onMoved: {
NeoChatConfig.fontScale = value;
NeoChatConfig.save();
}
Layout.fillWidth: true
}
}
}
}
FormCard.FormHeader {