Just starting out? Need help? Post your questions and find answers here.
orangetek
Posts: 19 Joined: Fri Dec 08, 2017 2:32 pm
Post
by orangetek » Mon Jun 22, 2020 8:00 am
Hi, what am i doing wrong?
Code: Select all
loginwindow = OpenWindow(#PB_Any, 0, 0, 400, 300, "", #PB_Window_BorderLess | #PB_Window_ScreenCentered)
canvas = CanvasGadget(#PB_Any, 0, 0, 400, 300)
text.s = "test"
If StartDrawing(CanvasOutput(canvas))
Debug "Text Width: " + TextWidth(text) ; <---- Always Zero ??
Debug "Text Height: " + TextHeight(text)
DrawText(0, 0, text)
StopDrawing()
EndIf
Peter
Posts: 1093 Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:
Post
by Peter » Mon Jun 22, 2020 8:12 am
orangetek wrote: Hi, what am i doing wrong?
works here:
orangetek
Posts: 19 Joined: Fri Dec 08, 2017 2:32 pm
Post
by orangetek » Mon Jun 22, 2020 8:24 am
I am using a linux environment. I just tested it in Windows and it works.
orangetek
Posts: 19 Joined: Fri Dec 08, 2017 2:32 pm
Post
by orangetek » Mon Jun 22, 2020 8:26 am
Brave browser "cross-site fingerprinting blocked" .. so its a browser issue, but only on width? how strange
Peter
Posts: 1093 Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:
Post
by Peter » Mon Jun 22, 2020 8:38 am
orangetek wrote: Brave browser "cross-site fingerprinting blocked" .. so its a browser issue, but only on width? how strange
interesting:
support.mozilla.org wrote:These are some of the characteristics of your device and browser that fingerprints can collect:
Extensions you use
Operating system and model of your device
Screen resolution and language
Information about your network connection
Fonts installed on your computer
orangetek wrote: but only on width?
Width and Height are determined differently.
Code: Select all
function spider_TextWidth(a) {
return Math.ceil(spider.drawing.context.measureText(a).width)
}
and
Code: Select all
function spider_TextHeight(a) {
a = spider_2ddrawing_getTextHeight(spider.drawing.context.font);
return a.ascent + a.descent
}
For this reason
measureText(a).width is probably responsible for the error message
orangetek
Posts: 19 Joined: Fri Dec 08, 2017 2:32 pm
Post
by orangetek » Mon Jun 22, 2020 8:51 am
Thanks peter. I have another issue with loading fonts but ill create a new topic