Re: TextWidth - strange on Mac OS :-)
Posted: Mon Nov 13, 2017 10:35 am
you can use this code to see where the kerning occurs:
Code: Select all
Procedure debugKerning(s.s)
Protected c1.s, c2.s, w1, w2
If Len(s) > 1
For i=1 To Len(s)-1
c1 = Mid(s, i, 1)
c2 = Mid(s, i+1, 1)
w1 = TextWidth(c1) + TextWidth(c2)
w2 = TextWidth(c1 + c2)
Debug c1 + c2 + " : " + Str(w2 - w1)
Next
EndIf
EndProcedure
;LoadFont(0, "monospace", 12)
CreateImage(1, 100, 100)
StartDrawing(ImageOutput(1))
;DrawingFont(FontID(0))
Debug TextWidth("Hello World")
Debug TextWidth("H")+TextWidth("e")+TextWidth("l")+TextWidth("l")+TextWidth("o")+
TextWidth(" ")+TextWidth("W")+TextWidth("o")+TextWidth("r")+TextWidth("l")+TextWidth("d")
debugKerning("Hello World")
StopDrawing()
96
97
He : 0
el : 0
ll : 0
lo : 0
o : 0
W : 0
Wo : -1
or : 0
rl : 0
ld : 0