[Solved] Changing the color of a letter changes its width?

Writing a book, Automating Document Production - Discuss your special needs here

[Solved] Changing the color of a letter changes its width?

Postby kwalcock » Fri Feb 20, 2015 11:34 pm

Forum,

For some undisclosed reason I need to change the colors of each letter in my document. They will 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 I do this 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?

Thanks
Last edited by Hagar Delest on Thu Mar 05, 2015 11:25 pm, edited 1 time in total.
Reason: tagged [Solved].
Apache OpenOffice 4.0.1
Windows, Linux, MacOS
kwalcock
 
Posts: 24
Joined: Thu Oct 09, 2014 11:54 am

Re: Why does changing the color of a letter change its width

Postby RoryOF » Fri Feb 20, 2015 11:42 pm

I can't answer about why it may happen, but to undo it, you could select the text and /Format /Character : Position tab and change the inter character tracking (Spacing: condensed - try 0.1 or 0.2) so that the line breaks in what was the correct place.
Apache OpenOffice 4.1.6 on Xubuntu 18.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 28781
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Why does changing the color of a letter change its width

Postby RusselB » Sat Feb 21, 2015 12:21 am

One option that occurs to me is to use a fixed width font, rather than a variable width font.
Variable width fonts use the amount of room required for each character, with some characters requiring less space than others. Eg: the letter i requires less space than the letter m.
With a fixed width font, all characters, irrelevant as to which character, occupies the same amount of space.
Variable width fonts are nice in that you can get the maximum number of characters on a single line, but fixed width fonts are nice if you need to ensure that your line returns always are at the same number of characters.
OpenOffice 4.1.6 and LibreOffice 6.0.6.2 on Windows 7 Pro & Ultimate
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
RusselB
Volunteer
 
Posts: 5018
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: Why does changing the color of a letter change its width

Postby kwalcock » Sat Feb 21, 2015 11:38 pm

RusselB wrote:One option that occurs to me is to use a fixed width font, rather than a variable width font.
Variable width fonts use the amount of room required for each character, with some characters requiring less space than others. Eg: the letter i requires less space than the letter m.
With a fixed width font, all characters, irrelevant as to which character, occupies the same amount of space.
Variable width fonts are nice in that you can get the maximum number of characters on a single line, but fixed width fonts are nice if you need to ensure that your line returns always are at the same number of characters.


I was surprised to find that at least one fixed font does not have the same problem. Perhaps my theory is incorrect. Unfortunately, I cannot change the font. Thanks for the information, though.
Apache OpenOffice 4.0.1
Windows, Linux, MacOS
kwalcock
 
Posts: 24
Joined: Thu Oct 09, 2014 11:54 am

Re: Why does changing the color of a letter change its width

Postby acknak » Sun Feb 22, 2015 12:00 am

With a quick test, I don't see any difference for default text, all-colored text, and some letters colored and some not.

I did notice a glitch where the are ligatures in the text, for example, where the letters T and h appear together, OO (or the font) may combine them into one character. When you select one character of the pair and apply some different formatting, then the ligature has to be broken apart and the text will be wider.

Also, in some situations, the editing view is not entirely accurate. You may find different results when using File > Page Preview, possibly at higher scaling, or even when printed or exported to pdf.
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
 
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Why does changing the color of a letter change its width

Postby kwalcock » Sun Feb 22, 2015 12:36 am

I see the same effect using the Linux version. If instead of changing the foreground color of the letters I use the background color, the problem still appears. It seems like the type of font should be unrelated to this. For Courier the effect is more subtle, but has been detected in the meantime. For some letters in some positions, changing the color will make the letter itself or letters after it wiggle. I haven't been able to get a word thrown off the end of a line with the fixed font this way, but wiggle is not good, either.

To test this I took an already tight line and expanded the first character to 1% below what it would take to force the last word off the line. Then I changed the color of every other letter in the line until the word was bumped off.
Apache OpenOffice 4.0.1
Windows, Linux, MacOS
kwalcock
 
Posts: 24
Joined: Thu Oct 09, 2014 11:54 am

Re: Why does changing the color of a letter change its width

Postby kwalcock » Thu Mar 05, 2015 3:13 pm

In the end I made sure that every letter had different characteristics so that it would be printed in a separate "run" before I did any coloring. I could then recolor them without them changing width and moving around.
Apache OpenOffice 4.0.1
Windows, Linux, MacOS
kwalcock
 
Posts: 24
Joined: Thu Oct 09, 2014 11:54 am


Return to Advanced Uses

Who is online

Users browsing this forum: No registered users and 2 guests