[Tutor] Re: How to read unicode strings from a binary file and display them as plain ascii?

R. Alan Monroe amonroe at columbus.rr.com
Fri Mar 4 00:10:37 CET 2005


>>>>     print type(stuff), 'stuff', stuff.encode()
>>>>This prints:
>>>>
>>>>     <type 'unicode'> stuff [NUL]C[NUL]o[NUL]p[NUL]y[NUL]r[NUL]i[NUL]g[NUL]
>> 
>> 
>>>   I don't understand what you tried to accomplish here.
>> 
>> 
>> That's evidence of what I failed to accomplish. My expected results
>> was to print the word "Copyright" and whatever other strings are
>> present in the font, with no intervening NUL characters.

>    Oh but why print type(stuff)
To make sure it really came back as <type 'unicode'>, as opposed to
<type 'str'>.

>  or 'stuff'?
Personal tradition :^)

The outcome of the project was this: Firefox would not display bold
text correctly when I selected "Futura Lt BT" as my font (it would
display a stretched version of the Light font, even though I also had
"Futura Bold BT" in my fonts folder).

After some googling, I figured out that (if I understand it right)
Windows groups plain fonts and bold fonts together based on their
internal family name, which turned out to be different between the two
fonts.

futural.ttf
Font Family name : Futura Lt BT
Font Subfamily name : Light

futurab.ttf
Font Family name : Futura Md BT
Font Subfamily name : Bold

So as best I can tell, the d*mb*asses that made Word Perfect Office
2002 (pre-loaded on my computer when I bought it) failed to give me
the entire font family.

Alan



More information about the Tutor mailing list