You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running Windows 8 and have a simple demo project which includes Cef. When starting up Dropbox in Cef I get a blurry screen as shown in the screenshot attached. I've also included the preferences from Display settings in Control Panel.
I have NVidia graphic card and have NVIDIA Control Panel running, but cannot find any specific settings which should affect this, but I'm no graphics geek. The sample project can be attached if needed.
Running dropbox.com from Windows Forms gives no issues with regards to the display.
I've noticed this myself, but this has mostly been caused by thirdparty fonts not being loaded properly. But on the second attempt (page reload) the bluryness was gone because the fonts loaded properly.
@tronda - please test the latest master. I managed to find a suitable workaround. It turned out to not be so easy, which is why you didn't see this comment yesterday already. π It was crazy, but it turned out to be a combination of two issues:
The fact that we were in fact rendering the Chromium content to a too small viewport (since we were giving Chromium the size of it in device-independent pixels, rather than "true pixels").
The fact that WPF uses this device-independent pixel system, and it's very hard to get rid of it.
What I did was add a ScaleTransform on the image (inside the WebView), so that we "scale it down" to the actual size it should be... Crazy, yes, but this should in essence mean that WPF will detect that its a conversion from 100 too 100, so in reality it should mean that no conversion will take place.
I encourage you to test this thoroughly. Preferably with both 100 and 125% settings applied. In the worst case, this will have performance implications (because of the above mentioned ScaleTransform) but in the best case, it will work well. Also, very important points: the mouse position we report to Chromium/CEF also had to be tweaked because of the transformation. I think I fixed it properly, but there's always a chance of some bug slipping in...
I have not had the time to test this, but it shouldn't take too much time since you can download the source, build it and run the example projects on a Win8 box with 125 size in the display as shown above. Alternatively you can try to modify it on a Win7 box.
it seems like this issue came back, at least, for me. What I've done is just started WPF example on my Windows 8.1 (resolution 3200x1800, scaling 250%). Please, take a look on blurry fonts:
Any zoom at all causes the same symptoms with the current stable build of 37.0.0. Is there a way to tell the renderer to use a larger size canvas on initialization?
I've found this happens when a browser control gets a non-integer coordinate relative to the window (e.g. 10.5 instead of 10). I fixed it by putting the browser control on a canvas and adding a Canvas.SizeChanged event handler:
private void Canvas_OnSizeChanged(object sender, SizeChangedEventArgs e)
{
var canvasPosition = Canvas1.TransformToAncestor(Application.Current.MainWindow).Transform(new Point(0, 0));
var x = 1 - Math.Abs((int)canvasPosition.X - canvasPosition.X);
var y = 1 - Math.Abs((int)canvasPosition.Y - canvasPosition.Y);
Canvas.SetLeft(browser, x);
Canvas.SetTop(browser, y);
browser.Height = Math.Round(e.NewSize.Height);
browser.Width = Math.Round(e.NewSize.Width);
}
maybe we can just add similar trick to control and align rendered image?
Reacted by Albert Lloveras, Alex Franchuk, longshuaicheng and Ganesh
AND using UseLayoutRounding="True" on the root container of my XAML (which is a Grid). Without the UseLayoutRounding="True" the image gets a little blurred.
Keep in min UseLayoutRounding="True" will disable antialiasing for all the code inside it, if you don't want it, try to wrap your control inside multiple grids and change UseLayoutRounding="True" to "False" accordingly to select which parts of your UI should have antialiasing and which shouldn't.
Reacted by Alex Franchuk, Ondrej Medek and Morten Christiansen
I've had issues with blurry page rendering also. Turned out to be caused by setting FontFamily on a TextBox control in the same WPF window. I don't understand why, but it might help to check the fonts if you're experiencing the issues...
I've found this happens when a browser control gets a non-integer coordinate relative to the window (e.g. 10.5 instead of 10). I fixed it by putting the browser control on a canvas and adding a Canvas.SizeChanged event handler:
private void Canvas_OnSizeChanged(object sender, SizeChangedEventArgs e)
{
var canvasPosition = Canvas1.TransformToAncestor(Application.Current.MainWindow).Transform(new Point(0, 0));
var x = 1 - Math.Abs((int)canvasPosition.X - canvasPosition.X);
var y = 1 - Math.Abs((int)canvasPosition.Y - canvasPosition.Y);
Canvas.SetLeft(browser, x);
Canvas.SetTop(browser, y);
browser.Height = Math.Round(e.NewSize.Height);
browser.Width = Math.Round(e.NewSize.Width);
}
maybe we can just add similar trick to control and align rendered image?
I tried this approach, when my window is launched the content of the browser is blurry. But when I tried resizing at certain coordinates the content becomes clear. But is there any way to get this effect on window load. Since my window cannot resize. Its a modal dialog.
I know its been more than 2 years that this thread is in-active.
@Ganeshcse
i think you can put this code to 'Loaded' event, maybe via dispatcher with some low priority to wait until content loads. Or (high chance) you'll need to use some html DOM's event.
Activity
peters commentedon Sep 11, 2013
I've noticed this myself, but this has mostly been caused by thirdparty fonts not being loaded properly. But on the second attempt (page reload) the bluryness was gone because the fonts loaded properly.
tronda commentedon Sep 11, 2013
I've tried to navigate the dropbox site after initial load, but didn't impact the bluryness. I've included a cache when setting up Cef:
I guess that if it was a cache issue, then the browser probably would cache the web font, but I might be mistaken.
perlun commentedon Sep 11, 2013
I've managed to reproduce this now; I'd clearly say it's a bug. Let's see how hard it is to fix...
perlun commentedon Sep 12, 2013
@tronda - please test the latest master. I managed to find a suitable workaround. It turned out to not be so easy, which is why you didn't see this comment yesterday already. π It was crazy, but it turned out to be a combination of two issues:
What I did was add a ScaleTransform on the image (inside the WebView), so that we "scale it down" to the actual size it should be... Crazy, yes, but this should in essence mean that WPF will detect that its a conversion from 100 too 100, so in reality it should mean that no conversion will take place.
I encourage you to test this thoroughly. Preferably with both 100 and 125% settings applied. In the worst case, this will have performance implications (because of the above mentioned ScaleTransform) but in the best case, it will work well. Also, very important points: the mouse position we report to Chromium/CEF also had to be tweaked because of the transformation. I think I fixed it properly, but there's always a chance of some bug slipping in...
tronda commentedon Sep 13, 2013
I will try to build CefSharp this weekend and try it out on my simple sample project. Thank you for resolving this so fast.
jimbourekas commentedon Oct 2, 2013
So is this resolved? Any news?
jim
tronda commentedon Oct 2, 2013
I have not had the time to test this, but it shouldn't take too much time since you can download the source, build it and run the example projects on a Win8 box with 125 size in the display as shown above. Alternatively you can try to modify it on a Win7 box.
perlun commentedon Oct 24, 2013
Reopening since we need to get this one fixed for CefSharp3 also.
perlun commentedon Mar 20, 2014
Closing now that #281 has been merged. Thank you, @JanEggers!
whitezaz commentedon Oct 28, 2014
Hello guys,
it seems like this issue came back, at least, for me. What I've done is just started WPF example on my Windows 8.1 (resolution 3200x1800, scaling 250%). Please, take a look on blurry fonts:

my scaling settings:

Have you any ideas what is this?
Thanks in advance!
CaptainBli commentedon Feb 25, 2015
Any zoom at all causes the same symptoms with the current stable build of 37.0.0. Is there a way to tell the renderer to use a larger size canvas on initialization?
gengjiawen commentedon Aug 24, 2016
Win10, 4K resolution has the same issue.
tshcherban commentedon Sep 19, 2016
I've found this happens when a browser control gets a non-integer coordinate relative to the window (e.g. 10.5 instead of 10). I fixed it by putting the browser control on a canvas and adding a Canvas.SizeChanged event handler:
maybe we can just add similar trick to control and align rendered image?
feinstein commentedon Nov 15, 2016
I fixed this problem by setting the control XAML tag as:
AND using
UseLayoutRounding="True"on the root container of my XAML (which is aGrid). Without theUseLayoutRounding="True"the image gets a little blurred.Keep in min
UseLayoutRounding="True"will disable antialiasing for all the code inside it, if you don't want it, try to wrap your control inside multiple grids and changeUseLayoutRounding="True"to"False"accordingly to select which parts of your UI should have antialiasing and which shouldn't.MarcBra commentedon Sep 13, 2017
I've had issues with blurry page rendering also. Turned out to be caused by setting FontFamily on a TextBox control in the same WPF window. I don't understand why, but it might help to check the fonts if you're experiencing the issues...
Ganeshcse commentedon Nov 4, 2019
I tried this approach, when my window is launched the content of the browser is blurry. But when I tried resizing at certain coordinates the content becomes clear. But is there any way to get this effect on window load. Since my window cannot resize. Its a modal dialog.
I know its been more than 2 years that this thread is in-active.
tshcherban commentedon Nov 4, 2019
@Ganeshcse
i think you can put this code to 'Loaded' event, maybe via dispatcher with some low priority to wait until content loads. Or (high chance) you'll need to use some html DOM's event.