Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Pat O'Callaghan 34 posts 56 karma points
    Dec 08, 2010 @ 22:26
    Pat O'Callaghan
    0

    Client Dependency Framework and @font-face

    Hey guys,

    has anyone come across an issue when Client Dependency is turned on that @font-face fonts aren't served correctly? When I turn Client Dependency off  (<compilation debug="true">) the font is served correctly. 

    Looking in the Firebug Net Tab it tries to retrieve the font from the following URL "{My Site URL}/fonts/babasneue/bebasneue-webfont.woff%27)%20format(%27woff" and it gets a 404 not found and goes to my fallback font. While if I turn it off it retrieves it correctly from "{My Site URL}/fonts/babasneue/bebasneue-webfont.woff" and the font is shown correctly

    Any ideas?

    Thanks,

    Pat

  • Pat O'Callaghan 34 posts 56 karma points
    Dec 09, 2010 @ 03:34
    Pat O'Callaghan
    0

    Just an update on this, it seems to be the regex that is used to minify the CSS that is causing the problem.

    In my CSS I am using the font-face declarations favoured by Paul Irish and generated by Font-Squirrel.

    /** @font-face fonts **/
    @font-face {
    font-family'BebasNeue';
    srcurl("/fonts/babasneue/bebasneue-webfont.eot");
    srclocal(""), 
    url("/fonts/babasneue/bebasneue-webfont.woff") format("woff"), 
    url("/fonts/babasneue/bebasneue-webfont.ttf") format("truetype"), 
    url("/fonts/babasneue/bebasneue-webfont.svg#webfontuC643DpI") format("svg");
    font-weightnormal;
    font-stylenormal;
    }

     

    From looking at the CSS generated by the Client Dependency Framework it seems to be grabbing the whole of the url/format declaration and wrapping all of it as a url. So url("/fonts/babasneue/bebasneue-webfont.woff") format ("woff"), comes out in the generated CSS as url("http://localhost:45560/fonts/babasneue/bebasneue-webfont.woff%27)%20format(%27woff") instead of a url() and a format(). It seems the regular expression to determine the url is screwing up.

    Any ideas how to fix this without having to resort to pulling this declaration out of my stylesheet completely and putting it somewhere else?

    Thanks,

    Pat

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Dec 09, 2010 @ 13:57
    Aaron Powell
    0

    ClientDependency is CSS2 compliant, not CSS3, you'll have to raise a bug on codeplex - http://clientdependency.codeplex.com

    In the mean time I'd put your @font-face delcarations into a separate file which isn't handled by ClientDependency.

  • Pat O'Callaghan 34 posts 56 karma points
    Dec 09, 2010 @ 21:05
    Pat O'Callaghan
    0

    Thanks Slace, I was afraid I was going to have to do that. I'll raise an issue for it then. Thanks.

    I'm marking this as solved as a workaround was provided.

  • Shannon Deminick 1524 posts 5270 karma points MVP 2x
    Dec 09, 2010 @ 22:59
    Shannon Deminick
    0

    You can also just turn off css minify, see documentation here:

    http://clientdependency.codeplex.com/wikipage?title=Configuration&referringTitle=Documentation

    enableCssMinify = false

  • Pat O'Callaghan 34 posts 56 karma points
    Dec 09, 2010 @ 23:14
    Pat O'Callaghan
    0

    Thanks Shannon, that's good to know. In the end though I've decided to just place the @font-face declaration in a style tag in my Base masterpage as I still want to take advantage of CD's CSS minification. This is working fine.

     

  • Jack Murphy 1 post 21 karma points
    Jul 22, 2011 @ 19:59
    Jack Murphy
    0

    As far as I can tell disabling CSS minification does not fix the issue.

  • Pavel Gurecki 55 posts 158 karma points
    May 15, 2014 @ 15:23
    Pavel Gurecki
    0

    Hi,

    thread is very old, but I have same problem in Umbraco 6.1.3.

    I am using inline svg in my css:

    filter: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' ><filter id='grayscale' filterRes='183' ><feColorMatrix type='matrix'   values='0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0'/></filter></svg>#grayscale");

    Even with minification turned off it becomes:

    filter: url("image/svg+xml;utf8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20%3E%3Cfilter%20id='grayscale'%20filterRes='183'%20%3E%3CfeColorMatrix%20type='matrix'%20%20%20values='0.3333%200.3333%200.3333%200%200%200.3333%200.3333%200.3333%200%200%200.3333%200.3333%200.3333%200%200%200%200%200%201%200'/%3E%3C/filter%3E%3C/svg%3E#grayscale");

    Everything was ok until latest Firefox update, when it started throwing errors for this lines, so I need to fix it somehow. Putting this to separate .css file would be last resort, as I have quite strict file structure (multiple compiled .less files) and I use this as a Less mixin.

    It seems that CDF url-encodes strings, any ideas how to turn this off?

  • Shannon Deminick 1524 posts 5270 karma points MVP 2x
    May 15, 2014 @ 15:37
    Shannon Deminick
    0

    The problem is that the CDF logic for this stuff hasn't kept up with the fast pace of technology. I don't think there is a configuration option to do what you are doing, if you can log a bug at http://github.com/Shandem/ClientDependency

    I'll try to get a patch release out tomorrow - and yes i should have fixed this ages ago!

  • Pavel Gurecki 55 posts 158 karma points
    May 15, 2014 @ 16:33
    Pavel Gurecki
    0

    Thanks Shannon,

    I will create an issue on github.

    As a workaround I've encoded my svg in base64, this fixes the problem as there are almost no characters that get url encoded:

    filter: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnID48ZmlsdGVyIGlkPSdncmF5c2NhbGUnIGZpbHRlclJlcz0nMTgzJyA+PGZlQ29sb3JNYXRyaXggdHlwZT0nbWF0cml4JyAgIHZhbHVlcz0nMC4zMzMzIDAuMzMzMyAwLjMzMzMgMCAwIDAuMzMzMyAwLjMzMzMgMC4zMzMzIDAgMCAwLjMzMzMgMC4zMzMzIDAuMzMzMyAwIDAgMCAwIDAgMSAwJy8+PC9maWx0ZXI+PC9zdmc+#grayscale);
Please Sign in or register to post replies

Write your reply to:

Draft