<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Importing Google fonts /using Google Fonts in cust Viz dev in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Importing-Google-fonts-using-Google-Fonts-in-cust-Viz-dev/m-p/3174590#M7284</link>
    <description>&lt;P&gt;Is there any way to use Google fonts in custViz.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am developing the custViz using powerbi-visuals-api and I am very keen to find out if this is a possibility.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a classic html set up, this is what I do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;Document&amp;lt;/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;script type="text/javascript" src="https://d3js.org/d3.v7.min.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;style&amp;gt;
      @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100&amp;amp;display=swap');
    &amp;lt;/style&amp;gt;
    &amp;lt;div id="sandbox-div"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;script src="prod.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="397" data-lia-user-login="dm-p" class="lia-mention lia-mention-user"&gt;dm-p&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Apr 2023 19:44:28 GMT</pubDate>
    <dc:creator>smpa01</dc:creator>
    <dc:date>2023-04-05T19:44:28Z</dc:date>
    <item>
      <title>Importing Google fonts /using Google Fonts in cust Viz dev</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Importing-Google-fonts-using-Google-Fonts-in-cust-Viz-dev/m-p/3174590#M7284</link>
      <description>&lt;P&gt;Is there any way to use Google fonts in custViz.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am developing the custViz using powerbi-visuals-api and I am very keen to find out if this is a possibility.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a classic html set up, this is what I do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;Document&amp;lt;/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;script type="text/javascript" src="https://d3js.org/d3.v7.min.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;style&amp;gt;
      @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100&amp;amp;display=swap');
    &amp;lt;/style&amp;gt;
    &amp;lt;div id="sandbox-div"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;script src="prod.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="397" data-lia-user-login="dm-p" class="lia-mention lia-mention-user"&gt;dm-p&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 19:44:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Importing-Google-fonts-using-Google-Fonts-in-cust-Viz-dev/m-p/3174590#M7284</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2023-04-05T19:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Google fonts /using Google Fonts in cust Viz dev</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Importing-Google-fonts-using-Google-Fonts-in-cust-Viz-dev/m-p/3177748#M7294</link>
      <description>&lt;P&gt;I am trying the following in .less file&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;400&amp;amp;display=swap');

*{
    font-family: 'Roboto', sans-serif;
}&lt;/LI-CODE&gt;
&lt;P&gt;and I am running into this error in the built&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/user/viewprofilepage/user-id/17823" target="_blank"&gt;@v-viig&lt;/A&gt; &lt;A href="https://community.powerbi.com/t5/user/viewprofilepage/user-id/112988" target="_blank"&gt;@v-evelk&lt;/A&gt; &lt;A href="https://community.powerbi.com/t5/user/viewprofilepage/user-id/24489" target="_blank"&gt;@nikitagrachev&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2023 15:11:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Importing-Google-fonts-using-Google-Fonts-in-cust-Viz-dev/m-p/3177748#M7294</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2023-04-07T15:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Google fonts /using Google Fonts in cust Viz dev</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Importing-Google-fonts-using-Google-Fonts-in-cust-Viz-dev/m-p/3185230#M7311</link>
      <description>&lt;P&gt;The same build completes in a different pc (one that does not generate a self signed certificate error) with the same css declaration for a gogole font. But I see this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Refused to load the font 'https://fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1MmgWxP.ttf' because it violates the following Content Security Policy directive: "default-src https://app.powerbi.com data: blob: 'unsafe-inline' 'unsafe-eval'". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.&lt;/LI-CODE&gt;
&lt;P&gt;Can someone pls confirm if google fonts are restricted altogether in custViz. If yes, I don't want to waste time and&amp;nbsp; I will try to make use of the fonts that are available. If no, what do I do from here to bypass that? I have a req where gFont can be utilized for visual asthetics unless this is entirely restricted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/user/viewprofilepage/user-id/17823" target="_blank" rel="noopener"&gt;@v-viig&lt;/A&gt; &lt;A href="https://community.powerbi.com/t5/user/viewprofilepage/user-id/112988" target="_blank" rel="noopener"&gt;@v-evelk&lt;/A&gt; &lt;A href="https://community.powerbi.com/t5/user/viewprofilepage/user-id/24489" target="_blank" rel="noopener"&gt;@nikitagrachev&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 02:58:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Importing-Google-fonts-using-Google-Fonts-in-cust-Viz-dev/m-p/3185230#M7311</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2023-04-13T02:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Google fonts /using Google Fonts in cust Viz dev</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Importing-Google-fonts-using-Google-Fonts-in-cust-Viz-dev/m-p/3185292#M7312</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="24978" data-lia-user-login="smpa01" class="lia-mention lia-mention-user"&gt;smpa01&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assumning that you've added&amp;nbsp;&lt;A href="https://fonts.gstatic.com" target="_blank"&gt;https://fonts.gstatic.com&lt;/A&gt;&amp;nbsp;to your visual's privileges for web access and it's still being refused,&amp;nbsp;the Google domains may be imposing further cross domain issues against the custom visual sandboxing from their end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, if you're OK with bundling the font as part of your visual, then this will be possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With Deneb I've loaded the DIN font (as this doesn't seem to be available to custom visuals) as a base64 URL into my visual.less and this gets packaged and works inside the visual. &lt;A href="https://github.com/deneb-viz/deneb/blob/b3e3ad9efff1d5132181cfcc820336ebf890f771/style/visual.less#L10-L16" target="_self"&gt;You can see an example of how I set this up here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're using a custom webpack configuration and have an appropriate loader, you may just be able to load the font using a relative URL in your source (I don't use powerbi-visuals-webpack-plugin as it never seems to be reliable enough for me and it defintiely doesn't work using powerbi-visuals-tools as-is).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, this may give you a way to achieve what you want, even if not as you were intending originally.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 03:43:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Importing-Google-fonts-using-Google-Fonts-in-cust-Viz-dev/m-p/3185292#M7312</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2023-04-13T03:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Google fonts /using Google Fonts in cust Viz dev</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Importing-Google-fonts-using-Google-Fonts-in-cust-Viz-dev/m-p/3186244#M7315</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="397" data-lia-user-login="dm-p" class="lia-mention lia-mention-user"&gt;dm-p&lt;/a&gt;&amp;nbsp; thanks for the response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Assumning that you've added&amp;nbsp;&lt;A href="https://fonts.gstatic.com" target="_blank" rel="nofollow noopener noreferrer"&gt;https://fonts.gstatic.com&lt;/A&gt;&amp;nbsp;to your visual's privileges for web access&lt;/STRONG&gt;&lt;/EM&gt; _ No, I did not do that cause I don't know how to do that explicitly. If you can please let me know how to do that, would be great.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;However, if you're OK with bundling the font as part of your visual, then this will be possible&lt;/STRONG&gt; &lt;/EM&gt;- I also did not know that gFonts can be bundled as part of the viz and I tried this. You made my day !!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;getComputedStyle(document.querySelector('#sandbox-host &amp;gt; p')).font
//returns as desired &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can't thank you enough for this TBH.&lt;/P&gt;
&lt;P&gt;Web is so mysterious.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 13:45:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Importing-Google-fonts-using-Google-Fonts-in-cust-Viz-dev/m-p/3186244#M7315</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2023-04-13T13:45:04Z</dc:date>
    </item>
  </channel>
</rss>

