Fonts -- Loading Base64 Encoded Fonts

Hi,
is there,
i was wondering if there is any possibility to load base64 encrypted font files. Or to use encrypted fonts through any method.

cheers dennis

1 Like

Hello, and welcome to the forum, @DennisM! :tada:

I don’t know anything about encrypted font files. Maybe you are referring to Base64 encoded font files? In that case yes, it should be doable using loadFont and data URLs:

let myFont;

function preload() {
  // The example data URL below is incomplete, you have to replace it whit the actual data URL of your font.
  myFont = loadFont('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAHwwABMAAAAA[...]AA==');
}

function setup() {
  fill('#ED225D');
  textFont(myFont);
  textSize(36);
  text('p5*js', 10, 50);
}
3 Likes

Thanks Sven!

Works fine for me! :+1:t2:

1 Like