On 26.11.2014 21:11, Marc Lehmann wrote:
> On Wed, Nov 26, 2014 at 07:02:38PM +0100, Daniel Hahler wrote:

>>> No, the symbola font is, by design, unsuitable for a character grid if it
>>> causes these issues.
>> How does libvte and others handle this?
> I have no clue - the question you have to ask yourself: how could a font
> be handled that has characters that don't fit into a terminal cell? I
> don't think there is any "correct" way to handle that, except by not using
> that font then (which is probably what urxvt does).

Yes, urxvt skips these glyphs, while gnome-terminal etc let it overlap into
the next cell.

This is why e.g. https://github.com/ryanoasis/vim-webdevicons includes an
extra space character after the symbols, to provide the necessary room.

> [...]
> Urxvt has limited support for overlapping characters (I
> think it allows 50% overlap at most, but I would haver to check first).

I could make URxvt display these glyphs by patching src/rxvtfont.C:

1. I've deactivated the "!OVERLAP_OK"-code in src/rxvtfont.C.

2. And then adjusted/fixed the x offset to be at the start of the first cell:

-          ep->x = x_ + (cwidth - extents.xOff >> 1);
+          ep->x = x_;
           ep->y = y_ + ascent;
 
-          if (extents.xOff == 0)
-            ep->x = x_ + cwidth;

Some remarks: this needs a patched font, which contains the extra symbols
(instead of using a separate font), or otherwise URxvt's code to include
previous careful characters gets not called ("include previous careful
character(s) if possible, looks nicer (best effort...)", from screen.C).

I think it would be safe to let characters overlap if the next cell is
empty, i.e. contains a space character.

I am attaching the patch, but only for reference - it's not meant to be
applied as-is.


Regards,
Daniel.
diff --git i/src/rxvtfont.C w/src/rxvtfont.C
index 5dcd125..32f161f 100644
--- i/src/rxvtfont.C
+++ w/src/rxvtfont.C
@@ -1026,8 +1026,8 @@ rxvt_font_x11::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &car
 
   careful = xcs->lbearing < 0 || xcs->rbearing > prop->width * wcw;
 
-  if (careful && !OVERLAP_OK (w, wcw, prop))
-    return false;
+  // if (careful && !OVERLAP_OK (w, wcw, prop))
+  //   return false;
 
   return true;
 }
@@ -1345,12 +1345,12 @@ rxvt_font_xft::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &car
 
   careful = g.x > 0 || w > prop->width * wcw;
 
-  if (careful && !OVERLAP_OK (w, wcw, prop))
-    return false;
-
-  // this weeds out _totally_ broken fonts, or glyphs
-  if (!OVERLAP_OK (g.xOff, wcw, prop))
-    return false;
+  // if (careful && !OVERLAP_OK (w, wcw, prop))
+  //   return false;
+  //
+  // // this weeds out _totally_ broken fonts, or glyphs
+  // if (!OVERLAP_OK (g.xOff, wcw, prop))
+  //   return false;
 
   return true;
 }
@@ -1394,12 +1394,9 @@ rxvt_font_xft::draw (rxvt_drawable &d, int x, int y,
           XftGlyphExtents (disp, f, &glyph, 1, &extents);
 
           ep->glyph = glyph;
-          ep->x = x_ + (cwidth - extents.xOff >> 1);
+          ep->x = x_;
           ep->y = y_ + ascent;
 
-          if (extents.xOff == 0)
-            ep->x = x_ + cwidth;
-
           ep++;
         }
 

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to