Bug 390307 - Preview of Markdown - fonts too small in HiDPI screen
Summary: Preview of Markdown - fonts too small in HiDPI screen
Status: REPORTED
Alias: None
Product: kmarkdownwebview
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: CnZhx
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-12 09:30 UTC by CnZhx
Modified: 2022-12-02 04:15 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
comparison of normal font size and the size in preview panel side-by-side in Kate (182.07 KB, image/png)
2018-02-12 09:30 UTC, CnZhx
Details
Comparision of visual sizes of fonts in Kate, preview and System Settings (161.85 KB, image/png)
2018-02-12 20:24 UTC, CnZhx
Details
Markdown preview and kate editor in same page (111.27 KB, image/png)
2022-12-02 04:15 UTC, CnZhx
Details

Note You need to log in before you can comment on or make changes to this bug.
Description CnZhx 2018-02-12 09:30:20 UTC
Created attachment 110553 [details]
comparison of normal font size and the size in preview panel side-by-side in Kate

As the $SUBJECT says, the fonts in Preview panel are too small to read when the screen is WQHD on a laptop and the system is set to only have forced DPI of 168 while scaling factor is 1.

A screenshot is attached for comparison of normal font size and the size in preview panel side-by-side in Kate.
Comment 1 Friedrich W. H. Kossebau 2018-02-12 17:41:56 UTC
I have no own experience yet with support of high-dpi devices yet, so can only do guesses based on docs.

The CSS used for the markdown rendering has all sizes given in pixels, cmp. https://kevinburke.bitbucket.io/markdowncss/markdown.css
I picked that stylesheet as it seems a good one, and having no designer education myself, I also do not want to start messing with CSS :)
That CSS is currently hardcoded, but happy to add support to allow people overwriting that, see https://bugs.kde.org/show_bug.cgi?id=385219

The openSUSE packages are built against Qt WebEngine. That one recommends to have Qt::AA_EnableHighDpiScaling set in the code, so things are properly scaled given that web rendering by standards is based on 96 dpi IIRC.
Cmp. http://doc.qt.io/qt-5/qtwebengine-overview.html#high-dpi-support

Kate itself seems to not set that flag in the code yet, grepping the code yield no hit.

Questions:
a) What do you mean exactly by "system is set to only have forced DPI of 168 while scaling factor is 1." ?

b) Could you try to run Kate with QT_AUTO_SCREEN_SCALE_FACTOR set to TRUE in the environment and tell if this improved things for you?
E.g. by opening a terminal and starting kate like this
```
export QT_AUTO_SCREEN_SCALE_FACTOR=TRUE
kate
```
Cmp. also http://doc.qt.io/qt-5/highdpi.html

If that improves things for you, it would then make sense to add code to Kate to set the respective flag directly.
Comment 2 CnZhx 2018-02-12 20:22:22 UTC
Hi Friedrich, thank you for looking into this.

To answer your questions,
a) That means the "Force fonts DPI" in "Fonts" of the system is set to 168, and the "Screen Scaling" in "Display and Monitor" is set to 1. This is because the following reason. I have a 14" laptop with WQHD display. On the one hand, with screen scaling of 2, the items on screen are too big so less content can be displayed. But screen scaling of fractional value (e.g. 1.3) could cause problems with Konsole and so on. On the other hand, I use an external monitor now and then. It has a normal DPI of 96. If I set screen scaling to value larger than 1, elements on the external screen would be too large. Then, I increase fonts DPI only to make fonts big enough to read (the Fonts sizes are kept default, e.g. Noto Sans 10 for General).

b) I tried your method to run Kate. The display is just the same as I reported. 

In addition to this, I guess it's helpful to mention that I use a font size of 10 in Kate (font family: Hack), which is on the left side of the screenshot. I would expect the preview of Markdown using sizes of symbol (actual font/character size) based on visual font size in system settings. So I include another screenshot with comparison for your reference. Please refer to the next comment.
Comment 3 CnZhx 2018-02-12 20:24:32 UTC
Created attachment 110577 [details]
Comparision of visual sizes of fonts in Kate, preview and System Settings
Comment 4 Christoph Feck 2018-03-01 00:17:21 UTC
Friedrich, does comment #2 provide the requested information? Please set the bug status or add a comment.
Comment 5 Christoph Feck 2018-03-29 14:00:22 UTC
No response; changing status.
Comment 6 Friedrich W. H. Kossebau 2018-03-29 14:16:38 UTC
Sorry for not having caught up on this. I am missing needed insight into the issue to understand what could be wrong, and the answers (thanks for them though, CnZhx) did not help me out of that, rather showed there is more which needs to be understood. So I had delayed further reaction to some bigger concentrated investigation effort of mine. Which sadly has not yet got enough priority with me over all the other things to do, and might not get in the near future.

So current status: no idea what could be wrong exactly and how to properly fix it :(
Comment 7 CnZhx 2018-03-29 20:57:23 UTC
Thank you Friedrich and Christoph for the follow-up.

After more observations, I think this might not be the problem of this Preview plugin. Apart from this, I also noticed the small fonts problem in following situations:
- In Akregator, open an article in "new Tab" instead of external browser;
- In Kmail, open a HTML-formatted message in HTML mode.

So, maybe the problem is system-wide?
Comment 8 Justin Zobel 2022-12-02 01:22:39 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 9 CnZhx 2022-12-02 04:15:28 UTC
Created attachment 154212 [details]
Markdown preview and kate editor in same page

Hi Justin,

Thank you for following up this issue. I have not used this feature for a long time and forget this issue. This bug is still there with Kate Version 22.08.3. A snapshot has been attached to show the small fonts in the preview panel along with the normal font size in editing area.

The status has been change accordingly.