Commit 9edc5357 authored by dmMaze's avatar dmMaze
Browse files

fix ldpi not assigned properly & inaccurate tight textbbox calculation

parent afe6aa45
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -206,6 +206,12 @@ def main():
        app_args = sys.argv + ['-platform', 'offscreen']
    app = QApplication(app_args)

    if not args.headless:
        ps = QGuiApplication.primaryScreen()
        shared.LDPI = ps.logicalDotsPerInch()
        shared.SCREEN_W = ps.geometry().width()
        shared.SCREEN_H = ps.geometry().height()

    lang = config.display_lang
    langp = osp.join(shared.TRANSLATE_DIR, lang + '.qm')
    if osp.exists(langp):
@@ -262,10 +268,6 @@ def main():
    BT.restart_signal.connect(restart)

    if not args.headless:
        ps = QGuiApplication.primaryScreen()
        shared.LDPI = ps.logicalDotsPerInch()
        shared.SCREEN_W = ps.geometry().width()
        shared.SCREEN_H = ps.geometry().height()
        if shared.SCREEN_W > 1707 and sys.platform == 'win32':   # higher than 2560 (1440p) / 1.5
            # https://github.com/dmMaze/BallonsTranslator/issues/220
            BT.comicTransSplitter.setHandleWidth(10)
+1 −1
Original line number Diff line number Diff line
@@ -999,7 +999,7 @@ class MainWindow(mainwindow_cls):
                    blk.letter_spacing = gf.letter_spacing
                    sw = blk.stroke_width
                    if sw > 0 and pcfg.module.enable_ocr and pcfg.module.enable_detect and not override_fnt_size:
                        blk.font_size = int(blk.font_size / (1 + sw))
                        blk.font_size = blk.font_size / (1 + sw)

            self.st_manager.auto_textlayout_flag = pcfg.let_autolayout_flag and \
                (pcfg.module.enable_detect or pcfg.module.enable_translate)
+1 −2
Original line number Diff line number Diff line
@@ -879,8 +879,7 @@ class SceneTextManager(QObject):
        
        ffmt = QFontMetricsF(blk_font)
        maxw = max([ffmt.horizontalAdvance(t) for t in new_text.split('\n')])
        maxw = int(np.ceil(maxw))
        blkitem.set_size(maxw, xywh[3], set_layout_maxsize=True)
        blkitem.set_size(maxw * 1.5, xywh[3], set_layout_maxsize=True)
        blkitem.setPlainText(new_text)
        if len(self.pairwidget_list) > blkitem.idx:
            self.pairwidget_list[blkitem.idx].e_trans.setPlainText(new_text)