How would I go about getting access to 'Font Picker' in LC?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
djkesler
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 27
Joined: Tue Jun 01, 2010 10:37 pm

How would I go about getting access to 'Font Picker' in LC?

Post by djkesler » Fri Jul 08, 2016 3:55 pm

I have been looking through the documentation, but I haven't found a way to access the native font picker. Is there a way to do this, or do I have to build one?

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

Re: How would I go about getting access to 'Font Picker' in

Post by Klaus » Fri Jul 08, 2016 4:00 pm

What do you mean with "the natvie font picker"?
The "Text" menu in Livecode?

djkesler
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 27
Joined: Tue Jun 01, 2010 10:37 pm

Re: How would I go about getting access to 'Font Picker' in

Post by djkesler » Fri Jul 08, 2016 4:50 pm

Sorry, I want to allow the user to select from the installed fonts. That font to be applied to a card for printing.

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

Re: How would I go about getting access to 'Font Picker' in

Post by Klaus » Fri Jul 08, 2016 4:57 pm

Hi djkesler,

create a list field and fill it with:

Code: Select all

...
## Get list of all installed fonts:
put the fontnames into tFonts

## Remove (Sytem) and other default font names, LC 8 only!
filter tFonts without "(*"

## Always looks good:
sort tFonts

## Done:
put tFonts into fld 1
...
Add this script to the list field:

Code: Select all

on mouseup
  put the selectedtext fo me into tFont
  set the textfont of XXXwhatever object or card you likeXXX to tFont
end mouseup
Pretty straighforward, isn't it? :D


Best

Klaus

djkesler
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 27
Joined: Tue Jun 01, 2010 10:37 pm

Re: How would I go about getting access to 'Font Picker' in

Post by djkesler » Fri Jul 08, 2016 5:17 pm

Thanks,

I am trying to duplicate an app that was written in .net I think. They call the native font picker, similar to the printer dialog to do this. It shows the font selections in the font itself. A nice touch, you don't have to know what the font looks like, it's right there. However, with some work, I could probably do something like that also?

I am assuming that there is no way to conjure something like that out of the os, at least not in LC<8.

Thanks for your help. It got me over the searching part to the solving part!

DK

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

Re: How would I go about getting access to 'Font Picker' in

Post by Klaus » Fri Jul 08, 2016 6:10 pm

Hi djkesler,

still pretty easy:

Code: Select all

...
## Done:
put tFonts into fld 1

## Add this:
lock screen
repeat with i = 1 to the num of lines of fld 1
  set the textfont of line i of fld 1 to (line i of fld 1)
end repeat
unlock screen
...
tested and works! :D


Best

Klaus

RogGuay
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 61
Joined: Fri Apr 28, 2006 12:10 am

Re: How would I go about getting access to 'Font Picker' in

Post by RogGuay » Thu Jul 14, 2016 4:56 am

With recent urgings from Klaus in responding to “Font Picker” questions, I decided it was time to build a new Plugin to address the difficulty of text editing and font selection in LiveCode (Especially LC 8). I’m quite happy with the result and you may find some goodness in it as well. You can download FontLab here and have your way with it as you wish:

https://www.dropbox.com/sh/y99i9f337l1q ... VGBja?dl=0

Use Ctrl-e and Ctrl-p to edit and to palette FontLab. You can also click on special characters to add them to your selectedObject /Field.

Hope you enjoy and thank you, Klaus.

Roger

Post Reply

Return to “Talking LiveCode”