[Python-Dev] textwrap.py

Steven Lott s_lott@yahoo.com
Fri, 7 Jun 2002 07:48:51 -0700 (PDT)


> "old enough to remember when typesetting was
> an art
>     practiced by people"

Hey wait a minute, I resemble that remark!  Briefly, I spent
some time setting cold lead type with my stubbly little fingers.
 You used an "em" space after full stops, an "en" space
otherwise.  You padded after the "em" first, then spread "thins"
around the line to get it to long enough that you could clamp it
firmly in the frame.

However, this doesn't resolve the monofont issue.  An "em" is
(usually) not twice as wide as an "en".  An "en" is the width of
the letter "n"; about in the middle of all of the widths.  An
"em", is the width of the letter "m", the widest of all letters.

Anyway.  I'm not a big fan of flags and options and settings.  
I think the text wrapper should have the "fix sentence ending"
method renamed to "find sentence ending" and the wrap() and
fill() functions could have a hook where a Strategy class can be
applied.

- One strategy class puts a single space after full stops.
- Another puts double spaces after full stops.
- A subclass of either of these could spread space around
to justify the line.
- I think that Unicode offers "em" and "en"-sized spaces; what
this does with good old fashioned Courrier 12 I have no idea; 
but someone could add this strategy if it made them happy.


=====
--
S. Lott, CCP :-{)
S_LOTT@YAHOO.COM
http://www.mindspring.com/~slott1
Buccaneer #468: KaDiMa

Macintosh user: drinking upstream from the herd.

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com