partial workaround for cross-platform fonts
Michael J. Lew
michaell at unimelb.edu.au
Wed Jul 27 01:42:42 EDT 2005
I think that Phil might be onto a good workaround for cross-platform
fonts. He suggested an image of a fld instead of the fld, and that
should be perfectly OK for any locked fld. It makes the stack bigger,
but mostly that doesn't matter.
I've made a button that puts a snapshot over each locked, visible fld
and keeps a record in order to be able to remove the images as
needed. It seems to work well on one platform (Mac) but I can't
conveniently check that the result works on any other. I think it
should. The script is below. Just put a button onto the first card of
a stack and put the script into it. A click should overlay the
appropriate flds with images, and an option-click should remove the
images.
Two questions:
1. Does it work for others?
2. Can we optimise the script to make it into a generally useful workaround?
At 10:38 PM -0500 26/7/05, Phil Davis wrote:
> > There's a font with identical metrics on multiple platforms?
>
>Yep - it's called a snapshot of the screen (or at least of the field).
>:o) That's what I was referring to as having the same metrics on all
>platforms. I guess I didn't finish connecting the dots in the
>explanation of my proposed solution.
>
>
>Phil
on mouseUp
if the optionkey is not down then --make images
repeat with i=1 to the number of cards
go to card i
put empty
repeat with f=1 to the number of flds
set the cursor to busy
if the locktext of fld f and the visible of fld f then
put "Making image of fld " & the short name of fld f &
return after msg
put the rect of fld f into trect
--adjust the rect to make it relative to the stack.\
(I don't know why this is needed, but it is).
add the left of this stack to item 1 of trect
add the left of this stack to item 3 of trect
add the top of this stack to item 2 of trect
add the top of this stack to item 4 of trect
--make the image and place it over the fld
import snapshot from rectangle trect
set the loc of last image to the loc of fld f
set the layer of last image to (the layer of fld f)+1
--keep a record
set the cFldImagesList of me to \
the cFldImagesList of me & the id of last image & return
end if
end repeat
end repeat
else
--delete the images to get back to the flds
put the cFldImagesList of me into myList
repeat for each line tid in myList
set the cursor to busy
if there is an image id tid then --it might have been manually deleted
put "Deleting image id " & tid
delete image id tid
end if
end repeat
put "Done"
set the cFldImagesList of me to empty
end if
end mouseUp
Regards,
Michael
--
Michael J. Lew
Senior Lecturer
Department of Pharmacology
The University of Melbourne
Parkville 3010
Victoria
Australia
Phone +613 8344 8304
**
New email address: michaell at unimelb.edu.au
**
More information about the use-livecode
mailing list