Width threshold for space detection

I'm writing this stuff pdf2htmlEX, for each distance between two consecutive letters, I need to check if there should be a space character or not. Especially for PDF files generated by LaTeX, which takes care of every single space character from the source file.

Currently I'm using [em size]/8 as the threshold, any width wider than that is considered as a space character. But I wonder if there is a 'standard' ratio, in terms of LaTeX, font design or typography.

-
I'm not sure if I understand your question a hundred percent but you should consider thin spaces, too. They are frequently used for things like "e. g.", as a thousands separator and between numbers and units. Of course there are even more types of spaces but they aren't normally supported in LaTeX en.wikipedia.org/wiki/Space_(punctuation)#Spaces_in_Unicode If your threshold is 1/8em then thin spaces will be rendered as normal spaces (1/3em usually). Why do you need this threshold anyway? Doesn't TeX produce PDFs whose text you can just extract as such? – Christian Sep 23 '12 at 14:12
Thanks for your reply. In the PDFs generated by LaTeX, all 'space characters' are gone, but offsets are still there. When you see 'hello world' in a PDF, it might be two separated positioned words. Now I want to extract the text, fill in some spaces to make the sentences meaningful. – Lu Wang Sep 26 '12 at 18:55
Interesting, I didn't know TeX would do that. How come I can still copy and paste text from my PDF viewer? How does it solve the problem? Maybe you can let yourself be inspired by these existing solutions? – Christian Sep 29 '12 at 8:49
See also: tex.stackexchange.com/q/28066/627 – Lev Bishop Oct 8 '12 at 7:17

The space parameters are given by \fontdimen2 through \fontdimen4. For the default cmr10 these correspond to a space of 3.33pt plus 1.67pt minus 1.11pt. Computer modern has a fairly large interword space, most others will be smaller. Eg, MinionPro: 2.27pt plus 1.135pt minus 0.757pt.

An overfull hbox will result when the badness of a line is worse than \tolerance, which by default is 200. Badness is defined as 100 times the cube of the glue shrink ratio, so the smallest interword space which would not cause an overfull hbox, with the default settings for all the parameters, is 1.933pt for cmr10, and 1.316pt for MinionPro.

\documentclass[10pt]{article}
%\usepackage{MinionPro}
\begin{document}
Interword space: \the\fontdimen2\font\
plus \the\fontdimen3\font\ minus \the\fontdimen4\font

tolerance: \the\tolerance

Minimum space (assuming tolerance of 200): \the\dimexpr\fontdimen2\font-
1.25992\fontdimen4\font\relax % cube root of (200/100) is 1.25992
\end{document}

-