Difference between revisions of "User:Joekidd/OpenOffice.org/Internship/PDFImport/Tasks/Improving char spaces"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Suggested solution)
(Example)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Category:Marketing]][[Category:Development]][[Category:Education]]
 +
{{DISPLAYTITLE:Improving char spaces}}
 +
 
Current way of importing text has some problems with spaces between chars - they are counted in the way that not always works correctly. Sometimes there are spaces in places we don't expect and other time there don't occur in places they should be.
 
Current way of importing text has some problems with spaces between chars - they are counted in the way that not always works correctly. Sometimes there are spaces in places we don't expect and other time there don't occur in places they should be.
  
 
== Solution ==
 
== Solution ==
  
The code before modification was quite complicated and I still do not understand what was the author's intention. I made it easier and there is no more spaces in places they are not expected but it still fails sometimes. So I would like to go a bit deeper in it to make it working every time. Problem is quite complex and depends on kind of used pdf fonts. Moreover I do not except reaching back to the solution I replaced, cose spaces were add more often in there, but at least lines were divided correctly: I mean if there is a big gap beetwen two text elements in one line, there should be two lines of text in the same line of document. If such a condition will not be met there will be also problem with proper paragraph import.
+
The code before modification was quite complicated and I still do not understand what was the author's intention. I made it easier and I think that counting avarage space value should be enough to determine if to add space or not. Moreover that value should be scaled with some real value between [0, 1]. I estimated that the value 0.6 is the most appropriate.
 +
 
 +
== Example ==
 +
 
 +
Here is an example of imported pfd file and spaces:
 +
 
 +
[[File:Spacesexample.png]]

Latest revision as of 16:26, 23 September 2010


Current way of importing text has some problems with spaces between chars - they are counted in the way that not always works correctly. Sometimes there are spaces in places we don't expect and other time there don't occur in places they should be.

Solution

The code before modification was quite complicated and I still do not understand what was the author's intention. I made it easier and I think that counting avarage space value should be enough to determine if to add space or not. Moreover that value should be scaled with some real value between [0, 1]. I estimated that the value 0.6 is the most appropriate.

Example

Here is an example of imported pfd file and spaces:

Spacesexample.png

Personal tools