Page 1 of 1

Use external font

Posted: Sun May 08, 2022 6:55 am
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?

Re: Use external font

Posted: Sat May 21, 2022 1:46 pm
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

Re: Use external font

Posted: Wed May 25, 2022 6:11 am
by Stefan
You program God :)