Maximus5 / ConEmu

Customizable Windows terminal with tabs, splits, quake-style, hotkeys and more
https://conemu.github.io/
BSD 3-Clause "New" or "Revised" License
8.54k stars 571 forks source link

DirectWrite Font Rendering #74

Open CoolOppo opened 9 years ago

CoolOppo commented 9 years ago

The DirectWrite API allows for stellar font rendering. For starters, Sublime Text and Google Chrome fully support it, and Chrome actually uses it by default now!

If ConEmu implements it, the font quality will be far better than what is provided right now for all fonts.

Out of all of the (few) things that have annoyed me over the years of using ConEmu, the only feature I wanted enough to beg for request is this. Please actually consider adding it, and making it the default for ConEmu.

Thanks for everything. ConEmu is pretty great.

Maximus5 commented 9 years ago

Actually no one has yet convinced me that DirectWrite rendering is better that ClearType. There was no screenshots with comparison of drawing methods. At the moment I think this is only prejudice.

CoolOppo commented 9 years ago

No, I've actually done comparisons. I'll make an unbiased comparison actually since there is a need for one for sure. Any requests of specific fonts or texts I should sample?

CoolOppo commented 9 years ago

Alright, just to kick it off, here's a comparison of GDI and DirectWrite font rendering using the font Helvetica Monospaced:

GDI

DirectWrite

Note for morons:

View the images at 100% size. I recommend opening them both, zooming to 100% (actual size), and switching back and forth between the two tabs.


Edit: here are a couple more!

GDI

DirectWrite

Maximus5 commented 9 years ago

That is not proper comparison. I suppose these are screenshots of Sublime? You need to compare with ConEmu. Well, I do not have "Helvetica Monospaced" files, so here is "Liberation Mono" 18. Drawbacks? Do not see them. 2015-03-20_03-10-04

CoolOppo commented 9 years ago

Alright, I'll download that font and give it a try. I'm pretty sure that the font rendering in Sublime Text and Google Chrome are the same as ConEmu when everything has DirectWrite disabled.

Maximus5 commented 9 years ago

That is only your supposition. As I've said, proper comparison will be between DirectWrite in Sublime and ClearType in ConEmu.

CoolOppo commented 9 years ago

Here it is:

DirectWrite (Sublime Text)

"Clear Type" Option in ConEmu Settings

isochronous commented 9 years ago

I'd agree from that last comparison that DirectWrite looks better than Cleartype. Didn't really have a preference for any of the other comparisons. How difficult would this be to simply add as an option, so those who prefer DirectWrite can use it, while those who don't (or just don't care) can continue using the default ClearType implementation?

Maximus5 commented 9 years ago

Large amount of code have to be refactored. I've already done part of the job but there is much to do yet. http://conemu.github.io/en/RoadMap.html#direct-write

m0n commented 9 years ago

@CoolOppo: please change/delete Your 2nd screenshot posted on Mar 20 ASAP!

It is obviously a DirectWrite rendering which is impossible to being a screenshot of ConEmu (!!!). Take a closer look (*) and You will notice that image is all grayscale - ClearType is definitely colorful, it is it's most important property (DirectWrite CAN render grayscale).

Also, no ClearType or GrayScale anti-aliasing works vertically - Your screenshot does (check '-' glyph for example: it's consists of a brighter and a darker line)

...also replace JPGs with PNGs and delete GIFs as 256 colors can't represents today's 24-bits color depth...

I will make an app to compare different renderings/settings in a few weeks later to show You all: DirectWrite rendering's pro's is almost invisible in the usual cases we using with ConEmu (we not using extra-small fonts or 3D-transforming and we take shit on sub-pixel alignment because we using monospaced fonts).

(*) To examine pixels on Your monitor, use a magnifier app - I using SysInternal's ZoomIt: https://technet.microsoft.com/en-us/sysinternals/bb897434

CoolOppo commented 9 years ago

@m0n I never posted a screenshot in this thread on Mar. 20, so I am unsure what one you're referring to. I will do my best to delete anything erroneous. Just put a link straight to the image you're asking to be deleted for me to be sure I know which one is wrong.

Additionally, I'm fairly sure that I haven't used a jpg file. If the URL links to one, it's because imgur sometimes just puts .jpg at the end of the URL that is easily copyable to the clipboard in order to ensure a direct link, but that doesn't necessarily mean that the actual file is a JPEG. Also, a GIF could very well represent these images if the color count is below 256, which is certainly possible, but I would just use a PNG anyways and optimize it losslessly anyways to be sure since that would both ensure it was unmodified and even if the bit depth only needed to be set at 8, an optimized PNG is still smaller than a GIF anyways, and I'm not doing any animation.

Maximus5 commented 9 years ago

Trolling?

CoolOppo commented 9 years ago

Trolling?

Who, @m0n?

Maximus5 commented 9 years ago

Yep, may be...

m0n commented 9 years ago

@CoolOppo: "@m0n: I never posted a screenshot in this thread on Mar. 20".

So, on my system seems like You did - here is a screenshot with my red comments to identify incorrect screenshot (I understand that You made this screenshot from Your ConEmu but facts are facts, a ClearType rendering is not gray and not works vertically):

mar20

I not trolling: I like to make things better and fix incorrect information and sometimes share my knowledge...

Maximus5 commented 9 years ago

Second screenshot is clear-type one. From ConEmu. BTW, clear-type have many user chosen options and obviously depends on your computer configuration. So it may differ from PC to PC...

isochronous commented 9 years ago

Hahahaha whoops

On Tue, Jun 30, 2015 at 7:48 AM Maximus5 notifications@github.com wrote:

Second screenshot is clear-type one. From ConEmu.

— Reply to this email directly or view it on GitHub https://github.com/Maximus5/ConEmu/issues/74#issuecomment-117143709.

CoolOppo commented 9 years ago

I guess that timezones are coming into play or something:

mnaoumov commented 8 years ago

I recently discovered http://www.slant.co/topics/67/~programming-fonts where http://adobe-fonts.github.io/source-code-pro/ is the winner.

I am trying to get use to it and having some issues to configure it with ConEmu. I believe it's DirectWrite issue so let's try to convince @Maximus5

Visual Studio 2015 with default settings

vs2015

Sublime Text 3 with default settings

st3

Sublime Text 3 with directwrite setting. Note it is not blurry anymore

st3-directwrite

And then ConEmu. It looks like its font sizes calculated differently. Probably it counts size in px rather than in pt. So I use size 13, as 10pt = 13px (roughly)

conemu

Note that ConEmu has the same blurry look as Sublime without DirectWrite. And ClearType settings is enabled.

Is that enough to convince @Maximus5 ? :)

Maximus5 commented 8 years ago

I've already agreed that DirectWrite may be nice. But! It support requires a lot of coding, especially to be able to use both techniques. Of course I will not break GDI support. Well, I have internal branch were the work was started, but there are other urgent issues.

mnaoumov commented 8 years ago

@Maximus5 can you also comment on the font sizes discrepancy?

Maximus5 commented 8 years ago

"Threat font height as device units". Checked - pt, unchecked - px. Complains? Perhaps to font authors or Microsoft.

mnaoumov commented 8 years ago

@Maximus5 , sorry if it sounded like a complain. I am just curios.

For both checked and unchecked they look significantly smaller than in Visual Studio or Sublime, which makes me think that your way to calculate size is not consistent with them

conemu-px

conemu-pt

Maximus5 commented 8 years ago

There is also "dpi" checkbox.

mnaoumov commented 8 years ago

P.S. And Admit monitor dpi with font size makes no difference

Maximus5 commented 8 years ago

OK, these are not "pt", but "device units" as described in CreateFont function.

mnaoumov commented 8 years ago

Lodged a separate feature request #481 to address font size selector

mnaoumov commented 8 years ago

BTW, I raised a question for DirectWrite on Source Code Pro repo https://github.com/adobe-fonts/source-code-pro/issues/116 and they advised to use TTF font instead of OTF. Now ConEmu looks great without DirectWrite

JoeUX commented 8 years ago

Hi all, I just saw this and wanted to note that DirectWrite and ClearType are not alternatives to each other. DirectWrite uses ClearType, and includes a lot of other features like OpenType typography, so it would never be one vs. the other. The choice is DirectWrite vs. GDI. This article is decent.

I'd love to see DirectWrite in ConEmu. Note that it's a bit of a moving target, as more features, APIs, and performance boosts are implemented with every major Windows release. I remember that Windows 8 saw a big bump in font rendering performance. DirectWrite is part of Direct2D, and new versions of 2D sometimes get backported to Windows 7.

awson commented 7 years ago

The greatest advantage of DirectWrite is that its high-level APIs perform automatic high-quality font fallback.

Standard Far: plain_far We can see that native console rendering is great, but automatic font fallback is not supported.

Far on ConEmu: conemu_far More glyphs are rendered but still not all of them and rendering is very poor.

DirectWrite (scite): dwrite All glyphs are here and the rendering is excellent (on par with native console).

I'm very interested in putting DirectWrite support in and could volunteer a bit, but I need some guidance on the ConEmu source code organization.

mqudsi commented 6 years ago

Please note that sharing screenshots is useless for clarity comparisons, and only indicative of font kerning and glyph support.

ClearType/Direct2D/DirectWrite optimize the placement of pixels for your display so naturally it makes no sense to expect output that's been customized for your display to accurately represent what you see when a screenshot of that is viewed on another person's system.

BYK commented 6 years ago

@Maximus5 do you have a few pointers for people who are willing to give this a shot?