Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Help] using external @font-face in API

August 25 (10 years ago)

Edited August 25 (10 years ago)
DXWarlock
Sheet Author
API Scripter
Maybe one of the css and API wizs here know how to do this.

Im trying to reference an external font for my <div> direct chat sends. But since you cannot do proper stylesheet code in API (or I cannot find a way) I cant work out how to do this.

For the example to call an external font you need:
@font-face {
	font-family: SomeFont; 
	src: url(http://thatsite.com/Thisfont.woff);
}
and then do such as:
<div style='font-family: SomeFont; font-size: 9pt;(......)
Is there a way to do the @font-face with inline css so API takes it. Or a way to define the above within the API so it works correctly?

August 25 (10 years ago)
Try using:
<style scoped>
/* your @font-face and other CSS rules go here */
</style>
August 25 (10 years ago)
Lithl
Pro
Sheet Author
API Scripter
Please post the actual font-family name you're using and the actual URL to the woff.
August 25 (10 years ago)

Edited August 25 (10 years ago)
DXWarlock
Sheet Author
API Scripter
I tried that badger but couldn't get the API to save and read it without a generic error when it called it (I was declaring it as a variable and calling it in the div, that might be the wrong way)

The name Im using is "Dust"
url is:http://alttabgamers.com/dust.woff
August 26 (10 years ago)

Edited August 26 (10 years ago)
Lithl
Pro
Sheet Author
API Scripter

I'd have to double-check, but "alt" may be one of the strings that cause the CSS to fail the security check. If you can get an alternate url to the resource, try that.

Edit: The above is incorrect. The strings which cause the sanitizer to throw out the CSS are:

  • data:
  • eval
  • cookie
  • window
  • parent
  • this
  • behavior
  • behaviour
  • expression
  • moz-binding
  • @import
  • @charset
  • javascript
  • vbscript
  • script