vkbo / novelWriter

novelWriter is an open source plain text editor designed for writing novels. It supports a minimal markdown-like syntax for formatting text. It is written with Python 3 (3.9+) and Qt 5 (5.15) for cross-platform support.
https://novelwriter.io
GNU General Public License v3.0
1.99k stars 102 forks source link

Editor "zoom" (view scaling without changing document font size) #1280

Open 20goto10 opened 1 year ago

20goto10 commented 1 year ago

I've been searching for a way to scale the view window for the editor without affecting the output of the manuscript. If the option is there in the settings, I can't find it. I have gotten by by adjusting the editor font size instead, but whenever I render the manuscript I wind up having to shift everything down from 19 point to standard 12 point text. This problem may only be apparent on ultra high def laptop screens.

How difficult is it to add a "zoom" option like this, along the lines of what exists in Word/LibreOffice/etc? I'd rather avoid having to mess with external settings, i.e. display, scaling my window manager, etc..

vkbo commented 1 year ago

Hmm, it should auto-scale for high DPI. Can you provide a screenshot? This may be a bug.

I have considered adding a zoom feature, but I haven't investigated it yet.

20goto10 commented 1 year ago

Hmm, it should auto-scale for high DPI. Can you provide a screenshot? This may be a bug.

I have considered adding a zoom feature, but I haven't investigated it yet.

Here's how it looks for me in the basic mode and focus mode. Font size is 12 point here. The screen is 14", so, pretty tricky to use on the default. I think automatically scaling the view to the screen size is not ideal as it does not take personal reading preferences into account (not to mention more specific accessibility issues).

Screenshot from 2022-12-05 13-31-07 Screenshot from 2022-12-05 13-31-16

I have seen an issue where the font sizes and line spaces all shrink after my screen saver activates, but for some reason I assumed that was something to do with my window manager and not NovelWriter itself. (I'm using Mint Linux 21 w/Cinnamon, which has a few issues of its own.) That's fixed by restarting NovelWriter. Maybe it is a function of the automatic scaling... if so, it's going in the wrong direction. I see it as a separate issue from the matter of zoom.

20goto10 commented 1 year ago

(I should also note, system font size is 12 and there is no WM font scaling in effect.)

vkbo commented 1 year ago

Here's how it looks for me in the basic mode and focus mode. Font size is 12 point here. The screen is 14", so, pretty tricky to use on the default. I think automatically scaling the view to the screen size is not ideal as it does not take personal reading preferences into account (not to mention more specific accessibility issues).

The auto-scaling is not to screen size, but to the GUI scaling factor. If you have it set to 100% (1.0), then there is no scaling. The font is scaled automatically by the Qt framework anyway. All I do is scale boxes and icons to match. I thought that might be the issue since you mentioned "ultra high def laptop screens".

I don't think that's the issue here.

I have seen an issue where the font sizes and line spaces all shrink after my screen saver activates, but for some reason I assumed that was something to do with my window manager and not NovelWriter itself. (I'm using Mint Linux 21 w/Cinnamon, which has a few issues of its own.) That's fixed by restarting NovelWriter. Maybe it is a function of the automatic scaling... if so, it's going in the wrong direction. I see it as a separate issue from the matter of zoom.

The auto-scaling is not dynamic, so if there is something glitchy it is likely an issue between the Qt framework and the window manager. Qt5 has a few issues in this respect, and there isn't really anything I can do about it. Either they fix it in patch releases, or hopefully I can add support for Qt6 eventually. That should help with a bunch of little issues with modern window managers and High-DPI monitors.

In any case, I still don't quite understand what the issue is with font size. The GUI font size, editor font size, and the font size output by the Build tool to manuscript documents are all independent settings, and you should be able to tweak each as you want.

Unrelated, but I also see that you are running a light theme icons on a dark GUI theme, which makes the icons hard to see. Especially the black on grey ones. You should switch to the dark icon theme. This also seems to be an older version of novelWriter.

vkbo commented 1 year ago

As for the zoom feature, the Qt framework does have a text zoom feature for the editor (it is literally 6 lines of code to enable), but unfortunately the implementation isn't very useful. Zooming just changes the base text size, so the headers don't scale. It can theoretically be fixed by setting relative sizes for the headers, but that too is rather limited as you can't set numeric relative sizes. It's one of the problems I've tried to solve since I first started this project.

20goto10 commented 1 year ago

Fair enough. I see what you mean about Qt problems and I understand the reasons for not having a zoom feature now. I completely overlooked the font size setting in the export screen--except once, I guess, because at some point I must have set it to 19 point (oops). Cinnamon/Gnome stuff has a separate Qt settings editor which made some of the smaller Qt-controlled content a little easier to read, too. So I have everything in good shape now (and I've now updated to 2.0). It seems I can live without zoom.

Thanks for the guidance and your work on this excellent project. I've been recommending it to many writers.

vkbo commented 1 year ago

I added those separate settings as a way to compensate for the lack of zoom, at least in the context of usability. There are still cases where the lack of zoom is an issue, so I would like to fix it. I just don't have a solution right now that doesn't come with other issues. I would like to look for a workable solution though, so let's leave this issue open for now.

Thanks a lot for your feedback! I'm happy that novelWriter works for you aside from this. It's nice to see that it is useful to other people. I originally made it for myself and a colleague, and it has grown to quite a large project.

julichan commented 3 months ago

Hello,

I'm coming for update on this. I'm on windows and i see the view rescales only upon application restart after changing the scaling values in windows settings. I'm also totally for a manual zoom and automatic update upon change. I'm not experienced with QT technologies so i don't know about its limitations but isn't there just a way to regenerate the whole UI when that setting has been changed in windows or overriden in the setting of the application ? Is there any problems to implement a simple solution to begin with ? or is it just wanted to have something completely dynamic to begin with ?

Thanks.

vkbo commented 3 months ago

I have this on my short list. Zoom for the text in the documents is doable. The only current issue is the headings don't scale, but that is solvable. Scaling the GUI itself is a very different matter and will still require an app restart.

This is a widget-based app, not web tech, so changing the geometry of everything is non-trivial after it's drawn. Qt can change some things dynamically when settings change, but a lot of things do not change. It's a lot more than just changing the font. A lot of GUI elements are scaled proportionally to the font. To allow zooming the app itself, it would require dynamically scaling thousands of little values in a ton of places. That is a very tall order for such a minimal benefit of not having to restart the app.

Scaling of the document text is coming, but not the GUI itself.

And no, there is no simple solution like what you describe. Even allowing changing theme dynamically requires a fair bit of additional code, and a lot of extra checks and manual handling.