Saving a font as a custom property

Marty Knapp martyknapp at comcast.net
Fri Feb 17 13:49:12 EST 2012


Lars,
Here's a couple of routines I use that may help you:

on saveFont
    answer file "Choose a font to embed:"
    if it is emtpy then exit to top
    set itemDel to "/"
    set the uFontName of this stack to last item of it --save the name
    set the uEmbeddedFont of this stack to URL ("binfile:" & it) --save 
the actual font
end saveFont

on extractFont
    put pathYouWantToSaveTo & (the uFontName of this stack) into 
tFontPath--add the name of the font to path
    if there is not a file tFontPath then
       put (the uEmbeddedFont of this stack) into URL ("binfile:" & 
tFontPath) --write from cp to disk
    end if
end extractFont

I got these from someone else (can't remember who) and they have served 
me well. Perhaps you can adapt them for your use.

Marty K
> I have been fooling around with revFontLoad in Windows for quite a while now with varying degrees of succes, nostly very little. I found an old post that suggested saving the font as a custom property, and then when the application loads, saves that custom property as its original font. So far so good.
>
> revFontload works when this font is already in its place (in aplication data) and so does revFontUnLoad. However I can't get the script that right that gets the custom property and saves it as a font again.
>
> To set the custom property, I used:
>
>      set the myFont1 of stack "fireUp" to (url("binfile:"&  (specialFolderPath(26)&  "/vTrainerFiles/vDeuEng/Ipa93sr.ttf")))
>      set the myFont2 of stack "fireUp" to (url("binfile:"&  (specialFolderPath(26)&  "/vTrainerFiles/vDeuEng/Ipa93sb.ttf")))
>
> I think this worked because those two custom properties now contain a whole lot of gibberish characters, just like when I save a stack as a custom property. I am of course not sure if it really worked.
>
> for then getting the custom property and saving it as its original font, I have tried both
>
>      get the myFont1 of stack "fireUp"
>      save it as URL(binfile:&  specialFolderPath(26)&  "\TrainerFiles\vDeuEng\Ipa93sr.ttf")
>
> and
>
>      get the myFont1 of stack "fireUp"
>      save it as (specialFolderPath(26)&  "\TrainerFiles\vDeuEng\Ipa93sr.ttf")
>
> Both of these reult in errors and and the fonts are not saved.
>
> What am I doing wrong?
>
> Cheers,
>
> Lars
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>





More information about the use-livecode mailing list