Font clipping of custom Italic fonts
-
I'm developing an application that will allow users to import new font to render some texts, I was also trying some fonts from Google Fonts but when I use an italic fonts I'm getting clipping issues either in capital letters or in other letters, for example:

What could I try to solve this issue?
This is the font I was trying. but it happened also with other fonts:
https://fonts.google.com/specimen/InterHere is some basic code to reproduce this behavior:
import sys import os from PySide6.QtWidgets import ( QApplication, QWidget, QVBoxLayout, QTextEdit, QPushButton, QLabel ) from PySide6.QtGui import QFont, QFontDatabase from PySide6.QtCore import Qt class FontTestApp(QWidget): def __init__(self, font_path: str): super().__init__() self.font_path = font_path self.init_ui() def init_ui(self): self.setWindowTitle("PySide6 Custom Font Test") self.setGeometry(100, 100, 600, 400) layout = QVBoxLayout(self) font_family_name = self._load_custom_font() self.status_label = QLabel() layout.addWidget(self.status_label) if font_family_name: self.status_label.setText(f"Font '{font_family_name}' loaded successfully.") self.text_edit = QTextEdit() self.text_edit.setPlainText( "This is a sample text displayed in the custom font.\n" "CCCCCCCCDDDDDDDDDDDEEEEEEEEEEEEEOOOOOOOOOOOO" "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " "Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." ) custom_font = QFont(font_family_name, 12) self.text_edit.setFont(custom_font) layout.addWidget(self.text_edit) self.close_button = QPushButton("Close") self.close_button.clicked.connect(QApplication.instance().quit) layout.addWidget(self.close_button) def _load_custom_font(self) -> str | None: if not os.path.exists(self.font_path): print(f"Error: Font file not found at '{self.font_path}'") return None font_id = QFontDatabase.addApplicationFont(self.font_path) if font_id == -1: print(f"Error: Could not load font from '{self.font_path}'. It might be corrupted or not a valid TTF.") return None font_families = QFontDatabase.applicationFontFamilies(font_id) if font_families: return font_families[0] # Return the first family name found in the font file else: print(f"Error: No font family names found in '{self.font_path}' after loading.") return None if __name__ == "__main__": app = QApplication(sys.argv) FONT_FILE = r"Inter-Italic-VariableFont_opsz,wght.ttf" main_window = FontTestApp(FONT_FILE) main_window.adjustSize() main_window.show() sys.exit(app.exec()) -
Hi and welcome to devnet,
Which version of PySide6 are you using ?
On which OS ?
I tried on macOS with PySide 6.9.1 and it worked correctly. I just had to use theaddApplicationFontFromDatamethod because for some reason it did not succeed when loading from the file path.