<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE TIP SYSTEM "http://tcl.activestate.com/cgi-bin/tct/tip/tipxml.dtd">
<!-- Converted at Wed May 16 19:59:01 GMT 2012 -->
<!-- TIP AutoGenerator - written by Donal K. Fellows -->

<TIP number='213'>
<header><title>A Standard Dialog for Font Selection</title><author address="mailto:donal.k.fellows@man.ac.uk">Donal K. Fellows</author><author address="mailto:patthoyts@users.sourceforge.net">Pat Thoyts</author><status type='project' state='withdrawn' tclversion="8.6" vote='prior'>$Revision: 1.7 $</status><history></history><created day='21' month='aug' year='2004' /><keyword>Tk</keyword><obsoleted tip='324'/></header>
<abstract>This TIP proposes a new command that pops up a dialog box that allows the selection of a font. Where possible, this dialog will be implemented using the host platform&apos;s standard dialogs.</abstract>
<body><section title="Rationale">
<para>A number of platforms (Windows and MacOSX) have standard dialogs for common user-oriented tasks, and Tk provides an interface to these dialogs through commands such as <emph style="italic">tk_getOpenFile</emph> and <emph style="italic">tk_chooseColor</emph>. However, another dialog that they provide and which some programs would find useful is a font selector. This TIP proposes adding a command to do just that; where a platform does not provide such a standard dialog, one implemented using a Tcl script will be used instead.</para>
</section>
<section title="Proposed Change">
<para>Tk shall have a new command, <emph style="bold">tk_chooseFont</emph>, with the syntax described below (which should be recognizably similar to <emph style="bold">tk_chooseColor</emph>). The dialog will not return a result as on some platforms (MacOSX) this is required to be modeless while on others (Windows) it must be modal. Therefore all actions will be done via an <emph style="italic">-apply</emph> command. In the modal case clicking either the <emph style="italic">Apply</emph> button (if present) or the <emph style="italic">OK</emph> button will cause the <emph style="italic">-apply</emph> command to be called with the font specification appended as an additional argument. If <emph style="italic">Cancel</emph> is chosen then this is not called. For the modeless (MacOSX) case calling the <emph style="italic">tk_chooseFont</emph> command will cause the dialog to be displayed and closing the dialog will just withdraw it.</para>
<quote><emph style="bold">tk_chooseFont</emph> ?<emph style="italic">-option value -option value ...</emph>?</quote>
<para>Permitted options are:</para>
<describe><item.d name='-parent'><para>This specifies the parent window of the dialog (similarly to the <emph style="bold">-parent</emph> option to other dialogs).</para></item.d><item.d name='-title'><para>This specifies the title of the dialog. If the platform specific dialog cannot support this then the option is ignored.</para></item.d><item.d name='-initialfont'><para>This specifies the initial font in any form given on the font(n) manual page (section &quot;FONT DESCRIPTION&quot;). Provided it is supported by the platform implementation this font will be selected when the dialog is displayed.</para></item.d><item.d name='-apply'><para>This specifies a command prefix to be called when a font selection has been made by the user. The command will have the font specification appended as the final parameter and is then evaluated in the global namespace. The font specification will be a list of the form described on the font(n) manual page under &quot;FONT DESCRIPTION&quot; section 3. That is a list of {family size style ?style ...?}</para></item.d></describe>
<para>Whenever a platform provides a suitable font dialog in its own API, Tk should not use a script-based alternative, even if this means missing out on features like the title or dynamic updating of the font during the selection process.</para>
<para>User code should not expect to receive a result from <emph style="italic">tk_chooseFont</emph> and may not assume that the dialog has been withdrawn or closed when the command returns.</para>
</section>
<section title="Reference Implementation">
<para><url ref="http://sourceforge.net/support/tracker.php?aid=1477426"/></para>
</section>
<section title="Copyright">
<para>This document has been placed in the public domain.</para>
</section>
</body></TIP>

