Obtaining of list of all installed fontsHi - there exists a dialog box to facilitate the selection of a font name, style and size in JMP, which can be accessed when you customize the labels of a chart, for example. It supplies a list of all the fonts installed in Windows, and shows you what each one looks like when you click on it.
I want to use a dialog very much like that in some JSL script I'm working on at the moment. Can anyone tell me where I can find the script used to create the one supplied within JMP, please? Alternatively, can anyone tell me how to access a list of all the fonts installed on my PC using JSL? If I can do that, building the necessary dialog box from scratch would be a simple task.
Many thanks
Re: Obtaining of list of all installed fontsThis will work in Windows.
<SPAN class="token function">Names Default To Here</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token number">1</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
fonts<SPAN class="token operator">=</SPAN><SPAN class="token punctuation">{</SPAN><SPAN class="token punctuation">}</SPAN><SPAN class="token punctuation">;</SPAN>
flist<SPAN class="token operator">=</SPAN><SPAN class="token punctuation">{</SPAN><SPAN class="token punctuation">}</SPAN><SPAN class="token punctuation">;</SPAN>
flist<SPAN class="token operator">=</SPAN><SPAN class="token function">Files In Directory</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token string">"c:\Windows\Fonts"</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token function">for</SPAN><SPAN class="token punctuation">(</SPAN>i<SPAN class="token operator">=</SPAN><SPAN class="token number">1</SPAN><SPAN class="token punctuation">,</SPAN> i<SPAN class="token operator"><=</SPAN><SPAN class="token function">nitems</SPAN><SPAN class="token punctuation">(</SPAN>flist<SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> i<SPAN class="token operator">++</SPAN><SPAN class="token punctuation">,</SPAN>
<SPAN class="token function">if</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token function">lowercase</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token function">item</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token number">2</SPAN><SPAN class="token punctuation">,</SPAN> flist<SPAN class="token punctuation">[</SPAN>i<SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"."</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token operator">==</SPAN><SPAN class="token string">"fon"</SPAN><SPAN class="token operator">|</SPAN>
<SPAN class="token function">lowercase</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token function">item</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token number">2</SPAN><SPAN class="token punctuation">,</SPAN> flist<SPAN class="token punctuation">[</SPAN>i<SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"."</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token operator">==</SPAN><SPAN class="token string">"ttf"</SPAN>
<SPAN class="token punctuation">,</SPAN><SPAN class="token function">insert into</SPAN><SPAN class="token punctuation">(</SPAN>fonts<SPAN class="token punctuation">,</SPAN><SPAN class="token function">item</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token number">1</SPAN><SPAN class="token punctuation">,</SPAN> flist<SPAN class="token punctuation">[</SPAN>i<SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"."</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">)</SPAN>
<SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;<BR /><SPAN class="token function">show</SPAN>(fonts);<BR /></SPAN>
Re: Obtaining of list of all installed fontsThe last 20% is determining the font name from the file name. (Not sure how to do that.)
https://superuser.com/questions/760627/how-to-list-installed-font-families has a discussion too.
Re: Obtaining of list of all installed fontsJMP just has access to the fonts that are installed.
In Windows, I think the fonts are in c:\Windows\Fonts
I suppose you could just get the files names in that directory and you'd be 80% there.