Use external font

Just starting out? Need help? Post your questions and find answers here.
Stefan
Posts: 88
Joined: Mon Feb 05, 2018 9:44 pm

Use external font

Post by Stefan »

I would like to use a font in my spider application that is guaranteed not to be available to all users.
After some googling I found the following sample code:

Code: Select all


@font-face {
  font-family: 'Noto Color Emoji';
  src: url(https://raw.githack.com/googlefonts/noto-emoji/main/fonts/NotoColorEmoji.ttf);
}
Is this also possible with Spiderbasic?
I don't know how to add the above code to Spider.

Can I somehow determine which font is currently being used by the browser?
User avatar
Peter
Posts: 963
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Use external font

Post by Peter »

Code: Select all

! $("<style>@font-face { font-family: 'Noto Color Emoji' ; src: url(https://raw.githack.com/googlefonts/noto-emoji/main/fonts/NotoColorEmoji.ttf) } </style>").appendTo("head");

LoadFont(0, "Arial", 30)
LoadFont(1, "Noto Color Emoji", 30)

If OpenWindow(0, 0, 0, 530, 110, "Noto Color Emoji - Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  
  TextGadget(0, 10, 10, 110, 40, "Arial:", #PB_Text_Border | #PB_Text_VerticalCenter)
  TextGadget(1, 10, 60, 110, 40, "Noto Color Emoji:", #PB_Text_Border | #PB_Text_VerticalCenter)
  TextGadget(2, 130, 10, 390, 40, "🛳🏞️🔮🧭🥝🦌😍", #PB_Text_Border)
  TextGadget(3, 130, 60, 390, 40, "🛳🏞️🔮🧭🥝🦌😍", #PB_Text_Border)  
  
EndIf

SetGadgetFont(2, FontID(0))
SetGadgetFont(3, FontID(1))
Image
Stefan
Posts: 88
Joined: Mon Feb 05, 2018 9:44 pm

Re: Use external font

Post by Stefan »

You program God :)
Post Reply