Page 1 of 1

Interesting backgroundcolor anomaly in text

Posted: Mon Sep 23, 2019 8:35 pm
by kaveh1000
Hi folks

I have just noticed something interesting. Please see the attached screenshot of two paragraphs in a field. The top para has had backgroundcolor to a number of characters, e.g.

Code: Select all

set the backgroundcolor of char x to y of fld 1 to pink
The lower para (actually a long line) has the following applies:

Code: Select all

set the backgroundcolor of line x of fld 1 to pink
so the whole para (or line) is colored.

Apart from the visual difference in that the background is not solid in the top para, I notice that in the second para when I select, the selection color (yellow) shows on top of the background color, but in the top case it does not.

I would be grateful for any insights as to the mechanism. is there a way to set bg color to a set of chars and still show selection color?

Re: Interesting backgroundcolor anomaly in text

Posted: Tue Sep 24, 2019 12:51 am
by dunbarx
Did a test, and set the textHeight much larger that the textSoze. Also "fixed" the lineHeight.

So it seems that if you specify "lines" when delineating text, setting the backColor also fills in the spaces between those lines. Whereas if you specify characters, only the textSize's worth of vertical space is colored in each line.

This can be seen as a feature, I suppose.

Craig

Re: Interesting backgroundcolor anomaly in text

Posted: Tue Sep 24, 2019 2:30 am
by FourthWorld
I think Craig nailed it. The char form used the older rendering method, while the line form uses the new paragraph-level features that apparently span the full block.

Whether the older form should be extended a few pixels vertically is an open question, but in short, very different rendering algos are in play here.

Re: Interesting backgroundcolor anomaly in text

Posted: Tue Sep 24, 2019 4:41 am
by dunbarx
This is why Richard is Richard.

Craig

Re: Interesting backgroundcolor anomaly in text

Posted: Tue Sep 24, 2019 7:59 am
by kaveh1000
Yes, a mine of information, and of course there is only one Craig. ;-)

Thanks for this. So this gives us the possibility of using the "newer" mechanism in combination with the old one. In screenshot I have set the bgcolor for the whole field, then bgcolor for line 3 (par 2), then word based coloring on top.

The only disadvantage with the the char or word based coloring is that the selection color does not show on top of the color...

Re: Interesting backgroundcolor anomaly in text

Posted: Tue Sep 24, 2019 8:38 am
by richmond62
Sorry. late to the party. :D

BUT . . . I wonder if the 'problem' doesn't come down to the fact that,
in the original example, the 2 chunks of text are selected in different ways
(1: a range of chars, 2. text in a line):
-
Screenshot_20190924_103237.png
-
Screenshot taken on KDE Plasma
-
My stack sticks with method #1 for both chunks . . .
-
Stack removed as updated version below.

Re: Interesting backgroundcolor anomaly in text

Posted: Tue Sep 24, 2019 8:52 am
by kaveh1000
Sorry, no latecomers. ;-)

Thanks for the demo stack Richmond. Yes, you are using method 1 and as Richard says method 2 uses a different mechanism. You will see that in method 1 selecting the text does not hide the backgroundcolor, and that is the problem in my case. i want the yellow to be on top of the red, as it is in the "new" method. But I am guessing that is deep inside the engine.

Re: Interesting backgroundcolor anomaly in text

Posted: Tue Sep 24, 2019 9:54 am
by richmond62
Um . . . (not knowing when to let something alone) . . .

backGroundColor

selectedText


what about foreGroundColor?
-
Screenshot_20190924_115123.png
-

Re: Interesting backgroundcolor anomaly in text

Posted: Tue Sep 24, 2019 10:03 am
by kaveh1000
yes, we can use foregroundcolor to color the text itself, but I want to have the behaviour of text selection in method 1 that is identical to that in method 2, with yellow in front of the red. To be honest not a huge deal...