[Cuis-dev] [ChangeSet] TextParagraphMorph

Juan Vuletich juan at jvuletich.org
Tue Nov 30 10:51:02 PST 2021


On 11/30/2021 3:34 PM, Hilaire Fernandes via Cuis-dev wrote:
>
> Ok. I check your cs, so we can now simplify again drawOn: by 
> inheriting the behavior.
>
> Here is the changeset.
>
> Thanks
>
> Hilaire
>
> Le 30/11/2021 à 18:32, Juan Vuletich via Cuis-dev a écrit :
>>
>> Thanks. I tweaked your code to also avoid the last line if it can't 
>> be shown complete. Now at GitHub.
> -- 
> GNU Dr. Geo
> http://drgeo.eu
> http://blog.drgeo.eu

The first version I tried did that, and also avoided the last line even 
if just the white space below the glyphs was at risk. But when resizing 
the example, it looked like it was removing the last line "too early", 
when it could still be displayed perfectly.

The version I pushed only avoids the last line only if the baseline (the 
bottom of regular glyphs) would lie outside bounds. This means that 
occasionally glyph descenders could go outside bounds. That's why I kept 
the "border over text" code. Anyway, the difference is minimal, and the 
inherited version would also be ok.

You might want to play a bit with the alternatives. In 
#textComposition:bounds:color:selectionColor:avoidOverhang: you can 
alternate between
             (strict not or: [ line top + line baseline < 
possibleVisibleLocalRect bottom ]) ifTrue: [
and
             (strict not or: [ line bottom < possibleVisibleLocalRect 
bottom ]) ifTrue: [

These deails are easily visible if you set a TT font and zoom the 
TextParagraphMorph.

Cheers,

-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20211130/23d4b866/attachment.htm>


More information about the Cuis-dev mailing list