View Single Post
  #10   Report Post  
Posted to microsoft.public.word.formatting.longdocs
macropod macropod is offline
external usenet poster
 
Posts: 1,002
Default How does MS Word arrange the inter word space?

Hi all,

FWIW, I posted some code recently in microsoft.public.word.printingfonts to extract the (standard) character widths for the ASCII
character set.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

"Jonathan West" wrote in message ...

"LeroyLi" wrote in message oups.com...

I agree that Word will expand the remaining space equally. Yet there
remains a problem: how dose Word determin the original spaces between
two words when there is no need to expand spaces?
I have worked on this these days, and guessed that these original
spaces is defined in the TrueType font which is the MS' default font.



Not quite. It is defined by the space character of whatever font is presently in use. So unexpanded space varies according to the
font face and size.

Now I need to read the Times New Roman font file to find the original
spaces. Oh, God! I need to find some introduction or specification to
help me. This is really a heavy work.


Not just TNR. Whichever font is in use.

You can get the width of a space relatively easily in Word. You can use the
Selection.Information(wdHorizontalPositionRelative ToPage) property to get the position of the cursor when positioned to the left
of the space, and again with the cursor positioned to the right of the space. The difference between the two values is the width
of the space in points. You will find that the space width does differ depending on which font the text is formatted with.


You could build a library of space widths for various fonts and use that rather then calculate every time. You could also get the
width of space for a large font size (e.g. 72pt) and divide down for smaller sizes of the same font.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup