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

Fabric Data Days Monthly is back. Join us on March 26th for two expert-led sessions on 1) Getting Started with Fabric IQ and 2) Mapping & Spacial Analytics in Fabric. Register now

tharunkumarRTK

Unlock Unlimited Fonts in Power BI — No Installs, No Custom Visuals, No Theme Changes

We all know that Power BI provides only a limited set of built-in fonts. To overcome this limitation, report developers often install custom fonts locally and modify the theme JSON file to use them.

However, this approach introduces a significant dependency: For report users to see the custom font correctly, the same font must also be installed on their device. Considering that report consumers may access reports from Windows, Mac, tablets, Power BI mobile app in Android, or iOS devices, maintaining such a dependency is not practical. In most real-world scenarios, this prevents developers from using custom fonts.

In this blog, I will explain a workaround that allows you to use any font in Power BI reports:

  • Without installing fonts on the user’s machine
  • Without using custom visuals
  • Without relying on external web dependencies

Important Notes

  1. This approach uses the SVG specification, so it works only in places where SVG images are supported
  2. SVG-based solutions have limitations and performance considerations. I have discussed those in previous blogs, you can read them here and here.
  3. Read the full article carefully before applying this method in enterprise reports.

High-Level Steps

  1. Download font files
  2. Convert .ttf files to .woff2
  3. Convert .woff2 files into Base64 strings
  4. Store the Base64 strings in DAX measures
  5. Create a reusable DAX UDF for SVG generation
  6. Apply the font to columns or measures

Implementation

Step 1 — Download the Font Files

You can download fonts from trusted sources such as, Google Fonts

tharunkumarRTK_2-1772359974231.png

 

Search for your desired font, open it and click on “Get font” button, it will add your font to the cart. Go to the cart then you will be able to download the fonts. I am downloading 5 fonts: Montseratt, Lato, Ralway, Inter and Roboto.

tharunkumarRTK_3-1772359984544.png

 

 

After unzipping, each font will have its own folder

tharunkumarRTK_4-1772360008876.png

 

containing multiple styles (Light, Bold, Italic, etc.) in .ttf format. Identify and list only the styles you actually need in your report.

tharunkumarRTK_5-1772360029034.png

 

Although .ttf files can technically be embedded, they are relatively large in size. To optimize performance, we will convert them to .woff2 format in the next step.

 

Step 2 — Convert .ttf to .woff2

Open Tansfonter site

Upload the selected .ttf files using “Add fonts”.

tharunkumarRTK_6-1772360043702.png

 

Click Convert. Download and unzip the output.

Inside the extracted folder, you will find the .woff2 files.

tharunkumarRTK_7-1772360063681.png

 

We cannot directly upload these files into Power BI. So next, we convert them into Base64 strings.

 

Step 3 — Convert .woff2 to Base64

Open Base64

Upload the .woff2 file. Click Encode file to Base64.

tharunkumarRTK_8-1772360088920.png

 

Download the generated Base64 string. Save each Base64 string locally. Note: Files must be converted one by one.

Step 4 — Store Base64 in DAX Measures

Create a new measure in Power BI and paste the Base64 string:

tharunkumarRTK_9-1772360107601.png

 

Repeat this for each font style you want to use.

tharunkumarRTK_10-1772360119296.png

Step 5 — Create a Reusable SVG User Defined Function (UDF)

Instead of rewriting the SVG structure repeatedly, centralize it using a DAX User-Defined Function (UDF):

 

DEFINE
 FUNCTION applyFont = (tex: string, font: string, fontName:string, alignment:string) =>
  VAR __Result =
      "data:image/svg+xml;utf8,
      <svg xmlns='http://www.w3.org/2000/svg' width='200' height='30'>
      <style>
      -face {
       font-family:'"&fontName&"';
       src: url('data:font/woff2;base64,"
        & font &
        "') format('woff2');
      }
      text {
       font-family: '"&fontName&"';
       font-size: 14px;
       fill: black;
       text-anchor: "&alignment&";
      }
      </style>
      <text x='50%' y='50%' dominant-baseline='middle'>"
        & tex &
        "</text>
      </svg>"
   RETURN 
    __Result

tharunkumarRTK_11-1772360156602.png

Step 6 — Apply the Font

Apply to a Calculated Column

CountrywithFont = 
applyFont(financials[Country], [fontMontserrat], "Montserrat", "middle")

tharunkumarRTK_12-1772360192969.png

 

Set the column’s Data Category to Image URL.

Apply to a Measure

CountryWithLatoFont = 
Var __SelectedCountry = SELECTEDVALUE(financials[Country])
Var __Result = applyFont(__SelectedCountry, [fontLato], "Lato","middle")
RETURN __Result

tharunkumarRTK_13-1772360224314.png

 

Also categorize the measure as Image URL.

When placed in a table visual, the custom fonts render correctly.

tharunkumarRTK_14-1772360241572.png

 

Similarly when I place all the fonts I apply all the fonts to Country column and place them in one visual, it looks like this

tharunkumarRTK_15-1772360263480.png

 

I created this report on a Windows machine, published it to power bi service, Then I opened it on a Mac device that did not have these fonts installed. The report rendered exactly the same as it did in Power BI Desktop. This confirms that the font is embedded inside the SVG, eliminating machine-level dependency.

tharunkumarRTK_16-1772360289983.png

 

Final Thoughts

This workaround is powerful, but it is not suitable for every scenario. I am sharing this purely for knowledge-sharing purposes. Please validate thoroughly before implementing in production environments.

Hope you learned something new. Please share your thoughts using the comments section below.

Happy Learning!!!