Fonts on standalone app fuzzy, but when in the IDE they are crisp

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Fonts on standalone app fuzzy, but when in the IDE they are crisp

Post by jalz » Sat Sep 15, 2018 6:47 am

Hey all,

I’m working with the latest stable release of LC 9 and the fonts on the development environment which inclides the IDE and my app look really crisp.

When I create a standalone of my app, and then execute my app on Windows 10, the font is the same, but nowhere near as crisp as when in the development environment. Is there something I can do in the build process that will allow my compiled programs to use the same fonts as the ide uses?

Thanks

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9286
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Fonts on standalone app fuzzy, but when in the IDE they are crisp

Post by richmond62 » Sat Sep 15, 2018 6:16 pm

At the risk of sounding stupid:

Is your standalone deployed on the same machine you developed the stack on?

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Fonts on standalone app fuzzy, but when in the IDE they are crisp

Post by jalz » Sat Sep 15, 2018 10:41 pm

Hi,

Not a stupid question at all and yes it is. I’m running the executable from the standalone build folder in my Surface Pro.

Thanks

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Fonts on standalone app fuzzy, but when in the IDE they are crisp

Post by jalz » Tue Sep 18, 2018 9:37 pm

Hi, a quick update. I thought I would try and bundle the same fonts the IDE uses to my app, using the copy files/folders option in the standalone settings. So to find the fonts in the IDE I opened up the messagebox and typed in answer fontFilesInUse. That command gave me a whole list of fonts in use, so in my app on the openstack handler I have put the following code in hoping that it would load the fonts in memory and therefore they would become crisp.

Code: Select all


   
   put specialFolderPath("resources") & slash & "fonts" & slash into tFontSrc 
   answer tFontSrc
   //start using font file "C:/myFontFolder/myCustomFont.ttf"
   start using font file tFontSrc & "SourceCodePro-SemiboldIt.ttf"
   start using font file tFontSrc & "SourceCodePro-Semibold.ttf"
   start using font file tFontSrc & "SourceCodePro-Regular.ttf"
   start using font file tFontSrc & "SourceCodePro-MediumIt.ttf"
   start using font file tFontSrc & "SourceCodePro-Medium.ttf"
   start using font file tFontSrc & "SourceCodePro-LightIt.ttf"
   start using font file tFontSrc & "SourceCodePro-Light.ttf"
   start using font file tFontSrc & "SourceCodePro-It.ttf"
   start using font file tFontSrc & "SourceCodePro-ExtraLightIt.ttf"
   start using font file tFontSrc & "SourceCodePro-ExtraLight.ttf"
   start using font file tFontSrc & "SourceCodePro-BoldIt.ttf"
   start using font file tFontSrc & "SourceCodePro-Bold.ttf"
   start using font file tFontSrc & "SourceCodePro-BlackIt.ttf"
   start using font file tFontSrc & "SourceCodePro-Black.ttf"
   start using font file tFontSrc & "lcideicons.ttf"
   start using font file tFontSrc & "fontawesome.ttf"
   
Unfortunately, this hasn't worked, it looks like the fonts are loaded in memory but the fonts for display are are still fuzzy and not crisp like the IDE.

Does anyone else have anything else I can try?

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Fonts on standalone app fuzzy, but when in the IDE they are crisp

Post by AxWald » Wed Sep 19, 2018 1:11 pm

Hi,

after messing around with "start using font" for a while I now do as follows:

1. I put my .ttf's into [StandAloneFolder]/fonts. This way I have them available. For Android it's all that's needed, already.

2. For Windows, I check on "openstack" if the fontnames are "in the fontNames". If they are not, I throw an "answer" informing the user that we need the font, are about to install it and that it, please, may acknowledge the following UAC dialog.

3. Then I install the font via VBScript:

Code: Select all

put "SpecialFont.ttf" into myFont
put specialfolderpath("resources") & "\fonts" into myPath
replace slash with backslash in myPath

put "Set objShell = CreateObject(" & quote & "Shell.Application" & quote & ")" & CR & \
      "Set objFolder = objShell.Namespace(" & quote & myPath & quote & ")" & CR & \
      "Set objFolderItem = objFolder.ParseName(" & quote & myFont & quote & ")" & CR & \
      "objFolderItem.InvokeVerb(" & quote & "Install" & quote & ")" into myVBS
      
do myVBS as "VBScript"
if the result is not empty then [...]
4. That's it. Now the user has the font, and I don't need to care anymore for it ;-)

Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

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

Re: Fonts on standalone app fuzzy, but when in the IDE they are crisp

Post by Klaus » Wed Sep 19, 2018 1:32 pm

I never had any problem with "start using font..." on Windows. However the concatenation does not seem correct, use BRACKETS, the engine likes that, to say the least! :D

Code: Select all

...
put specialFolderPath("resources") & slash & "fonts" & slash into tFontSrc 
answer tFontSrc
start using font file (tFontSrc & "SourceCodePro-SemiboldIt.ttf")
start using font file (tFontSrc & "SourceCodePro-Semibold.ttf")
start using font file (tFontSrc & "SourceCodePro-SemiboldIt.ttf")
...

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Fonts on standalone app fuzzy, but when in the IDE they are crisp

Post by jalz » Wed Sep 19, 2018 3:09 pm

Thank you both for replying.

My fonts now appear to be a lot sharper, I've tried a different monitor and checked the font on various builds. I think its the way the Surface Pro renders them, but I can see the fonts are loaded in memory now and look a lot smoother than when they were not there in my older builds.

jstewartathartford
Posts: 11
Joined: Tue Jan 01, 2019 4:41 pm

Re: Fonts on standalone app fuzzy, but when in the IDE they are crisp

Post by jstewartathartford » Tue Feb 25, 2020 3:49 am

After much searching, this subject comes the closest to addressing my problem.
I would like to have a specific font embedded in my Standalone. I have looked at many entries and gone through the following steps:
I go to the File -- Standalone Application Settings and use the Copy Files option to Add 4 Roboto font files into the box labeled "Non-Stack files in the Application."

In my Stack script I have:
On PreOpenStack
start using font file (specialfolderpath ("Resources") & "/---.ttf") file name changed b/c I could not submit with original name
start using font file (specialfolderpath ("Resources") & "/----.ttf")
start using font file (specialfolderpath ("Resources") & "/----.ttf")
start using font file (specialfolderpath ("Resources") & "/----.ttf")
end PreOpenStack

However, the Standalone does not have the fonts in it, but they are carried along in a separate folder with the created Standalone and it seems the user of the Standalone has to be instructed in how to load the fonts. Is there an "easy" way to avoid the need of user input? (I am not sure a VB method would be easy for me, but maybe.) IF NOT, what font would be the most common on PC computers? I would just use that one and give up my colleagues desire to have that nice consistent Roboto font use across all applications.
Thanks,
jay

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Fonts on standalone app fuzzy, but when in the IDE they are crisp

Post by bogs » Tue Feb 25, 2020 10:40 am

Well, this seems to list the most common ones across desktop OS'es.

Keep in mind, though, that even if you decide to use a single font that (theoretically) be on the system, the 3 different desktops have slightly different ways of displaying text that you may have to average the size of fields and such to account for. I'm pretty sure that part is easy to code for, but it is equally easy to overlook, for instance over the years the IDE itself has often had text display issues.

As to your not being able to submit the font names, it isn't because of the name per se, but because you have less than 10 posts and the name looks like a URL, i.e. it has dots in it.

When you pass the magic number of ten, you will be able to include names and urls and attach things and like that.
Image

jstewartathartford
Posts: 11
Joined: Tue Jan 01, 2019 4:41 pm

Re: Fonts on standalone app fuzzy, but when in the IDE they are crisp

Post by jstewartathartford » Wed Feb 26, 2020 4:11 am

Thanks for the link. I guess I sized the text fields too much to fit one (unusual) font. I will make them larger.
jay

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Fonts on standalone app fuzzy, but when in the IDE they are crisp

Post by bogs » Wed Feb 26, 2020 12:16 pm

Well, the fields should be able to be automatically resized to fit the text, I believe formattedWidth / formattedHeight are what your looking for for that.

If you go down that road, though, you will also want to look into your own sizing / placement routines. I've attached a very basic demo of these.
BasicResize.zip
Up, down, left, right...oh dear my eyes have crossed again!
(1.2 KiB) Downloaded 229 times
Image

Post Reply

Return to “Windows”