Direct2D Renderer (Font Hinting, Windows RT, No Win Phone 8)

Discussion and support for general JUCE issues

Re: Direct2D Renderer (Font Hinting, Windows RT, Win Phone 8

Postby sonic59 » Sun May 06, 2012 4:57 am

1) ClearType support seems not good enough, some words to show green or red


It is quite confusing as there seems to be "ClearType Fonts" and then there is the the "Sub-pixel ClearType" rendering that is applied to all fonts regardless whether they are a "ClearType Font" or just a plain old font.
I think you are talking about the Sub-pixel ClearType rendering.

There are a other text rendering modes, after Line 44 (HRESULT hr = factories.d2dFactory->CreateHwndRenderTarget...) in juce_win32_Direct2DGraphicsContext.cpp you can drop in:
Code: Select all
renderingTarget->SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode);

The options for D2D1_TEXT_ANTIALIAS_MODE can be found here.

2) CPU consumes too much, increase more than doubled when d2d enabled (12% -> 26%, Intel i7, 2600K).


Yes there is lots of optimization work needed to be done.

3) the main interface can't responding anything after maximized the window, application suspended animation.


I had never maximized the application before. You are right there is definitely something going wrong there. Part of the missing functionality I'm guessing.
Last edited by sonic59 on Sun May 06, 2012 5:01 am, edited 1 time in total.
sonic59
JUCE UberWeenie
 
Posts: 223
Joined: Tue Mar 09, 2010 5:51 pm

Re: Direct2D Renderer (Font Hinting, Windows RT, Win Phone 8

Postby SwingCoder » Sun May 06, 2012 5:00 am

Thanks sonic59, can you upload this picture in JUCE forum?

The Chinese government blocked many sites, I can't see this picture.

I must used the anti-blocking software then can access many sites. Sometimes yes, sometimes can't, obviously, my luck not good now...
Windows 7 X64, VS2010, Latest JUCE tip
SwingCoder
JUCE UberWeenie
 
Posts: 1160
Joined: Thu Oct 07, 2010 4:44 pm

Re: Direct2D Renderer (Font Hinting, Windows RT, Win Phone 8

Postby sonic59 » Sun May 06, 2012 5:04 am

No problem. I have changed the image in my previous post from a direct link to an attachment so hopefully you can see it now.
sonic59
JUCE UberWeenie
 
Posts: 223
Joined: Tue Mar 09, 2010 5:51 pm

Re: Direct2D Renderer (Font Hinting, Windows RT, Win Phone 8

Postby SwingCoder » Sun May 06, 2012 5:06 am

sonic59 wrote:Glad you got it working. Your samples are interesting.
How is the performance of JuceDirect2D your machine? Noticeably slow?
Performance is based on both CPU and GPU. I'm running on older hardware (Core 2 Duo, GF 9400m) so I'm wondering how it works on something faster.

It may be easier to test performance in the Juce Demo. You can get the Juce Demo to work with D2D by copying over those 6 files I mentioned in my previous post to your juce folder that the Juce Demo uses. You should ignore the render time as it is clearly wrong.

Image

The glyphs I have pointed out seem pretty unreadable. Is that normal for that font at that size?

Seen it!

Not normal, these are too small.

And my graphics card:AMD radeon HD 6800 Series.
Windows 7 X64, VS2010, Latest JUCE tip
SwingCoder
JUCE UberWeenie
 
Posts: 1160
Joined: Thu Oct 07, 2010 4:44 pm

Re: Direct2D Renderer (Font Hinting, Windows RT, Win Phone 8

Postby SwingCoder » Sun May 06, 2012 5:48 am

sonic59 wrote:
There are a other text rendering modes:
Code: Select all
renderingTarget->SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode);


Results:
JUCE_soft_render.png
JUCE_soft_render.png (80.22 KiB) Viewed 906 times


D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE.png
D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE.png (22.98 KiB) Viewed 906 times
Windows 7 X64, VS2010, Latest JUCE tip
SwingCoder
JUCE UberWeenie
 
Posts: 1160
Joined: Thu Oct 07, 2010 4:44 pm

Re: Direct2D Renderer (Font Hinting, Windows RT, Win Phone 8

Postby SwingCoder » Sun May 06, 2012 5:50 am

D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE.png
D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE.png (22.96 KiB) Viewed 906 times


D2D1_TEXT_ANTIALIAS_MODE_ALIASED.png
D2D1_TEXT_ANTIALIAS_MODE_ALIASED.png (10.64 KiB) Viewed 906 times
Windows 7 X64, VS2010, Latest JUCE tip
SwingCoder
JUCE UberWeenie
 
Posts: 1160
Joined: Thu Oct 07, 2010 4:44 pm

Re: Direct2D Renderer (Font Hinting, Windows RT, Win Phone 8

Postby TheVinn » Sun May 06, 2012 3:55 pm

It might be possible to use native system calls to extract the outlines from a font, without going through the pain of trying to locate the actual file. Then, the outlines can be passed to the TrueType autohinter to get adjusted for a specific font height.
Open Source: LayerEffects, VFLib, SimpleDJ, DSP Filters, LuaBridge, JUCE, FreeType, TagLib
"This isn't a big project, it shouldn't take long." - Jules
User avatar
TheVinn
JUCE UberWeenie
 
Posts: 2975
Joined: Sat Aug 29, 2009 11:31 am
Location: Marina del Rey, California

Re: Direct2D Renderer (Font Hinting, Windows RT, Win Phone 8

Postby sonic59 » Sun May 06, 2012 4:13 pm

It might be possible to use native system calls to extract the outlines from a font, without going through the pain of trying to locate the actual file.


Actually, this is what the font system already does. It's just that the system was never designed to handle hinted fonts per Jules's preference. So when we obtain the font outlines, we ask for them at size 1024 that way we know for sure that the outlines don't have any font hinting applied. The outlines are then scaled to the appropriate font height using standard path transformations.

I don't really see much of a reason for Juce to support hinting itself since hinting can be supported via platform dependent software renderers. That is pretty much the only way that text will the same as text in other native programs. This is actually already complete on Mac OS X, all glyphs are rendered using CoreGraphics (when using the CoreGraphics renderer) itself so small fonts looks just as they do in native mac applications.

On Linux and Android it is much easier to get the actual files so FreeType is the best bet there.
sonic59
JUCE UberWeenie
 
Posts: 223
Joined: Tue Mar 09, 2010 5:51 pm

Re: Direct2D Renderer (Font Hinting, Windows RT, No Win Phon

Postby sonic59 » Wed Oct 31, 2012 2:22 pm

So the Windows Phone 8 SDK finally landed. While it does support Direct3D 11.1, it does not have Direct2D support or DirectWrite support. Bummer. Maybe we'll see it in Windows Phone 9.

http://www.gamedev.net/blog/1046/entry- ... as-landed/

So it looks like most optimal way of bringing Juce to Windows RT and Windows Phone 8 will be to port the OpenGL renderer to Direct3D 11.1 and create a Direct3D renderer.
sonic59
JUCE UberWeenie
 
Posts: 223
Joined: Tue Mar 09, 2010 5:51 pm

Previous

Return to General JUCE discussion

Who is online

Users browsing this forum: No registered users and 2 guests