note 24671 added to function.wordwrap
| From: | php-general at lists dot php dot net | Date: | Sun, 25 Aug 2002 04:40:45 +0000 |
| Subject: | note 24671 added to function.wordwrap | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-35567@lists.php.net to get a copy of this message | ||
Instead of using a space or a newline or <br /> as the line break separator, you may consider
inserting "Soft Hyphens" within the middle of long words, allowing elegant word breaking
that can use the effective browser layout that is dependant of the effective font that the browser
will use.
The "Soft Hyphen" (SHY) character is part of the STANDARD ISO-8859-1 character set: it
won't be displayed (i.e. it will have width 0) if the two parts of a word can be displayed by
the browser along on the same layout row. However it allows the browser to find a break in the
middle of long words: in that case, it will display the first part of the word before the "Soft
Hyphen", and a true Hyphen ("-") on the first layout row (if they both fit on that
row), and the next part after the "Soft Hyphen" on the following layout row.
Ideally, each word should contain at least one "Soft Hyphen" between each syllable of a
word, unless this would place a "Soft Hyphen" with less than 3 characters from the
beginning or end of the word. So "Soft Hyphens" must not be inserted within words with 1
to 5 characters.
The Soft Hyphen is only appropriate within textual words using Latin, Greek, Cyrillic characters).
For Semitic languages that use right to left scripts, the "Soft Hyphen" should be replaced
by a "Soft Line Break" (also called "Zero Width Non Joiner" in Unicode).
This "Soft Line Break" always has a null display width (i.e. it is never displayed),
except that it allows inserting a line break.
Some characters are already implicitly considered followed by a "Soft Line Break" in
browsers: the explicit hyphen within composed words (like "week-end"), and all
punctuations (with the exception of the dot, and opening punctuations like "({[" which are
instead _preceded_ by an implicit "Soft Line Break").
Note also that some new browsers can insert themselves "Soft Hyphens" or "Soft Line
Breaks" within long words, if the HTML page explicitly specifies the language, and the words
are restricted to the natural characters of that language, using hyphenation rules and/or
dictionnaries defined for that language.
Currently, the HTML standard offers no way to specify a set of hyphenation rules along with the page
(so that it would work in absence of a known dictionnary for that language), so soft hyphens or line
breaks should be placed in the content.
--
http://www.php.net/manual/en/function.wordwrap.php
http://master.php.net/manage/user-notes.php?action=edit+24671
http://master.php.net/manage/user-notes.php?action=delete+24671
http://master.php.net/manage/user-notes.php?action=reject+24671