Problems creating a field in LC8 DP16

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems creating a field in LC8 DP16

Wprothero
Folks:
My plot routines use fields as labels. Fields are created on the fly, the plot image is captured, and the fields are deleted. In LC8 DP16, I find that the field heights are messed up. I create the field and put text in it using the following function:

I know that fields work differently in version 8, but I thought the formattedHeight and formattedWidth should adjust the rect to make all of the text visible. This works fine in version 7
function iml_makeField tName,tText

        if there is no cd fld tName then

                create field tName

        end if

        put tText into fld tName

        set the visible of fld tName to FALSE

        set the showBorder of fld tName to FALSE

        set the style of fld tName to "transparent"

        set the textAlign of fld tName to "center"

        set the textfont of fld tName to "Arial"

        set the textSize of fld tName to 12

        set the borderWidth of fld tName to 0

        set the margins of fld tName to 2,3,0,0

        set the dontWrap of fld tName to true

        set the textHeight of fld tName to 20

        --wait for 0 seconds with messages

        set the fontStyle of fld tName to bold

        set the rect of fld tName to "0,0,"&(the formattedWidth of fld tName)&","&(the formattedHeight of fld tName)

        return the rect of fld tName

end iml_makeField


Any ideas?
Bill

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Http://es.earthednet.org
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a field in LC8 DP16

Wprothero
I got it working better by increasing the settings of the margins and setting the textHeight to 0.

Bill

> On Mar 17, 2016, at 6:58 PM, William Prothero <[hidden email]> wrote:
>
> Folks:
> My plot routines use fields as labels. Fields are created on the fly, the plot image is captured, and the fields are deleted. In LC8 DP16, I find that the field heights are messed up. I create the field and put text in it using the following function:
>
> I know that fields work differently in version 8, but I thought the formattedHeight and formattedWidth should adjust the rect to make all of the text visible. This works fine in version 7
> function iml_makeField tName,tText
>
> if there is no cd fld tName then
>
> create field tName
>
> end if
>
> put tText into fld tName
>
> set the visible of fld tName to FALSE
>
> set the showBorder of fld tName to FALSE
>
> set the style of fld tName to "transparent"
>
> set the textAlign of fld tName to "center"
>
> set the textfont of fld tName to "Arial"
>
> set the textSize of fld tName to 12
>
> set the borderWidth of fld tName to 0
>
> set the margins of fld tName to 2,3,0,0
>
> set the dontWrap of fld tName to true
>
> set the textHeight of fld tName to 20
>
> --wait for 0 seconds with messages
>
> set the fontStyle of fld tName to bold
>
> set the rect of fld tName to "0,0,"&(the formattedWidth of fld tName)&","&(the formattedHeight of fld tName)
>
> return the rect of fld tName
>
> end iml_makeField
>
>
> Any ideas?
> Bill
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Http://es.earthednet.org
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a field in LC8 DP16

[-hh]
In reply to this post by Wprothero
I deleted the four lines (*) of your function (see citation below)
and inserted instead the following 4 lines, in that order, at end of it.

  set fixedLineHeight of fld tName to true
  set textSize of fld tName to 12
  set textHeight of fld tName to 20
  return (0,0,the formattedWidth of fld tName, \
             the formattedHeight of fld tName)

because
1. the default setting of fixedLineHeight may have changed?
2. why use possible update bugs of "rect" if not needed?

Works fine here.

> William P. wrote:
> ==
function iml_makeField tName,tText
  if there is no cd fld tName then
    create field tName
  end if
  put tText into fld tName
  set the visible of fld tName to FALSE
  set the showBorder of fld tName to FALSE
  set the style of fld tName to "transparent"
  set the textAlign of fld tName to "center"
  set the textfont of fld tName to "Arial"
* set the textSize of fld tName to 12
  set the borderWidth of fld tName to 0
  set the margins of fld tName to 2,3,0,0
  set the dontWrap of fld tName to true
* set the textHeight of fld tName to 20
  --wait for 0 seconds with messages
  set the fontStyle of fld tName to bold
* set the rect of fld tName to "0,0,"& \
        (the formattedWidth of fld tName) &","&\
        (the formattedHeight of fld tName)
* return the rect of fld tName
end iml_makeField
> ==
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a field in LC8 DP16

Wprothero
So, I guess we can't count on the formattedHeight and formattedWidth to return dimensions of a rect that will show all of the text in a field? I would like to keep the rect of the field as small as possible. I also use it to make a 90 degree rotated label.

If this is a manifestation of a bug, I will probably just increase the space around the text.

Best,
Bill

William Prothero
http://es.earthednet.org

> On Mar 17, 2016, at 9:17 PM, -hh <[hidden email]> wrote:
>
> I deleted the four lines (*) of your function (see citation below)
> and inserted instead the following 4 lines, in that order, at end of it.
>
>  set fixedLineHeight of fld tName to true
>  set textSize of fld tName to 12
>  set textHeight of fld tName to 20
>  return (0,0,the formattedWidth of fld tName, \
>             the formattedHeight of fld tName)
>
> because
> 1. the default setting of fixedLineHeight may have changed?
> 2. why use possible update bugs of "rect" if not needed?
>
> Works fine here.
>
>> William P. wrote:
>> ==
> function iml_makeField tName,tText
>  if there is no cd fld tName then
>    create field tName
>  end if
>  put tText into fld tName
>  set the visible of fld tName to FALSE
>  set the showBorder of fld tName to FALSE
>  set the style of fld tName to "transparent"
>  set the textAlign of fld tName to "center"
>  set the textfont of fld tName to "Arial"
> * set the textSize of fld tName to 12
>  set the borderWidth of fld tName to 0
>  set the margins of fld tName to 2,3,0,0
>  set the dontWrap of fld tName to true
> * set the textHeight of fld tName to 20
>  --wait for 0 seconds with messages
>  set the fontStyle of fld tName to bold
> * set the rect of fld tName to "0,0,"& \
>        (the formattedWidth of fld tName) &","&\
>        (the formattedHeight of fld tName)
> * return the rect of fld tName
> end iml_makeField
>> ==
>
>
>
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Problems-creating-a-field-in-LC8-DP16-tp4702326p4702329.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Http://es.earthednet.org
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a field in LC8 DP16

Monte Goulding-2

> On 18 Mar 2016, at 4:39 PM, Earthednet-wp <[hidden email]> wrote:
>
> So, I guess we can't count on the formattedHeight and formattedWidth to return dimensions of a rect that will show all of the text in a field? I would like to keep the rect of the field as small as possible. I also use it to make a 90 degree rotated label.

I haven’t looked at your specific issue but for what it’s worth it is very easy to make a rotating text widget. Was my first experiment.

Cheers

Monte
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a field in LC8 DP16

[-hh]
William P. wrote:
> So, I guess we can't count on the formattedHeight and formattedWidth
> to return dimensions of a rect that will show all of the text in a field?

Sorry? The (modified) function works here as it should, I wrote "works fine here".
I think that simply the fixedTextHeight isn't set to true any more by default.
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a field in LC8 DP16

Dave Kilroy
In reply to this post by Wprothero
There WAS an issue with formattedheight for fields with non-standard margins between dp8 and p15 (http://quality.livecode.com/show_bug.cgi?id=16977) - but in dp16 I find them now fixed so as far as I'm concerned formattedheight is fine in dp16
"The first 90% of the task takes 90% of the time, and the last 10% takes the other 90% of the time."
Peter M. Brigham
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a field in LC8 DP16

Richard Gaskin
In reply to this post by Wprothero
William Prothero wrote:
...
 >   set the fontStyle of fld tName to bold

Been spending too much time with CSS lately? :)

I think that should be:

    set the textStyle of fld tName to bold

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a field in LC8 DP16

Wprothero
In reply to this post by Monte Goulding-2
Monte,
Tnx, but I've solved that one. What's screwing me up is that the formattedHeight and formattedWidth don't give the correct answers. I don't know if it's a bug or something that's changed with the updated field code. I can fix it by adding to the margins. I just hate to do a workaround that may need to be modified in the future.

Best,
Bill

William Prothero
http://es.earthednet.org

> On Mar 17, 2016, at 10:42 PM, Monte Goulding <[hidden email]> wrote:
>
>
>> On 18 Mar 2016, at 4:39 PM, Earthednet-wp <[hidden email]> wrote:
>>
>> So, I guess we can't count on the formattedHeight and formattedWidth to return dimensions of a rect that will show all of the text in a field? I would like to keep the rect of the field as small as possible. I also use it to make a 90 degree rotated label.
>
> I haven’t looked at your specific issue but for what it’s worth it is very easy to make a rotating text widget. Was my first experiment.
>
> Cheers
>
> Monte
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Http://es.earthednet.org
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a field in LC8 DP16

Wprothero
In reply to this post by [-hh]
HH, and Richard:
Richard: Thanks for noticing the error in setting the textStyle.

Is this a bug? Shouldn’t the formattedHeight and formattedWidth show the text? I’m content to use my margins adjustment, but hope it doesn’t need to be revisited in the future. If so, it’s a small thing, but...

hh:
Thanks for your suggestions. The problem that I have with your solution is that it works for very short texts, but for longer, the field is not resized to show the entire text string. The only way I can get this to work and show all of the text in the field is to set the margins to a value that works. The final solution I have is below:

function iml_makeField tName,tText

        if there is no cd fld tName then

                create field tName

        end if

        put tText into fld tName

        set the visible of fld tName to FALSE

        set the showBorder of fld tName to FALSE

        set the style of fld tName to "transparent"

        set the textAlign of fld tName to "center"

        set the textfont of fld tName to "Arial"

        set the textSize of fld tName to 12

        set the margins of fld tName to "4,2,4,6"

        set the dontWrap of fld tName to true

        set the textHeight of fld tName to 20

        set the fixedLineHeight of fld tName to TRUE

        set the textStyle of fld tName to bold

        put "0,0,"&(the formattedWidth of fld tName)&","&(the formattedHeight of fld tName) into tRect

        set the rect of fld tName to tRect

        return the rect of fld tName

end iml_makeField

> On Mar 18, 2016, at 12:05 AM, -hh <[hidden email]> wrote:
>
> William P. wrote:
>> So, I guess we can't count on the formattedHeight and formattedWidth
>> to return dimensions of a rect that will show all of the text in a field?
>
> Sorry? The (modified) function works here as it should, I wrote "works fine
> here".
> I think that simply the fixedTextHeight isn't set to true any more by
> default.
>
>
>
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Problems-creating-a-field-in-LC8-DP16-tp4702326p4702332.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Http://es.earthednet.org
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a field in LC8 DP16

Richard Gaskin
William Prothero wrote:

> Is this a bug? Shouldn’t the formattedHeight and formattedWidth show the text? I’m content to use my margins adjustment, but hope it doesn’t need to be revisited in the future. If so, it’s a small thing, but...

The code looks like it should work, and here formattedWidth and
formattedHeight appear to work well.

Is there any chance you may have more than one field with the same name
on that card?

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a field in LC8 DP16

[-hh]
In reply to this post by Wprothero
William,

meanwhile I tested this in depth and must say that you are
right with that: The formattedWidth and formattedHeight don't
show the exact boundaries, as you wish.

But from my knowledge of TeX I know, that this isn't obtainable
for fonts that don't have an extremely optimized metric. This
isn't even solvable by "pure" typesetting engines (nor by LC).

The formattedWidth is meanwhile pretty good measured.
[It has some problems with extreme slanted fonts.
That's the problem of non-perfect text-metric of the fonts.]

The formattedHeight is *better than ever*, but has still some
problems with interline-spacing at top or at end of strings.

So, with the final version of script you probably have to wait
for stable 8.0.0 (or 8.0.1) -- there is too much "in motion"
with the new "text engine". Peter certainly could say more here.

Perhaps you should report this as bug, so that they know
there are, despite their improvements, still problems?

We should use for demos of these problems, to be fair with respect
to font-metrics, a high-quality otf/ttf-font (for example "Skia").

Hermann

p.s. I was some time ago preparing a stack for the Raspi-stacks
collection that shows the exact boundary box of the
"outer opaque region" of a transparent object. I'll expand it now to
test also the formattedHeight and formattedWidth of a text-display.


Wprothero wrote
Is this a bug? Shouldn’t the formattedHeight and formattedWidth show the text? I’m content to use my margins adjustment, but hope it doesn’t need to be revisited in the future. If so, it’s a small thing, but...
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a field in LC8 DP16

Trevor DeVore
In reply to this post by Wprothero
On Thu, Mar 17, 2016 at 9:58 PM, William Prothero <[hidden email]>
wrote:

> Folks:
> My plot routines use fields as labels. Fields are created on the fly, the
> plot image is captured, and the fields are deleted. In LC8 DP16, I find
> that the field heights are messed up. I create the field and put text in it
> using the following function:
>
> I know that fields work differently in version 8, but I thought the
> formattedHeight and formattedWidth should adjust the rect to make all of
> the text visible. This works fine in version 7
>

Bill,

Changes were made to how formattedHeight is calculated in LC 8. There are
issues with figuring out the formattedHeight for some fonts though. See the
comments on this commit:

https://github.com/livecode/livecode/pull/3633

I would suggest filing a bug report.

--
Trevor DeVore
ScreenSteps
www.screensteps.com    -    www.clarify-it.com
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a field in LC8 DP16

Wprothero
Trevor:
Thanks. I reported it, with a sample stack.
Best,
Bill

William Prothero, Ph.D.
University of California, Santa Barbara, Emeritus
[hidden email]



> On Mar 18, 2016, at 3:08 PM, Trevor DeVore <[hidden email]> wrote:
>
> On Thu, Mar 17, 2016 at 9:58 PM, William Prothero <[hidden email]>
> wrote:
>
>> Folks:
>> My plot routines use fields as labels. Fields are created on the fly, the
>> plot image is captured, and the fields are deleted. In LC8 DP16, I find
>> that the field heights are messed up. I create the field and put text in it
>> using the following function:
>>
>> I know that fields work differently in version 8, but I thought the
>> formattedHeight and formattedWidth should adjust the rect to make all of
>> the text visible. This works fine in version 7
>>
>
> Bill,
>
> Changes were made to how formattedHeight is calculated in LC 8. There are
> issues with figuring out the formattedHeight for some fonts though. See the
> comments on this commit:
>
> https://github.com/livecode/livecode/pull/3633
>
> I would suggest filing a bug report.
>
> --
> Trevor DeVore
> ScreenSteps
> www.screensteps.com    -    www.clarify-it.com
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Http://es.earthednet.org