Looking for Help on a Project

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

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

Re: Looking for Help on a Project

Post by SparkOut » Sat Jul 01, 2017 9:38 am

Guessing this is for desktop, you will need to "start using font file" before it is accessible.

The copy files tab will include a subfolder under the standalone directory call "Fonts" which will can be referenced:

Code: Select all

start using font file (specialFolderPath("Resources") & "/Fonts/Pacifico.ttf")
substitute the .ttf filename or add additional "start using" lines. Once the font file has been loaded, you can

Code: Select all

set the textFont of field "fancyText" to "Pacifico"
(or other font name appropriately)

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Sat Jul 01, 2017 10:31 am

Hi Sparkout.
It worked but something strange is happening.

I made a little text stack button that loads all fonts on the computer.

Code: Select all

on mouseDown
   open stack "Text"
end mouseDown
The fonts in the main stack do not load on startup of the standalone...but...when i
open the "Text" stck with the button, all fonts load correctlyon the main stack.

What is happening? I tried opening the text stack on startup but it does not work. It seems
only when I open the text stack from the button all fonts are set to normal?

Cheers
Bidge

terryho
Posts: 126
Joined: Mon Nov 05, 2012 2:53 pm

Re: Looking for Help on a Project

Post by terryho » Tue Jul 04, 2017 5:44 pm

Hi

please look at http://forums.livecode.com/viewtopic.php?f=53&t=29246

I think it is same on window.

regards

Terry Ho

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Wed Jul 05, 2017 1:00 am

Hi.
Just about defeated with this one so have finally decided to attach the stack to see if anyone can have a look and
suggest what I am doing wrong. When it's compiled the custom fonts " Pacifico", "Anton" and "Schoolbell" will not
load into the buttons or the text field they are set to.

Please help!
Bidge
Attachments
LoadingFonts.zip
(5.49 KiB) Downloaded 364 times

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Looking for Help on a Project

Post by Klaus » Wed Jul 05, 2017 11:20 am

Hi Bidge,

please try this:

Code: Select all

on openStack
   if the environment is not "development" then
      iphoneUseDeviceResolution true
   end if
    
   put "Pacifico.ttf,Anton.ttf,Schoolbell.ttf" into tFonts
   repeat for each item tFont in tFonts
      start using font file (specialFolderPath ("resources") & "/Fonts/" & tFont)
      if the result <> empty then
         answer the result
      end if    
   end repeat

   ## Load first, then use!
   set the textfont of button "Pacifico" to "Pacfico"
   set the textfont of button "Schoolbell" to "Schoolbell"
   set the textfont of button "Anton" to "Anton"   
end openStack
Best

Klaus

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Wed Jul 05, 2017 11:45 am

Hi Klaus.
Thank you again for your reply but sorry to report it does not work on the compiled standalone.
The fonts appear loaded into the field, but when clicked they do not change the textfont.
There must be some sort of bug?

I really appreciate the help.
Thanks
Bidge
EDIT: In case it matters I am exporting and running on windows 10

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Looking for Help on a Project

Post by Klaus » Wed Jul 05, 2017 12:15 pm

Hi Bidge,

ah, OK, I was just guessing from looking at the script.

So the names of the fonts appear in the field with the FONT names,
but the buttons will not "take" that font, is that correct so far?

I have been using this technique in the past and it works on Mac, Win and iOS, as I had experienced.

Maybe you want to send me one of the fonts and I will test it here?
Sent to: klaus AT major-k.de


Best

Klaus

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Wed Jul 05, 2017 12:29 pm

Just sent the fonts through.
Bidge

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

Re: Looking for Help on a Project

Post by SparkOut » Thu Jul 06, 2017 2:16 am

Tested here and there are no errors thrown when you load a font with "start using font file..." and the textFont can be set accordingly but no good results, unless I add "globally" to the end of the "start using font file..." statement.
Without "globally" the loaded font should be available only to the current application, but it is not EVEN available to the current application. Making it globally accessible seems to be a workaround, for me on Windows 10 with Version 9 dp7. Does it work for you?

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Thu Jul 06, 2017 3:10 am

Hi Sparkout.
No...on the compiled exe it did not work. Again, the fonts appear in the list but do not change the textfont when selected.
Thank you for the response though. I have reported it as a bug.

EDIT: When I test the standalone I do it on a machine that does not have the ported fonts installed otherwise it all LOOKS as if its working.

Bidge

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

Re: Looking for Help on a Project

Post by SparkOut » Thu Jul 06, 2017 7:37 am

Just to be sure, you are copying the Fonts sub folder to the test machine along with the standalone exe file, aren't you?
The fonts should not need to be installed in the windows fonts folder* but they do need to be on the target computer, in the correct location relative to the exe - ie in the Fonts folder in specialFolderPath("resources")


*should not need, if it wasn't for the bug blocking access unless the "globally" option is used with the "start using font file..." line

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Thu Jul 06, 2017 8:41 am

Hi Sparkout.
Yes. The Fonts folder is in the copy folder options for standalone with fonts inside the folder as well (just in case) all of the fonts by themselves.
The Fonts folder is also included in the standalone build with fonts included.

Bidge

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Looking for Help on a Project

Post by Klaus » Thu Jul 06, 2017 1:52 pm

It turned out to be a bug on Windows:
http://quality.livecode.com/show_bug.cgi?id=20009
:(

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Fri Jul 07, 2017 3:26 am

Hi again. (Solved. Uninstalled LCV9 and installed LCV8)
As if I did'nt have enough trouble..... a piece of code is now going crazy. Can anyone help?
I have a series if numbers in .png format and I want to load them into a card on a sub stack.

For some weird reason the images are now simply loading straight into my main stack?????
This was working fine a week ago. Can anyone advise what the problem could be?

I recreated the stack and put the code below into a button and it still loads the images
straight into the main stack rather than the card "Nums" on the substack "ImageLoad"??????

Code: Select all

on mouseUp
   answer folder "select a folder"
   if the result is "Cancel" then exit mouseUp
   else
      if it <> "" then        
         set the defaultfolder to it       
         put the files into myListOfFiles  
         filter myListOfFiles with "*.png"
         repeat for each line myFile in myListOfFiles            
            import paint from file myFile into card "Nums" of stack "ImageLoad"           
         end repeat        
      end if
end if    
   end mouseUp
Thanks
Bidge

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Fri Jul 07, 2017 9:52 am

Hi Again.
I am nearing the end of my poster project thanks to all of your help. I have hit one more stumbling block and I hope it's not a bug. I have a stack that resizes to print in portrait or landscape. No matter what I do I cannot get the stack to print in landscape. It prints to .pdf in landscape but it will not do same from a printer. My stack size is: 842 x 595.

Here's my print code in case someone can please help:

Code: Select all

on mouseUp
   focus on nothing
   open printing with dialog
   if the result is "Cancel" then exit mouseUp
   set the printPaperOrientation to "landscape"
   set the printMargins to 0,0,0,0
   set the printPaperSize to "595,842"
   set the printScale to 1
   print stack "ImageArea"
   close printing
end mouseUp 
Like I said, the same code prints in Landscape for pdf but not on the printer.
Thanks again
Bidge

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”