Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Andrelele
Frequent Visitor

Power BI Custom Visuals development - Issue with font "DIN" for SVG

hello dear people,

 

in Power BI Custom Visuals I'm trying to develop a simple card visual. There I want to have the possibility to change the fonts of my elements in my SVG. I do this with the help of the FontControl inside my Custom Visual project file.

 

When I change the font to "DIN", the FontControl does not apply it to its element, instead uses something else. I looked up with the console.log on Power BI Webservice which value it uses instead of "DIN". And it shows "wf_standard-font, helvetica, arial, sans-serif" when I select "DIN" in my FontControl.

 

The FontControl has bold, italic, underline, fontSize and fontFamily as properties. As an alternative I tried to use the FontPicker but unfortunately had the same outcome as the FontControl.

 

I looked up several other posts in our Power BI Forums regarding to font, with no success for me.

 

For a different approach I tried to make use of the Custom Themes of Power BI Desktop. With a .json I set the fontFamily globally to "DIN" and with "wf_standard-font, helvetica, arial, sans-serif" too. When I loaded my Custom Visual to Power BI Desktop, the results are the same as prior to my approach with FontControl/FontPicker.

Here are the links for the implementation of Custom Themes in Power BI:

Here are screenshots of my project as reference:

Screenshot 2025-02-14 102632.png

And for some reason in the format pane under General > Title, the font uses the correct "DIN" in contrast to my Visual > "Wert" with "DIN":

Screenshot 2025-02-14 103424.png

Screenshot 2025-02-14 103446.png

Screenshot 2025-02-14 103342.png

thanks in advance

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @Andrelele,

 

For some reason, DIN or the underlying font is unavailable for custom visuals, but you can package it in your visual and reference it to provide some continuity. Here's an example of how I've solved the problem for the HTML Content visual, which involved:

 

  • Adding the font file to my visual's CSS via a data URI.
  • Creating aliases for the font face (so that either DIN or wf_standard-font works as a valid font-family. If you don't do this, using the underlying font-family you're trying in your OP should work fine, though.

 

Good luck,

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

2 REPLIES 2
Andrelele
Frequent Visitor

Dear Daniel,

it worked in my project! Thank you very much.


Sincerely,

 

Andrelele

dm-p
Super User
Super User

Hi @Andrelele,

 

For some reason, DIN or the underlying font is unavailable for custom visuals, but you can package it in your visual and reference it to provide some continuity. Here's an example of how I've solved the problem for the HTML Content visual, which involved:

 

  • Adding the font file to my visual's CSS via a data URI.
  • Creating aliases for the font face (so that either DIN or wf_standard-font works as a valid font-family. If you don't do this, using the underlying font-family you're trying in your OP should work fine, though.

 

Good luck,

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors