[squeak-dev] Weird text composition when tab happens at large destX

Marcel Taeumel marcel.taeumel at hpi.de
Thu May 16 07:36:51 UTC 2019


Hi Nicolas,

I think it is related to the DefaultTabsArray in TextStyle, which does only specify [tab] positions up to 720 px. Thus, it is also related to the font (size) you are currently using. The mechanism in TextStyle >> #nextTabFrom:... has an upper bound and works on (unscaled) pixels. 

We might want to ...
1) use RealEstateAgent class >> #scaleFactor as a workaround
2) Increase DefaultTabs beyond 720 px.


Best,
Marcel
Am 15.05.2019 21:36:53 schrieb Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
Hi,
the (attached) text composition bugs me:
When a tab occurs after some column, the composition creates a new line, even when there is room for more text...
I tried to create a test case in CharacterScannerTest

testCrossedXWithManyTabs
| p text chunkWidth expectedChunkStartX expectedWidth |
text := (String new: 59 streamContents: [:str | (String new: 14 withAll: $m) do: [:m | 5 timesRepeat: [str nextPut: m]] separatedBy: [str tab]]) asText.
chunkWidth := 5*mWidth.
expectedChunkStartX := Array new: 14 streamContents:
[:str |
(1 to: 14) inject: 1 into:
[:destX :rank |
str nextPut: destX.
(style nextTabXFrom: destX + chunkWidth leftMargin: 0 rightMargin: 0)]].
expectedWidth := expectedChunkStartX last + chunkWidth.
p := NewParagraph new.
p
compose: text
style: style
from: 1
in: (0 @ 0 corner: expectedWidth+10 @ (style lineGrid * 2)).
self assert: p lines size = 1 description: 'There is enough composition width for this text'.

but the test pass (it composes in single line). Any idea where to look at?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190516/f393923f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 96320 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190516/f393923f/attachment-0001.png>


More information about the Squeak-dev mailing list