Here is another follow-up, which keeps the original font information
with the ISO14755 popup.

I am attaching the diff for all 3 patches.

```
commit 2892adc3 (HEAD -> display-wide-glyphs)
Author: Daniel Hahler <[email protected]>
Date:   Sat Dec 23 20:12:46 2017 +0100

    squash! overlay: set font only once
    
    rxvt_term::iso14755_51: keep font from original rent_t
    rxvt_term::scr_overlay_set: only set/find font if not present in rend_t

diff --git a/src/command.C b/src/command.C
index 340915fb..e2e9f0f9 100644
--- a/src/command.C
+++ b/src/command.C
@@ -220,7 +220,8 @@ rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int 
y, int y2)
 
   scr_overlay_set (0, 0, rowcol);
 
-  r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));
+  r = SET_FONT (OVERLAY_RSTYLE, GET_FONT(r));
+  r = SET_STYLE (r, GET_STYLE (r));
 
   for (int y = 0; y < len; y++)
     {
diff --git a/src/screen.C b/src/screen.C
index dd07ae7b..e7038767 100644
--- a/src/screen.C
+++ b/src/screen.C
@@ -3668,7 +3668,9 @@ rxvt_term::scr_overlay_set (int x, int y, text_t text, 
rend_t rend) NOT
   x++, y++;
 
   ov.text[y][x] = text;
-  ov.rend[y][x] = SET_FONT (rend, FONTSET (rend)->find_font (text));
+  ov.rend[y][x] = rend;
+  if (!GET_FONT(rend))
+    ov.rend[y][x] = SET_FONT (rend, FONTSET (rend)->find_font (text));
 }
 
 void
```

On 22.12.2017 04:41, Daniel Hahler wrote:
> The same makes sense for the overlay used in the Perl bindings (e.g. for
> scrollback search):
> 
> ```diff
> diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
> index 3144b951..6abdaca8 100644
> --- a/src/rxvtperl.xs
> +++ b/src/rxvtperl.xs
> @@ -227,16 +227,17 @@ overlay::overlay (rxvt_term *THIS, int x_, int y_, int 
> w_, int h_, rend_t rstyle
>              t0 = 0x255a, t1 = 0x2550, t2 = 0x255d;
>  
>            *tp++ = t0;
> -          *rp++ = r;
> +          *rp++ = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font 
> (t0));
>  
> +          rend_t r_t1 = SET_FONT (r, THIS->fontset [GET_STYLE 
> (r)]->find_font (t1));
>            for (int x = w - 2; x-- > 0; )
>              {
>                *tp++ = t1;
> -              *rp++ = r;
> +              *rp++ = r_t1;
>              }
>  
>            *tp = t2;
> -          *rp = r;
> +          *rp = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (t2));
>          }
>        else
>          for (int x = w; x-- > 0; )
> @@ -326,7 +327,7 @@ void overlay::swap ()
>        for (int x = ov_w; x--; )
>          {
>            text_t t = *t1; *t1++ = *t2; *t2++ = t;
> -          rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, THIS->fontset 
> [GET_STYLE (r)]->find_font (t));
> +          rend_t r = *r1; *r1++ = *r2; *r2++ = r;
>          }
>      }
> ```
> 
> 
> Regards,
> Daniel.
> 
> 
> On 10.12.2017 17:47, Daniel Hahler wrote:
>> From: Daniel Hahler <[email protected]>
>>
>> This keeps the existing font when `rxvt_term::scr_swap_overlay` is used,
>> instead of setting it anew.
>>
>> While this appears to be good in general, it is important for when the
>> font has been explicitly set to match the previous one, like I am doing
>> for spaces in my wide-glyphs patchset.
>> ---
>>  src/screen.C | 11 ++++++-----
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/screen.C b/src/screen.C
>> index f3c6d576..85014e40 100644
>> --- a/src/screen.C
>> +++ b/src/screen.C
>> @@ -3598,16 +3598,17 @@ rxvt_term::scr_overlay_new (int x, int y, int w, int 
>> h) NOTHROW
>>          t0 = 0x255a, t1 = 0x2550, t2 = 0x255d;
>>  
>>        *tp++ = t0;
>> -      *rp++ = r;
>> +      *rp++ = SET_FONT (r, FONTSET (r)->find_font (t0));
>>  
>> +      rend_t r_t1 = SET_FONT (r, FONTSET (r)->find_font (t1));
>>        for (x = w - 2; x > 0; --x)
>>          {
>>            *tp++ = t1;
>> -          *rp++ = r;
>> +          *rp++ = r_t1;
>>          }
>>  
>>        *tp = t2;
>> -      *rp = r;
>> +      *rp = SET_FONT (r, FONTSET (r)->find_font (t2));
>>      }
>>  }
>>  
>> @@ -3638,7 +3639,7 @@ rxvt_term::scr_overlay_set (int x, int y, text_t text, 
>> rend_t rend) NOTHROW
>>    x++, y++;
>>  
>>    ov.text[y][x] = text;
>> -  ov.rend[y][x] = rend;
>> +  ov.rend[y][x] = SET_FONT (rend, FONTSET (rend)->find_font (text));
>>  }
>>  
>>  void
>> @@ -3687,7 +3688,7 @@ rxvt_term::scr_swap_overlay () NOTHROW
>>        for (int x = ov.w; x--; )
>>          {
>>            text_t t = *t1; *t1++ = *t2; *t2++ = t;
>> -          rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET 
>> (r)->find_font (t));
>> +          rend_t r = *r1; *r1++ = *r2; *r2++ = r;
>>          }
>>      }
>>  }
>>
> 
> 
> 
> 
> _______________________________________________
> rxvt-unicode mailing list
> [email protected]
> http://lists.schmorp.de/mailman/listinfo/rxvt-unicode
> 

 src/command.C   |  3 ++-
 src/rxvtperl.xs |  9 +++++----
 src/screen.C    | 11 +++++++----
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/command.C b/src/command.C
index 340915fb..e2e9f0f9 100644
--- a/src/command.C
+++ b/src/command.C
@@ -220,7 +220,8 @@ rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y, int y2)
 
   scr_overlay_set (0, 0, rowcol);
 
-  r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));
+  r = SET_FONT (OVERLAY_RSTYLE, GET_FONT(r));
+  r = SET_STYLE (r, GET_STYLE (r));
 
   for (int y = 0; y < len; y++)
     {
diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
index 3144b951..6abdaca8 100644
--- a/src/rxvtperl.xs
+++ b/src/rxvtperl.xs
@@ -227,16 +227,17 @@ overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle
             t0 = 0x255a, t1 = 0x2550, t2 = 0x255d;
 
           *tp++ = t0;
-          *rp++ = r;
+          *rp++ = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (t0));
 
+          rend_t r_t1 = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (t1));
           for (int x = w - 2; x-- > 0; )
             {
               *tp++ = t1;
-              *rp++ = r;
+              *rp++ = r_t1;
             }
 
           *tp = t2;
-          *rp = r;
+          *rp = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (t2));
         }
       else
         for (int x = w; x-- > 0; )
@@ -326,7 +327,7 @@ void overlay::swap ()
       for (int x = ov_w; x--; )
         {
           text_t t = *t1; *t1++ = *t2; *t2++ = t;
-          rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (t));
+          rend_t r = *r1; *r1++ = *r2; *r2++ = r;
         }
     }
 
diff --git a/src/screen.C b/src/screen.C
index ab03de09..e7038767 100644
--- a/src/screen.C
+++ b/src/screen.C
@@ -3627,16 +3627,17 @@ rxvt_term::scr_overlay_new (int x, int y, int w, int h) NOTHROW
         t0 = 0x255a, t1 = 0x2550, t2 = 0x255d;
 
       *tp++ = t0;
-      *rp++ = r;
+      *rp++ = SET_FONT (r, FONTSET (r)->find_font (t0));
 
+      rend_t r_t1 = SET_FONT (r, FONTSET (r)->find_font (t1));
       for (x = w - 2; x > 0; --x)
         {
           *tp++ = t1;
-          *rp++ = r;
+          *rp++ = r_t1;
         }
 
       *tp = t2;
-      *rp = r;
+      *rp = SET_FONT (r, FONTSET (r)->find_font (t2));
     }
 }
 
@@ -3668,6 +3669,8 @@ rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend) NOTHROW
 
   ov.text[y][x] = text;
   ov.rend[y][x] = rend;
+  if (!GET_FONT(rend))
+    ov.rend[y][x] = SET_FONT (rend, FONTSET (rend)->find_font (text));
 }
 
 void
@@ -3716,7 +3719,7 @@ rxvt_term::scr_swap_overlay () NOTHROW
       for (int x = ov.w; x--; )
         {
           text_t t = *t1; *t1++ = *t2; *t2++ = t;
-          rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t));
+          rend_t r = *r1; *r1++ = *r2; *r2++ = r;
         }
     }
 }

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/mailman/listinfo/rxvt-unicode

Reply via email to