Fixedwidth font is not fixed

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Maxiogee
Posts: 38
Joined: Thu May 05, 2011 5:45 pm

Fixedwidth font is not fixed

Post by Maxiogee » Tue Dec 10, 2013 3:52 pm

I wish to use a fixed with font in a scrolling field to along certain sections of each line, to make reading the field easier.

I have used Courier on Mac OSX 10.9, using LiveCode 6.5.0

In TextEdit, the text aligns as I wish it to.
In LiveCode it is all awry.

The text has been aligned by setting the itemdelimiter to "|", calculating which line has the longest item 1 and adding " " to each line's item 1 until all lines have the same number of characters in their first item.

This screen capture shows the difference between how the same text looks in both apps.

What can I do to make LiveCode align the text?

Image

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Fixedwidth font is not fixed

Post by Simon » Tue Dec 10, 2013 11:50 pm

Hi Maxiogee,
I've just done a test in liveCode using Courier font an it does line up correctly.
I think you should copy the liveCode text field you are displaying and paste it into TextEdit to see if it lines up again. I think it wont. Check your code that enters the spaces.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: Fixedwidth font is not fixed

Post by SparkOut » Tue Dec 10, 2013 11:54 pm

Instead of padding with spaces, can't you use a tab-delimited set of data with tabstops set on the field to display?

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Fixedwidth font is not fixed

Post by Klaus » Wed Dec 11, 2013 1:07 pm

Hi guys,

If I remember correctly from the mailing list, this is a known bug in LC 6.x
and should be fixed in one of the next releases.


Best

Klaus

Maxiogee
Posts: 38
Joined: Thu May 05, 2011 5:45 pm

Re: Fixedwidth font is not fixed

Post by Maxiogee » Wed Dec 11, 2013 10:40 pm

Simon wrote:Hi Maxiogee,
I've just done a test in liveCode using Courier font an it does line up correctly.
I think you should copy the liveCode text field you are displaying and paste it into TextEdit to see if it lines up again. I think it wont. Check your code that enters the spaces.

Simon
That, Simon, is how I got that image I posted.

The text came from LiveCode to TextEdit, not the other way around.

Maxiogee
Posts: 38
Joined: Thu May 05, 2011 5:45 pm

Re: Fixedwidth font is not fixed

Post by Maxiogee » Wed Dec 11, 2013 10:42 pm

SparkOut wrote:Instead of padding with spaces, can't you use a tab-delimited set of data with tabstops set on the field to display?
Thanks SparkOut,
Unfortunately each card has a different maximum length to Item 1.
This means than some cards have extremely long lengths, which push ,much of the line offscreen.
I would not want to standardise the line length across all cards.

Maxiogee
Posts: 38
Joined: Thu May 05, 2011 5:45 pm

Re: Fixedwidth font is not fixed

Post by Maxiogee » Wed Dec 11, 2013 10:44 pm

Klaus wrote:If I remember correctly from the mailing list, this is a known bug in LC 6.x
Thanks Klaus.
I suspected, and feared, as much.

Klaus wrote:and should be fixed in one of the next releases.
I hope so.

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: Fixedwidth font is not fixed

Post by SparkOut » Wed Dec 11, 2013 10:57 pm

Maxiogee wrote:
SparkOut wrote:Instead of padding with spaces, can't you use a tab-delimited set of data with tabstops set on the field to display?
Thanks SparkOut,
Unfortunately each card has a different maximum length to Item 1.
This means than some cards have extremely long lengths, which push ,much of the line offscreen.
I would not want to standardise the line length across all cards.
No, but if you are calculating the amount of spaces to pad the first item, then you can calculate a suitable tabstop, surely?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Fixedwidth font is not fixed

Post by Simon » Thu Dec 12, 2013 2:57 am

hmmm...
Must just be on Mac then
2013-12-11_1752.png
Win 7 it's aligned

Code: Select all

on mouseUp
   put "" into fld 1
   put  "I wish to use a fixed with font" & cr & \
         "I have used Courier on Mac OSX" & cr & \
         "In TextEdit" & cr & \
         "In LiveCode" & cr & \
         "The text has been"  into tText
   put the num of chars of line 1 of tText into tNum --cheat I already know it's the longest line
   repeat for each line tLine in tText
      put the num of chars of tLine into tCount
      put tNum - tCount into tSpace
      repeat with x = 1 to tSpace
         put space after tLine
      end repeat
      put tLine & "|" & cr after fld 1
   end repeat
end mouseUp
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Maxiogee
Posts: 38
Joined: Thu May 05, 2011 5:45 pm

Re: Fixedwidth font is not fixed

Post by Maxiogee » Sat Dec 14, 2013 1:03 pm

Maxiogee wrote:
Klaus wrote:If I remember correctly from the mailing list, this is a known bug in LC 6.x
Thanks Klaus.
I suspected, and feared, as much.

I can confirm that it is a 6.x issue.

I have just now opened all the affected stacks with LiveCode 5.5.4 — having viewed them (with the non-alignment visible) first in LiveCode 6.5 — and the lines along perfectly.
Saving them in 5.5.4 and opening them in 6.5 the fault reappears immediately.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Fixedwidth font is not fixed

Post by Klaus » Sat Dec 14, 2013 1:19 pm

Could you please report this as a bug? http://quality.runrev.com
Thanks!

Maxiogee
Posts: 38
Joined: Thu May 05, 2011 5:45 pm

Re: Fixedwidth font is not fixed

Post by Maxiogee » Sat Dec 14, 2013 7:35 pm

Klaus wrote:Could you please report this as a bug? http://quality.runrev.com
Thanks!
Done

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Fixedwidth font is not fixed

Post by jacque » Sun Dec 15, 2013 9:24 pm

The calculations for text width were broken in LiveCode 6.5, but have been fixed in 6.5.1 rc 1. If you have that version, try it there. My current project was misbehaving in multiple ways because of the bug, but in the latest rc everything went back to normal. Someone at RR must have noticed, because when I searched for a related bug report I couldn't find one, and I was about to enter one until I thought to test in the latest version.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply