Result = LoadFont(#Font, Name$, Height [, Flags])
How to change the Size and Bold or Italic without changing the Name?
For example
LoadFont(#Font, "", 32 , #PB_Font_Bold) or LoadFont(#Font, #PB_Ignore, 32 , #PB_Font_Bold)
LoadFont Current Name?
Re: LoadFont Current Name?
Code: Select all
EnableExplicit
Procedure AdjustFont(Font, Height, Flags)
If IsFont(Font) = 0 : ProcedureReturn : EndIf
! var font = spider.font.objects.Get(v_font);
! var fontFamily = font.family;
! spider_FreeFont(v_font);
! spider_LoadFont(v_font, fontFamily, v_height, v_flags);
EndProcedure
OpenWindow(0, 0, 0, 222, 130, "SetGadgetFont", #PB_Window_ScreenCentered)
LoadFont(0, "Arial", 16)
ButtonGadget(0, 10, 10, 200, 30, "Arial 16")
SetGadgetFont(0, FontID(0))
AdjustFont(0, 32, #PB_Font_Italic | #PB_Font_Bold) ; adjust Font 0
SetGadgetFont(0, FontID(0)) ; reassign font to the gadget
Re: LoadFont Current Name?
I probably didn't describe the question correctly
In your example:
LoadFont(0, "Arial", 16)
. i.e. you have already defined the font.family "Arial"
And I don't want to know. I want to change the size and attributes of the font that in each case has already been defined by someone before.
In your example:
LoadFont(0, "Arial", 16)
. i.e. you have already defined the font.family "Arial"
And I don't want to know. I want to change the size and attributes of the font that in each case has already been defined by someone before.
2B or not 2B = FF
Re: LoadFont Current Name?
Maybe I'm still misunderstanding you, but if you want to change a font(-style), you must have the font number. And if you have it, then you can call AdjustFont().
Re: LoadFont Current Name?
Code: Select all
OpenWindow(0, 0, 0, 222, 130, "SetGadgetFont", #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 200, 30, "default font")
;??????????
MyLoadFont(1,#PB_Ignore, #PB_Ignore , #PB_Font_Bold)
;??????????
ButtonGadget(1, 10, 40, 200, 30, "default font bold")
SetGadgetFont(1, FontID(1))
2B or not 2B = FF
Re: LoadFont Current Name?
something like this?
Code: Select all
OpenWindow(0, 0, 0, 222, 130, "SetGadgetFont", #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 200, 30, "default font")
Define GID
Define FontName.s
Define FontHeight
GID = GadgetID(0)
! v_fontname = $(v_gid.div).css("fontFamily");
! v_fontheight = $(v_gid.div).css("fontSize");
LoadFont(1, FontName, FontHeight, #PB_Font_Bold)
ButtonGadget(1, 10, 40, 200, 30, "default font bold")
SetGadgetFont(1, FontID(1))
Re: LoadFont Current Name?
spiderbasic itself do not support directly what you are trying to achieve
you have to mess your self with page's css
changing globally will affect everything.
The "trick" is to explicit use span element inside button text to trick it, you also change text later to alter this
an example of this
you have to mess your self with page's css
changing globally will affect everything.
The "trick" is to explicit use span element inside button text to trick it, you also change text later to alter this
an example of this
Code: Select all
OpenWindow(0, 0, 0, 222, 130, "SetGadgetFont", #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 200, 30, "global size font 150%")
; Following javascrtipt command changes size GLOBALLY to all of yous page, no matter before or after
! document.body.style.fontSize = "150%";
ButtonGadget(1, 10, 40, 200, 30, "<span style='font-size:22px'> fixed 22px</span>")
ButtonGadget(2, 10, 80, 200, 30, "<span style='font-size:50%'> fixed 50%</span>")
SetGadgetText(2,"<span style='font-size:20%'> fixed 20%</span>")
Christos
Re: LoadFont Current Name?
Thank you all.
Both in SB and PB I am missing next to (loadfont,setfont) GETFONT.
Both in SB and PB I am missing next to (loadfont,setfont) GETFONT.
2B or not 2B = FF