<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- splitted from ./en/functions/ps.xml, last change in rev 1.12 -->
<refentry xml:id="function.ps-hyphenate" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>ps_hyphenate</refname>
  <refpurpose>Hyphenates a word</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type class="union"><type>array</type><type>false</type></type><methodname>ps_hyphenate</methodname>
   <methodparam><type>resource</type><parameter>psdoc</parameter></methodparam>
   <methodparam><type>string</type><parameter>text</parameter></methodparam>
  </methodsynopsis>
  <para>
   Hyphenates the passed word. <function>ps_hyphenate</function> evaluates the
   value hyphenminchars (set by <function>ps_set_value</function>) and
   the parameter hyphendict (set by <function>ps_set_parameter</function>).
   hyphendict must be set before calling this function.
  </para>
  <para>
   This function requires the locale category LC_CTYPE to be set properly.
   This is done when the extension is initialized by using the environment
   variables. On Unix systems read the man page of locale for more information.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>psdoc</parameter></term>
     <listitem>
      <para>
       Resource identifier of the postscript file
       as returned by <function>ps_new</function>.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>text</parameter></term>
     <listitem>
      <para>
       <parameter>text</parameter> should not contain any non alpha
       characters. Possible positions for breaks are returned in an array of
       interger numbers. Each number is the position of the char in 
       <parameter>text</parameter> after which a hyphenation can take place.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   An array of integers indicating the position of possible breaks in
   the text &return.falseforfailure;.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Hyphennate a text</title>
    <programlisting role="php">
<![CDATA[
<?php
$word = "Koordinatensystem";
$psdoc = ps_new();
ps_set_parameter($psdoc, "hyphendict", "hyph_de.dic");
$hyphens = ps_hyphenate($psdoc, $word);
for($i=0; $i<strlen($word); $i++) {
  echo $word[$i];
  if(in_array($i, $hyphens))
    echo "-";
}
ps_delete($psdoc);
?>
]]>
    </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
Ko-ordi-na-ten-sys-tem
]]>
    </screen>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <!-- <member><function>ps_boot</function></member> -->
    <member><function>ps_show_boxed</function></member>
    <member>locale(1)</member>
   </simplelist>
  </para>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

