Loading ui/scene_textlayout.py +9 −9 Original line number Diff line number Diff line Loading @@ -450,7 +450,7 @@ class VerticalTextDocumentLayout(SceneTextLayout): yoff = -non_bracket_br[1] - non_bracket_br[3] yoff = yoff - (line_width - non_bracket_br[3]) / 2 elif vertical_force_aligncentel(char): else: space_shift = 0 if num_lspaces > 0: space_shift = num_lspaces * cfmt.space_width Loading @@ -472,15 +472,15 @@ class VerticalTextDocumentLayout(SceneTextLayout): tbr, br = cfmt.punc_rect(char) yoff += (tbr.height() + cfmt.font_metrics.descent() - act_rect[3]) / 2 else: empty_spacing = num_lspaces * cfmt.space_width if TEXTLAYOUT_QTVERSION: xshift = max(line.naturalTextWidth() - cfmt.br.width(), 0) else: xshift = empty_spacing # else: # empty_spacing = num_lspaces * cfmt.space_width # if TEXTLAYOUT_QTVERSION: # xshift = max(line.naturalTextWidth() - cfmt.br.width(), 0) # else: # xshift = empty_spacing xoff = -xshift yoff = min(cfmt.br.top() - cfmt.tbr.top(), -cfmt.tbr.top() - line.ascent()) + empty_spacing # xoff = -xshift # yoff = min(cfmt.br.top() - cfmt.tbr.top(), -cfmt.tbr.top() - line.ascent()) + empty_spacing xy_offsets[0], xy_offsets[1] = xoff, yoff block = block.next() Loading ui/textitem.py +3 −2 Original line number Diff line number Diff line Loading @@ -810,7 +810,7 @@ class TextBlkItem(QGraphicsTextItem): self.fontformat.stroke_width = stroke_width if stroke_width > 0 and padding: p = self.layout.max_font_size(to_px=True) * stroke_width / 2 p = self.layout.max_font_size(to_px=True) * (stroke_width + 0.05) / 2 self.setPadding(p) self._after_set_ffmt(cursor, repaint_background, restore_cursor, **after_kwargs) Loading @@ -829,7 +829,8 @@ class TextBlkItem(QGraphicsTextItem): if repaint_background: fs = pt2px(max(self.layout.max_font_size(), value)) self.layout.relayout_on_changed = False self.setPadding(fs * self.fontformat.stroke_width / 2) if self.fontformat.stroke_width > 0: self.setPadding(fs * (self.fontformat.stroke_width + 0.05) / 2) self.layout.relayout_on_changed = True cfmt = QTextCharFormat() cfmt.setFontPointSize(value) Loading Loading
ui/scene_textlayout.py +9 −9 Original line number Diff line number Diff line Loading @@ -450,7 +450,7 @@ class VerticalTextDocumentLayout(SceneTextLayout): yoff = -non_bracket_br[1] - non_bracket_br[3] yoff = yoff - (line_width - non_bracket_br[3]) / 2 elif vertical_force_aligncentel(char): else: space_shift = 0 if num_lspaces > 0: space_shift = num_lspaces * cfmt.space_width Loading @@ -472,15 +472,15 @@ class VerticalTextDocumentLayout(SceneTextLayout): tbr, br = cfmt.punc_rect(char) yoff += (tbr.height() + cfmt.font_metrics.descent() - act_rect[3]) / 2 else: empty_spacing = num_lspaces * cfmt.space_width if TEXTLAYOUT_QTVERSION: xshift = max(line.naturalTextWidth() - cfmt.br.width(), 0) else: xshift = empty_spacing # else: # empty_spacing = num_lspaces * cfmt.space_width # if TEXTLAYOUT_QTVERSION: # xshift = max(line.naturalTextWidth() - cfmt.br.width(), 0) # else: # xshift = empty_spacing xoff = -xshift yoff = min(cfmt.br.top() - cfmt.tbr.top(), -cfmt.tbr.top() - line.ascent()) + empty_spacing # xoff = -xshift # yoff = min(cfmt.br.top() - cfmt.tbr.top(), -cfmt.tbr.top() - line.ascent()) + empty_spacing xy_offsets[0], xy_offsets[1] = xoff, yoff block = block.next() Loading
ui/textitem.py +3 −2 Original line number Diff line number Diff line Loading @@ -810,7 +810,7 @@ class TextBlkItem(QGraphicsTextItem): self.fontformat.stroke_width = stroke_width if stroke_width > 0 and padding: p = self.layout.max_font_size(to_px=True) * stroke_width / 2 p = self.layout.max_font_size(to_px=True) * (stroke_width + 0.05) / 2 self.setPadding(p) self._after_set_ffmt(cursor, repaint_background, restore_cursor, **after_kwargs) Loading @@ -829,7 +829,8 @@ class TextBlkItem(QGraphicsTextItem): if repaint_background: fs = pt2px(max(self.layout.max_font_size(), value)) self.layout.relayout_on_changed = False self.setPadding(fs * self.fontformat.stroke_width / 2) if self.fontformat.stroke_width > 0: self.setPadding(fs * (self.fontformat.stroke_width + 0.05) / 2) self.layout.relayout_on_changed = True cfmt = QTextCharFormat() cfmt.setFontPointSize(value) Loading