I've tried this but it only scales the first character for some reason, and after I stop scaling the font size returns to normal
value = 0.3; // random value that increases the font size every time this part of the program is called for(int i = -1; i < textEdit->toPlainText().length() - 1; i++) { QTextCursor cursor = textEdit->textCursor(); cursor.setPosition(QTextCursor::Start + i, QTextCursor::MoveAnchor); // for some reason the first letter is start - 1 (start might be 1 and programming languages usually start counting at 0) cursor.setPosition(QTextCursor::Start + (i + 1), QTextCursor::KeepAnchor); // next position and keep anchor to highlight cursor.charFormat().font().setPointSize(cursor.charFormat().font().pointSize()*(value+1)); QTextCharFormat fmt; // resized but don't work fmt.setFontPointSize(cursor.charFormat().font().pointSize()*(value+1)); mergeFormatOnWordOrSelection(fmt); // resized and this works } void MainWindow::mergeFormatOnWordOrSelection(const QTextCharFormat &format) { QTextCursor cursor = textEdit->textCursor(); if (!cursor.hasSelection()) cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); cursor.mergeCharFormat(format); textEdit->mergeCurrentCharFormat(format); }