LoadFont and line-height
Posted: Fri Oct 02, 2020 1:00 pm
Hello, is there a way to adjust the properties of the loaded font?
I need more line-height..
Cya Dirk
I need more line-height..
Cya Dirk
line-height always refers to the element that uses the font; not to the font itself.plouf wrote:i think he is asking how to change line-height of a font this is a css atribute
yes, that is correctplouf wrote:and long as i know you can not do with spiderbasci commands have to tweak css directly
Code: Select all
OpenWindow(0, 100, 100, 400, 400, "Line-Height")
LoadFont(0, "Arial", 50)
SetGadgetFont(#PB_Default, FontID(0))
TextGadget(0, 10, 10, 380, 380, "<div style='line-height:150%'>Lorem ipsum dolor sit amet, consetetur sadipscing elitr</div>")That's OK, but remember that you are adding an unnecessary div element to the TextGadget (span element). When changing text with SetGadgetText() you must always remember that the div element is included.munfraid wrote:Last time I needed this I just used this:Code: Select all
[...] TextGadget(0, 10, 10, 380, 380, "<div style='line-height:150%'>Lorem ipsum dolor sit amet, consetetur sadipscing elitr</div>")
Code: Select all
EnableExplicit
Procedure SetGadgetLineHeight(Gadget, LineHeight.s)
If IsGadget(Gadget) = 0 : ProcedureReturn : EndIf
Protected GID = GadgetID(Gadget)
Select GadgetType(Gadget)
Case #PB_GadgetType_Text
! $(v_gid.gadget).css("line-height", v_lineheight);
EndSelect
EndProcedure
OpenWindow(0, 100, 100, 400, 400, "Line-Height")
LoadFont(0, "Arial", 50)
SetGadgetFont(#PB_Default, FontID(0))
TextGadget(0, 10, 10, 380, 380, "Lorem ipsum dolor sit amet, consetetur sadipscing elitr")
SetGadgetLineHeight(0, "150%")