Commit f0a2c013 authored by dmMaze's avatar dmMaze
Browse files

fix font style not set on empty document

parent 2554634d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -723,12 +723,14 @@ class TextBlkItem(QGraphicsTextItem):
        self.blk.vertical = fmt.vertical
        self.blk.set_font_colors(fmt.frgb, fmt.srgb)

    def set_cursor_cfmt(self, cursor: QTextCursor, cfmt, merge_char: bool = False):
    def set_cursor_cfmt(self, cursor: QTextCursor, cfmt: QTextCharFormat, merge_char: bool = False):
        if merge_char:
            cursor.mergeCharFormat(cfmt)
        cursor.mergeBlockCharFormat(cfmt)
        cursor.clearSelection()
        self.setTextCursor(cursor)
        if self.document().isEmpty():
            self.document().setDefaultFont(cursor.blockCharFormat().font())

    def _before_set_ffmt(self, set_selected: bool, restore_cursor: bool):
        self.is_formatting = True