openoffice-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Alcock <ke...@keithalcock.com>
Subject Letters change width when change position. Why?
Date Wed, 25 Feb 2015 22:48:28 GMT
APIers,

This question was put to the forum without much luck getting an
answer.  I hope that someone who knows the API might also know more
about the internal workings of OpenOffice and can explain this
phenomenon before I have to resort to source code.  Thanks.

Some information about the resolution used for
XTextViewCursor.getPosition() would help.  I can get the position of
the cursor between two letters, but what is the resolution?  Can I
measure the width any more accurately than taking the cursor position
left and right of a letter?  See below...

Keith

I have written an extension that changes the colors of each letter
in my document (for whatever reason).  They each have a different
color, or at least a color different than either of their neighbors.
For example, they can alternate between red and black.  When this runs
for lines that are "tight" (have a very small amount of extra space
before the margin), sometimes the word wrapping changes and the last
word moves to the next line.  Should this be happening?  Why?  I
happen to be working with Windows but will now try to reproduce this
on another platform.

Perhaps someone can say if this theory is true.  When there are no
color changes between letters, a "run" of letters can be displayed or
printed at once.  The operating system can do this after being told
coordinates of where to start.  I'm not sure of the granularity of the
coordinates, but it might be at the pixel.  Some of the letters within
the run might begin between pixels and use antialiasing or subpixels
to be spaced just right.  The operating system tells OpenOffice how
long the run was, possibly rounded (up?) to the nearest pixel.
OpenOffice then changes the color to red and draws the next character
starting at some rounded or quantized pixel position.  If these
rounding errors accumulate, the line of text gets longer and the last
word is forced off.  Is this what happens?  Is there any easy way to
prevent it?

---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org


Mime
View raw message