Page 1 of 1

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

Posted: Fri Jul 08, 2016 3:55 pm
by djkesler
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?

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

Posted: Fri Jul 08, 2016 4:00 pm
by Klaus
What do you mean with "the natvie font picker"?
The "Text" menu in Livecode?

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

Posted: Fri Jul 08, 2016 4:50 pm
by djkesler
Sorry, I want to allow the user to select from the installed fonts. That font to be applied to a card for printing.

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

Posted: Fri Jul 08, 2016 4:57 pm
by Klaus
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

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

Posted: Fri Jul 08, 2016 5:17 pm
by djkesler
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

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

Posted: Fri Jul 08, 2016 6:10 pm
by Klaus
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

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

Posted: Thu Jul 14, 2016 4:56 am
by RogGuay
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