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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Andrelele
New Contributor II

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
Honored Contributor

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
dm-p
Honored Contributor

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)




Andrelele
New Contributor II

Dear Daniel,

it worked in my project! Thank you very much.


Sincerely,

 

Andrelele

Helpful resources

Announcements
Users online (27)