Login  Register

FreeType fonts and underline/strikethrough emphasis

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

FreeType fonts and underline/strikethrough emphasis

Nicolai Hess
Some questions:
- Did this ever work  ?
- We have some code for drawing the underline/strikethrough, but it is only used
for tree and listrenderer (and AFAIK only checks the first text entry element for the used emphasis)
- setting the emphasis on LogicalFont is only propagated to the realfont if emphasis is
  bold or italic, others like underline and strikethrough are ignored with the comment:
"we only handle bold and italic here since underline/strikeout are drawn separately"

I don't want to move this display underline/strikethrough code into LogicalFont if it was
removed on purpose.

other ideas how to handle this?

(see issue
No "underline" or "stroke out" emphasis on FT fonts)


nicolai
 
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: FreeType fonts and underline/strikethrough emphasis

Nicolai Hess


2015-05-04 22:51 GMT+02:00 Nicolai Hess <[hidden email]>:
Some questions:
- Did this ever work  ?
- We have some code for drawing the underline/strikethrough, but it is only used
for tree and listrenderer (and AFAIK only checks the first text entry element for the used emphasis)
- setting the emphasis on LogicalFont is only propagated to the realfont if emphasis is
  bold or italic, others like underline and strikethrough are ignored with the comment:
"we only handle bold and italic here since underline/strikeout are drawn separately"

I don't want to move this display underline/strikethrough code into LogicalFont if it was
removed on purpose.

other ideas how to handle this?

(see issue
No "underline" or "stroke out" emphasis on FT fonts)


I think this worked in pharo 1 and pharo 2. Now I have to find out why it does not
work anymore.

 

nicolai
 

Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: FreeType fonts and underline/strikethrough emphasis

Sean P. DeNigris
Administrator
Nicolai Hess wrote
I think this worked in pharo 1 and pharo 2. Now I have to find out why it
does not work anymore.
Off the top of my head, I remember having a problem when the font I requested didn't exist. I would get a fallback font without any of the emphases I requested. HTH.
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: FreeType fonts and underline/strikethrough emphasis

Nicolai Hess

Thanks for the feedback, Sean.
Meanwhile, I think I found the reason. I think it got lost during the merge of Display- and MultiDisplayScanner. I upload a fix, ready for review.

Nicolai

Am 15.05.2015 5:21 nachm. schrieb "Sean P. DeNigris" <[hidden email]>:
Nicolai Hess wrote
> I think this worked in pharo 1 and pharo 2. Now I have to find out why it
> does not work anymore.

Off the top of my head, I remember having a problem when the font I
requested didn't exist. I would get a fallback font without any of the
emphases I requested. HTH.



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/FreeType-fonts-and-underline-strikethrough-emphasis-tp4824414p4826525.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: FreeType fonts and underline/strikethrough emphasis

Nicolai Hess


2015-05-15 18:10 GMT+02:00 Nicolai Hess <[hidden email]>:

Thanks for the feedback, Sean.
Meanwhile, I think I found the reason. I think it got lost during the merge of Display- and MultiDisplayScanner. I upload a fix, ready for review.


Athens TextMorph drawing does not support this yet. And I think there is now support for this in TxText.

Anyone knows how about Rubric? I saw some examples with texdecorations, but I don't see how they are used from
within an editor.




 

Nicolai

Am 15.05.2015 5:21 nachm. schrieb "Sean P. DeNigris" <[hidden email]>:
Nicolai Hess wrote
> I think this worked in pharo 1 and pharo 2. Now I have to find out why it
> does not work anymore.

Off the top of my head, I remember having a problem when the font I
requested didn't exist. I would get a fallback font without any of the
emphases I requested. HTH.



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/FreeType-fonts-and-underline-strikethrough-emphasis-tp4824414p4826525.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: FreeType fonts and underline/strikethrough emphasis

Pharo Smalltalk Developers mailing list
Hello Nicolai,

I’ve pushed your fixe into Rubric.
It works as expected.
thanks a lot!.

Cheers
Alain

--------------------

| font1 font2 tMorph |
    font1 := TextFontReference toFont: (StrikeFont familyName: 'Bitmap DejaVu Sans' size: 11).
    font2 := TextFontReference toFont: (LogicalFont familyName: 'Source Sans Pro' pointSize: 10).
    {font1.
    font2}
        do: [ :f | 
            | t1 t2 t3 t4 t5 t6 |
            tMorph := RubEditingArea new.
            t1 := 'normal\' withCRs asText addAttribute: f.
            t2 := 'bold\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis bold.
            t3 := 'underline\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis underlined.
            t4 := 'struck out\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis struckOut.
            t5 := 'italic\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis italic.
            t6 := 'narrow\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis narrow.
            tMorph updateTextWith: t1 , t2 , t3 , t4 , t5 , t6.
            tMorph openInWorld ]

------------



On 15 May 2015, at 22:33, Nicolai Hess <[hidden email]> wrote:



2015-05-15 18:10 GMT+02:00 Nicolai Hess <[hidden email]>:

Thanks for the feedback, Sean.
Meanwhile, I think I found the reason. I think it got lost during the merge of Display- and MultiDisplayScanner. I upload a fix, ready for review.


Athens TextMorph drawing does not support this yet. And I think there is now support for this in TxText.

Anyone knows how about Rubric? I saw some examples with texdecorations, but I don't see how they are used from
within an editor.




 

Nicolai

Am 15.05.2015 5:21 nachm. schrieb "Sean P. DeNigris" <[hidden email]>:
Nicolai Hess wrote
> I think this worked in pharo 1 and pharo 2. Now I have to find out why it
> does not work anymore.

Off the top of my head, I remember having a problem when the font I
requested didn't exist. I would get a fallback font without any of the
emphases I requested. HTH.



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/FreeType-fonts-and-underline-strikethrough-emphasis-tp4824414p4826525.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.



Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: FreeType fonts and underline/strikethrough emphasis

Nicolai Hess
In reply to this post by Nicolai Hess


2015-05-16 0:43 GMT+02:00 Alain Plantec <[hidden email]>:
Hello Nicolai,

I’ve pushed your fixe into Rubric.
It works as expected.
thanks a lot!.


 Where ? What ?

I did not fix rubric. :)

My fix was for the BitBltDisplayScanner.

Or do you mean this example.

It is interesting, does it mean rubric was always able to render underline and strokeouts?

 
Cheers
Alain

--------------------

| font1 font2 tMorph |
    font1 := TextFontReference toFont: (StrikeFont familyName: 'Bitmap DejaVu Sans' size: 11).
    font2 := TextFontReference toFont: (LogicalFont familyName: 'Source Sans Pro' pointSize: 10).
    {font1.
    font2}
        do: [ :f | 
            | t1 t2 t3 t4 t5 t6 |
            tMorph := RubEditingArea new.
            t1 := 'normal\' withCRs asText addAttribute: f.
            t2 := 'bold\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis bold.
            t3 := 'underline\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis underlined.
            t4 := 'struck out\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis struckOut.
            t5 := 'italic\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis italic.
            t6 := 'narrow\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis narrow.
            tMorph updateTextWith: t1 , t2 , t3 , t4 , t5 , t6.
            tMorph openInWorld ]

------------



On 15 May 2015, at 22:33, Nicolai Hess <[hidden email]> wrote:



2015-05-15 18:10 GMT+02:00 Nicolai Hess <[hidden email]>:

Thanks for the feedback, Sean.
Meanwhile, I think I found the reason. I think it got lost during the merge of Display- and MultiDisplayScanner. I upload a fix, ready for review.


Athens TextMorph drawing does not support this yet. And I think there is now support for this in TxText.

Anyone knows how about Rubric? I saw some examples with texdecorations, but I don't see how they are used from
within an editor.




 

Nicolai

Am 15.05.2015 5:21 nachm. schrieb "Sean P. DeNigris" <[hidden email]>:
Nicolai Hess wrote
> I think this worked in pharo 1 and pharo 2. Now I have to find out why it
> does not work anymore.

Off the top of my head, I remember having a problem when the font I
requested didn't exist. I would get a fallback font without any of the
emphases I requested. HTH.



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/FreeType-fonts-and-underline-strikethrough-emphasis-tp4824414p4826525.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.




Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: FreeType fonts and underline/strikethrough emphasis

Pharo Smalltalk Developers mailing list
ah, :))
I guess I’ve tried your fix locally by changing RubCharacterScanner>>displayString: from: to: at:
but without checking your test before the change.
it was working so my conclusion was that your fix was successful.
But in fact, your are right, Rubric renders underline and strokeouts as expected without changing
RubCharacterScanner>>displayString: from: to: at:

Alain



On 16 May 2015, at 12:47, Nicolai Hess <[hidden email]> wrote:



2015-05-16 0:43 GMT+02:00 Alain Plantec <[hidden email]>:
Hello Nicolai,

I’ve pushed your fixe into Rubric.
It works as expected.
thanks a lot!.


 Where ? What ?

I did not fix rubric. :)

My fix was for the BitBltDisplayScanner.

Or do you mean this example.

It is interesting, does it mean rubric was always able to render underline and strokeouts?

 
Cheers
Alain

--------------------

| font1 font2 tMorph |
    font1 := TextFontReference toFont: (StrikeFont familyName: 'Bitmap DejaVu Sans' size: 11).
    font2 := TextFontReference toFont: (LogicalFont familyName: 'Source Sans Pro' pointSize: 10).
    {font1.
    font2}
        do: [ :f | 
            | t1 t2 t3 t4 t5 t6 |
            tMorph := RubEditingArea new.
            t1 := 'normal\' withCRs asText addAttribute: f.
            t2 := 'bold\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis bold.
            t3 := 'underline\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis underlined.
            t4 := 'struck out\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis struckOut.
            t5 := 'italic\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis italic.
            t6 := 'narrow\' withCRs asText
                addAttribute: f;
                addAttribute: TextEmphasis narrow.
            tMorph updateTextWith: t1 , t2 , t3 , t4 , t5 , t6.
            tMorph openInWorld ]

------------

<Screen Shot 2015-05-16 at 00.37.59.png>


On 15 May 2015, at 22:33, Nicolai Hess <[hidden email]> wrote:



2015-05-15 18:10 GMT+02:00 Nicolai Hess <[hidden email]>:

Thanks for the feedback, Sean.
Meanwhile, I think I found the reason. I think it got lost during the merge of Display- and MultiDisplayScanner. I upload a fix, ready for review.


Athens TextMorph drawing does not support this yet. And I think there is now support for this in TxText.

Anyone knows how about Rubric? I saw some examples with texdecorations, but I don't see how they are used from
within an editor.




 

Nicolai

Am 15.05.2015 5:21 nachm. schrieb "Sean P. DeNigris" <[hidden email]>:
Nicolai Hess wrote
> I think this worked in pharo 1 and pharo 2. Now I have to find out why it
> does not work anymore.

Off the top of my head, I remember having a problem when the font I
requested didn't exist. I would get a fallback font without any of the
emphases I requested. HTH.



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/FreeType-fonts-and-underline-strikethrough-emphasis-tp4824414p4826525.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.





Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: FreeType fonts and underline/strikethrough emphasis

Nicolai Hess
In reply to this post by Nicolai Hess


2015-05-15 18:10 GMT+02:00 Nicolai Hess <[hidden email]>:

Thanks for the feedback, Sean.
Meanwhile, I think I found the reason. I think it got lost during the merge of Display- and MultiDisplayScanner. I upload a fix, ready for review.


OK this is fixed now for Text and TextMorphs, but it still does not work for String/LabelMorphs.

Anyone knows why we can set only bold and/or italic emphasis on a LogicalFont?

StringMorph new contents:'hello';emphasis:1;openInHand. -> bold text
StringMorph new contents:'hello';emphasis:8;openInHand. -> no change, it should be underlined

This is different if the default font is a StrikeFont

StringMorph new contents:'hello';emphasis:1;openInHand. -> bold text.
StringMorph new contents:'hello';emphasis:8;openInHand. -> underlined.



I found the place in LogicalFont, where other emphasis' are filtered out, but I don't understand why.


nicolai
 

Nicolai

Am 15.05.2015 5:21 nachm. schrieb "Sean P. DeNigris" <[hidden email]>:
Nicolai Hess wrote
> I think this worked in pharo 1 and pharo 2. Now I have to find out why it
> does not work anymore.

Off the top of my head, I remember having a problem when the font I
requested didn't exist. I would get a fallback font without any of the
emphases I requested. HTH.



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/FreeType-fonts-and-underline-strikethrough-emphasis-tp4824414p4826525.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.