altFont: Load a font

Mark Swindell mdswindell at cruzio.com
Tue Nov 28 14:16:10 CST 2006


I'm hoping that Rev will make altFont a relatively transparent  
feature when it gets incorporated into the next version of Rev.  Such  
that there is a simple "imbed" option in the standalone builder, and  
that the ensuing standalone will check font availability and do the  
install/uninstall on the host computer as needed upon startup/shutdown.
Mark

On Nov 28, 2006, at 11:06 AM, Adrian Williams wrote:

> Hello,
>
> I recently purchased altFont and using the
> buttons that came with the DEMO stack all works fine,
> using altFont to embed a font in my app.
>
> I have been able to "SuckUp" the font in the IDE.
> "SpitOut" the font from the button's custom prop. into the default  
> Folder.
> Now all I want to do is "Load a font" from the default Folder!
> Simple enough if a clicked button presents the User with a dialog
> to navigate the the font, but I don't want the User to have to do  
> that.
> Why should they.
> I know where the font is sitting - its in the default Folder.
> So how can I replace the code below with something triggered by the  
> card script
> to load the font automatically rather than the button...
>
> --snippet of code
> on mouseUp
>   answer file "choose a ttf file to load"
>   if it is empty then exit to top
>   put the fontNames into tOldList
>   put the number of lines in tOldList into tNumOfFonts
>
>   --> ONLY COMMAND FOR LOADING
>   XLOAD_FONT it
>   put the result into tResult
>   if tResult is not empty then
>     answer warning tResult
>     exit to top
>   end if
> --etc. etc
>
> I did get a solution from the altFont author Chris Bohnert, but it  
> lacked
> enough comment for this newbie to understand how to use uFileName and
> uEmbeddedFile and where to put the script...
>> Adrian,
>>
>> The code you're using is very dangerously relying on the value of  
>> 'it'
>> remaining stable between the call to Answer file and the call to  
>> XLOAD_FONT.
>>
>> I'd leave your 'suck up' button in place (hiding it when you ship)
>> and do the following to load the font.  The 'suck up' button sets the
>> uFileName custom prop and uEmbeddedFile.
>>
>> put the uFileName of this card into tFilePath
>> --if you need to append a subdir struct into the path you can do  
>> it now with
>> put "./mysubdir/" & tFilePath into tFilePath
>> put the uEmbeddedFile of this card into URL("binfile:" & tFilePath )
>>
>> if there is a file tFilePath then
>>   XLOAD_FONT tFilePath
>> else
>>   answer information "Font missing"
>> end if
>
> Any guidance would be appreciated,
> Thanks,
> Adrian
> ______________________
> Club Type
> http://www.clubtype.co.uk
> adrian at clubtype.co.uk_______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>




More information about the use-livecode mailing list