It is currently Sun Apr 22, 2018 7:25 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: [Not a bug] TextWidth Missmatch PB561 OS10.12-10.13
PostPosted: Sun Nov 12, 2017 9:23 am 
Offline
Addict
Addict

Joined: Sat Mar 02, 2013 9:17 am
Posts: 850
This demo code results different text lengths
Tested PB561 OS 10.12 - 10.13

Meanwhile, I assume a PB bug
It can be very unpleasant and strange for text length calculations
With nearly any text, the difference is approximately one character width

Code:
CreateImage(1, 300, 100)
OpenWindow(1, 0, 0, 300, 100, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
StartDrawing(ImageOutput(1))
Debug TextWidth("Hello World")
twidth=TextWidth("H")+TextWidth("e")+TextWidth("l")+TextWidth("l")+TextWidth("o")+
       TextWidth(" ")+TextWidth("W")+TextWidth("o")+TextWidth("r")+TextWidth("l")+TextWidth("d")
Debug twidth
Box(0, 0, twidth, 20, $FF)
DrawText(0, 0, "Hello World")
StopDrawing()
ImageGadget(1, 0, 0, 0, 0, ImageID(1))
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow

_________________
http://www.nachtoptik.de - The home of GFX_Wizzard_BF (BF) and QUICK_AES_256


Last edited by walbus on Sun Nov 12, 2017 8:27 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: TextWidth Missmatch PB561 OS 10.12 - 10.13
PostPosted: Sun Nov 12, 2017 11:03 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1299
As a guess, could it be due to automatic font kerning of entire words, versus no font kerning for individual characters?


Top
 Profile  
Reply with quote  
 Post subject: Re: TextWidth Missmatch PB561 OS 10.12 - 10.13
PostPosted: Sun Nov 12, 2017 12:26 pm 
Offline
Addict
Addict

Joined: Sat Mar 02, 2013 9:17 am
Posts: 850
@Dude
Yeah, possible, it's weird.
I used it for a text stretching function
It was not easy to find out why it doesn't work correct on Macs :twisted:

(A hint for BF and DrawText_EX Users : I have add a workaround for Mac, now)

_________________
http://www.nachtoptik.de - The home of GFX_Wizzard_BF (BF) and QUICK_AES_256


Top
 Profile  
Reply with quote  
 Post subject: Re: TextWidth Missmatch PB561 OS 10.12 - 10.13
PostPosted: Sun Nov 12, 2017 12:42 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 30, 2013 4:39 pm
Posts: 382
Here, on 10.7 it is both 64 and it must be both the same otherwise it makes no sense.


Top
 Profile  
Reply with quote  
 Post subject: Re: TextWidth Missmatch PB561 OS 10.12 - 10.13
PostPosted: Sun Nov 12, 2017 1:04 pm 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1299
I'm thinking because the text "AW" might only end up being 15 pixels due to kerning the two characters together; but "A" by itself might be 10, and "W" by itself might also be "10", if you know what I mean? Just guessing, though.

What happens if you do it with a fixed-with font, like Courier? That would rule out kerning as the cause.


Top
 Profile  
Reply with quote  
 Post subject: Re: TextWidth Missmatch PB561 OS 10.12 - 10.13
PostPosted: Sun Nov 12, 2017 1:23 pm 
Offline
Addict
Addict

Joined: Sat Mar 02, 2013 9:17 am
Posts: 850
@Dude
That's logical, I think you're primarily right.
Hmmm, on Mac its also with a row "IIIIIIII"
But, as a result, my workaround for Mac is the only correct method for stretched text on all OSs, "WAWA" is ever different :shock:

The stretched text is and looking very cool
Once you've seen or used this one, you don't want to miss it

_________________
http://www.nachtoptik.de - The home of GFX_Wizzard_BF (BF) and QUICK_AES_256


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye