Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font rendering issue with version 3.17.1124.693 #191

Closed
dereius opened this issue Nov 26, 2017 · 38 comments
Closed

Font rendering issue with version 3.17.1124.693 #191

dereius opened this issue Nov 26, 2017 · 38 comments

Comments

@dereius
Copy link

dereius commented Nov 26, 2017

Please check the following image to see in detail what happens:
10le393
also stored here: https://imgur.com/a/ulYZb

Problem can be fixed for now by setting SciDirectWriteTech=0 in Settings File.

@lhmouse
Copy link
Contributor

lhmouse commented Nov 27, 2017

Well this is indeed a problem, hence I have it disabled for now.

There is actually another issue:
(For you who don't read Chinese, this phrase made up of four characters means 'external device' and the word in the circle means 'external'.)

scidirectwritetech 1

scidirectwritetech 0

Please notice how the characters '外置'(external) are rendered differently. Those in the first screenshot, illustrating the default behavior, with SciDirectWriteTech set to 1, are NOT what we typically see in mainland China. It is the ones in the second screenshot that are. The orthodox forms are used in Taiwan, where people hardly use simplified characters on the contrary.

Reference: https://en.wikipedia.org/wiki/Xin_Zixing

@RaiKoHoff
Copy link
Collaborator

From Scintilla's documentation:
SCI_SETTECHNOLOGY(int technology) SCI_GETTECHNOLOGY → int The technology property allows choosing between different drawing APIs and options. On most platforms, the only choice is SC_TECHNOLOGY_DEFAULT (0). On Windows Vista or later, SC_TECHNOLOGY_DIRECTWRITE (1), SC_TECHNOLOGY_DIRECTWRITERETAIN (2), or SC_TECHNOLOGY_DIRECTWRITEDC (3) can be chosen to use the Direct2D and DirectWrite APIs for higher quality antialiased drawing. SC_TECHNOLOGY_DIRECTWRITERETAIN differs from SC_TECHNOLOGY_DIRECTWRITE by requesting that the frame is retained after being presented which may prevent drawing failures on some cards and drivers. SC_TECHNOLOGY_DIRECTWRITEDC differs from SC_TECHNOLOGY_DIRECTWRITE by using DirectWrite to draw into a GDI DC. Since Direct2D buffers drawing, Scintilla's buffering can be turned off with SCI_SETBUFFEREDDRAW(0).
(You can also try the other technologies 2 & 3)
Maybe we should switch back to make the good old "default" technology to be the default for Notepad3 too. @lhmouse : maybe this issue should be reported to Scintilla too ?

@lhmouse
Copy link
Contributor

lhmouse commented Nov 27, 2017

No you need not revert this setting, as ASCII characters will look fuzzy in small font sizes. The screenshots above were made using a font size of 24 - you do not set it to such a huge number for daily use, do you? 😂

Other than that, I agree with you about that this is a minor bug in Scintilla and should be reported.

@dereius
Copy link
Author

dereius commented Nov 27, 2017

@RaiKoHoff I tried different settings, as per your quoting from Scintilla's Doc., but only (0) disables the color fringe. To mention that color fringe is more visible as fonts are smaller.
Curious enough, in Notepad2-Mod, this never happens (does it use a different technology?

@RaiKoHoff
Copy link
Collaborator

I did some tests with different settings (technology, Win's clear-type adjustments, fonts, etc.) and i got the impression, that the old (default) technology produces a clearer reading "feeling" on most circumstances. Even, if I keep in mind, that the "DirectWrite" technology should produce "higher quality antialiased drawing" output ?
What is the opinion of the community?

@RaiKoHoff
Copy link
Collaborator

@dereius : Notepad2-mod still relies on Scintilla's old (default) technology and has no option to switch it.

@lhmouse
Copy link
Contributor

lhmouse commented Nov 27, 2017

I have no opinion on it, basically.

@rizonesoft
Copy link
Owner

From a developer's point of view, the quality of the font does not matter as long as it reads "correctly". However, having the latest technology and not being able to utilize it gives me an uneasy feeling. Maybe it should be disabled by default and we need to report the bug and enable it again by default when it gets resolved. But as @RaiKoHoff said. It is in the hands of the community.

@RaiKoHoff
Copy link
Collaborator

Switching to Direct Write technology maybe a nice switch to be displayed for "Update and Administration Tool" ;-)

@rizonesoft
Copy link
Owner

@RaiKoHoff I will have the Administration tool ready within about 2 weeks. I'm also planning (busy creating) a documentation section on Rizonesoft.com to start documenting Notepad3. I wanted to ad a help file, but want to keep Notepad3 as small as possible.

@dereius
Copy link
Author

dereius commented Nov 29, 2017

@rizonesoft a web documentation I believe would be enough then. Many apps have it like this.

@rizonesoft
Copy link
Owner

Thanks @dereius I will let you guys know when I'm finished.

@rizonesoft
Copy link
Owner

Please test the new release and let us know if this issue can be closed.

@dereius
Copy link
Author

dereius commented Dec 2, 2017

I installed the last version (Notepad3 3.17.1202.715) and cleared the settings in the ini file

SciDirectWriteTech=
SciFontQuality=

Still, the font rendering had color fringe, so I had to set it back as @RaiKoHoff suggested:

SciDirectWriteTech=0
SciFontQuality=3

This way, the font rendering is okay. Less antialiased, but clean. I know it can be a bit frustrating to not be able to use a newer feature, but I consider there are other aspects that would benefit more to focus on, if this cannot have a permanent fix until Scintilla gets patched properly.

@RaiKoHoff
Copy link
Collaborator

RaiKoHoff commented Dec 4, 2017

@dereius : I cannot reproduce Your finding with (Notepad3 3.17.1202.715).
Also the debug version of this build clearly shows internal value of SciDirectWriteTech is 0, if it is not defined.
Please test it again and check your .ini-file accordingly.

@rizonesoft
Copy link
Owner

@dereius Please confirm fixed and close this issue. New release available on the Notepad3 download page. 😸 Find the change log on the Notepad3 update page. 😺 Thanks for testing!

@derei
Copy link

derei commented Dec 23, 2017

Before installation of the last version (3.17.1223.778) I deleted all content of the .ini file, then I closed Notepad3 (just to make sure it won't keep any custom settings). I installed choosing to reset Notepad3 settings (again, another precaution).
Indeed, now [Settings2] is mostly commented. The only active lines are:
SingleFileInstance=1 ShellAppUserModelID=Notepad3 ShellUseSystemMRU=1 WebTemplate1=https://google.com/search?q=%s WebTemplate2=https://en.wikipedia.org/w/index.php?search=%s
If that was the intended course of action, then it seems everything is alright. Anyway, the fonts look good now. I can confirm.

What I could NOT find in the new ini file were the style schemes. I backed up the original ini file, before clearing its contents, to have a comparison. And now I can say there is nothing in the new file after [Window] label. Are the missing parameters now stored in a different location?

The font rendering issue can be considered closed, I guess.

@RaiKoHoff
Copy link
Collaborator

The default styles are hard coded in the sources and can be restored by pressing the "Reset" button in "Customize Schemes...". On first saving of settings, they should be written to the .ini-file ...
image

@RaiKoHoff
Copy link
Collaborator

@dereius : please close if satisfied

@derei
Copy link

derei commented Dec 26, 2017

@RaiKoHoff I'd be happy to do so, if I knew how. I see no option on this page to close the issue.
Are you sure closing the issue is not supposed to be performed by the owner of the repository?

@RaiKoHoff
Copy link
Collaborator

@derei : Oh i see, the issue has been opened by @dereius.
Two different guys, or only two different accounts ?

@dereius
Copy link
Author

dereius commented Dec 26, 2017

@RaiKoHoff I apologize for the confusion. Indeed derei and dereius both belong to me, but dereius is obsolete and eventually will be parked/deleted. I will no use it anymore.
Now I see the "Close and comment" button.

@RaiKoHoff
Copy link
Collaborator

Ref.: XhmikosR/notepad2-mod#228

@zufuliu
Copy link

zufuliu commented Jul 30, 2018

A ticket is created at https://sourceforge.net/p/scintilla/bugs/2027/

@zufuliu
Copy link

zufuliu commented Jul 31, 2018

Add a menu item like Menu -> Settings ->Rendering Technology in zufuliu/notepad4@b7ad639 would make switch between GDI and Direct2D more easy.

@RaiKoHoff
Copy link
Collaborator

Suggestion implemented by development beta _X_MUI_4.18.808.1047.

@zufuliu
Copy link

zufuliu commented Aug 8, 2018

@RaiKoHoff A new bug could be introduced, if support switching rendering technology on the fly:
https://sourceforge.net/p/scintilla/bugs/2030/

You previous implementation (edit ini file, restart) should not has this bug.

@RaiKoHoff
Copy link
Collaborator

@zufuliu : Thank you for the hint. Indeed, my implementation disables the Bidirectional support before switching back to Default GDI Rendering Tech. - so probably never encountered this bug.

Do you have some experiences setting double buffering (SCI_SETBUFFEREDDRAW) to false while switching to new Rendering Tech. as mentioned in Scintilla Doc ?

@zufuliu
Copy link

zufuliu commented Aug 8, 2018

@RaiKoHoff the above bug is fixed by zufuliu/notepad4@9c475c7, through it's maybe not the final fix in Scintilla.

I have never touch SCI_SETBUFFEREDDRAW, I don't known what reason to turn off double buffering.

@RaiKoHoff
Copy link
Collaborator

Cite from Scintillas Doc: "Since Direct2D buffers drawing, Scintilla's buffering can be turned off".
Some people report problems on older hardware on doing this ... - OK thanks.

@zufuliu
Copy link

zufuliu commented Aug 8, 2018

I think, at least it can not happened on Notepad3, sine Notepad3 requires Win7.

@zufuliu
Copy link

zufuliu commented Aug 8, 2018

Another document from the doc:
https://www.scintilla.org/ScintillaDoc.html#SCI_SETBUFFEREDDRAW

Current platforms perform window buffering so it is almost always better for this option to be turned off. For Win32 and GTK+, client code should turn off buffering at initialisation. There are some older platforms and unusual modes where buffering may still be useful.

So it is almost always better for this option to be turned off? I will try it.

@RaiKoHoff
Copy link
Collaborator

I have seen some "flickering" for good old Default GDI mode, if turned off,
for Direct2D not seen so far, but i have only one machine to test... :-)

@zufuliu
Copy link

zufuliu commented Aug 9, 2018

I added a "Buffered Draw" option and menu, don't known who need to turn it off, though the default in SciTE is off.

Buffered Draw

By the way, when changing to GDI, set bidirectional to 0 is no longer required, above bug was fixed. This can avoid draw the window twice.

Just a suggestion, I suggest replace min(max( and max(min( with some inline version of clamp, to avoid side effect (like evaluated twice) and make code clean and more readable. If you accepted this suggestion, Please make changes very carefully, one by one, don't mix up lower and upper value.

@RaiKoHoff
Copy link
Collaborator

@zufuliu : Yes, the clamp() refactoring I committed yesterday.

Making "Buffered Draw" switchable is a good idea.

From Scintilla documentation, on Windows platforms Bidirectional works only with DirectWrite
(macOS w/ Cocoa), so disabling Bidirectional while on Default GDI makes sense.

@zufuliu
Copy link

zufuliu commented Aug 10, 2018

@RaiKoHoff thank you for the suggestion about Bidirectional.

Separate option for buffered draw is added.

"Buffered Draw" only applied to GDI, zufuliu/notepad4@8a11415.

@zufuliu
Copy link

zufuliu commented Aug 10, 2018

The bug @lhmouse found has a temporary fix at https://sourceforge.net/p/scintilla/bugs/2027/.

@RaiKoHoff
Copy link
Collaborator

@zufuliu : thank you for the hint, @lhmouse : thank you for analysis.
Will patch this suggestion for Notepad3 ... :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants