[vte/vte-0-36] widget: Nicer box drawing characters
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-0-36] widget: Nicer box drawing characters
- Date: Mon, 17 Mar 2014 21:25:16 +0000 (UTC)
commit 56ab1baaa64f2a23f25450c8682b6693c9b0329a
Author: Egmont Koblinger <egmont gmail com>
Date: Mon Mar 17 21:59:14 2014 +0100
widget: Nicer box drawing characters
Fixes problems with the hollow box drawing characters.
https://bugzilla.gnome.org/show_bug.cgi?id=709556
src/Makefile.am | 12 +-
src/box_drawing.txt | 768 +++++++++++++++++++++++++++++++++++++++++++
src/box_drawing_generate.sh | 70 ++++
src/vte.c | 474 ++++++---------------------
4 files changed, 944 insertions(+), 380 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index b4dd6d0..20dc3a0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,6 +29,7 @@ EXTRA_libvte VTE_LIBRARY_SUFFIX_U@_la_SOURCES = \
$(NULL)
libvte VTE_LIBRARY_SUFFIX_U@_la_SOURCES = \
+ box_drawing.h \
buffer.h \
caps.c \
caps.h \
@@ -115,10 +116,13 @@ libvte VTE_LIBRARY_SUFFIX_U@_la_LDFLAGS = \
# Generated sources
VTESEQ_BUILTSOURCES = vteseq-list.h vteseq-2.c vteseq-n.c
-BUILT_SOURCES = marshal.c marshal.h vtetypebuiltins.c vtetypebuiltins.h vteresources.c $(VTESEQ_BUILTSOURCES)
+BUILT_SOURCES = box_drawing.h marshal.c marshal.h vtetypebuiltins.c vtetypebuiltins.h vteresources.c
$(VTESEQ_BUILTSOURCES)
MAINTAINERCLEANFILES = $(VTESEQ_BUILTSOURCES)
-EXTRA_DIST += $(VTESEQ_BUILTSOURCES)
-CLEANFILES = marshal.c marshal.h vtetypebuiltins.c vtetypebuiltins.h stamp-vtetypebuiltins.h vteresources.c
+EXTRA_DIST += $(VTESEQ_BUILTSOURCES) box_drawing.txt
+CLEANFILES = box_drawing.h marshal.c marshal.h vtetypebuiltins.c vtetypebuiltins.h stamp-vtetypebuiltins.h
vteresources.c
+
+box_drawing.h: box_drawing.txt
+ $(AM_V_GEN) $(srcdir)/box_drawing_generate.sh < $< > $@
marshal.c: marshal.list
$(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_vte_marshal --header --body --internal $< > $@
@@ -356,5 +360,7 @@ xticker_SOURCES = xticker.c
profiledir = $(sysconfdir)/profile.d
dist_profile_DATA = vte.sh
+.DELETE_ON_ERROR:
+
-include $(top_srcdir)/git.mk
-include $(INTROSPECTION_MAKEFILE)
diff --git a/src/box_drawing.txt b/src/box_drawing.txt
new file mode 100644
index 0000000..966c34f
--- /dev/null
+++ b/src/box_drawing.txt
@@ -0,0 +1,768 @@
+U+2500 - light horizontal
+░░░░░
+░░░░░
+▓▓▓▓▓
+░░░░░
+░░░░░
+U+2501 - heavy horizontal
+░░░░░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░░░░░
+U+2502 - light vertical
+░░▓░░
+░░▓░░
+░░▓░░
+░░▓░░
+░░▓░░
+U+2503 - heavy vertical
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+U+2504 - not handled here: light triple dash horizontal
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2505 - not handled here: heavy triple dash horizontal
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2506 - not handled here: light triple dash vertical
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2507 - not handled here: heavy triple dash vertical
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2508 - not handled here: light quadruple dash horizontal
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2509 - not handled here: heavy quadruple dash horizontal
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+250A - not handled here: light quadruple dash vertical
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+250B - not handled here: heavy quadruple dash vertical
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+250C - light down and right
+░░░░░
+░░░░░
+░░▓▓▓
+░░▓░░
+░░▓░░
+U+250D - down light and right heavy
+░░░░░
+░░▓▓▓
+░░▓▓▓
+░░▓▓▓
+░░▓░░
+U+250E - down heavy and right light
+░░░░░
+░░░░░
+░▓▓▓▓
+░▓▓▓░
+░▓▓▓░
+U+250F - heavy down and right
+░░░░░
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓░
+U+2510 - light down and left
+░░░░░
+░░░░░
+▓▓▓░░
+░░▓░░
+░░▓░░
+U+2511 - down light and left heavy
+░░░░░
+▓▓▓░░
+▓▓▓░░
+▓▓▓░░
+░░▓░░
+U+2512 - down heavy and left light
+░░░░░
+░░░░░
+▓▓▓▓░
+░▓▓▓░
+░▓▓▓░
+U+2513 - heavy down and left
+░░░░░
+▓▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+░▓▓▓░
+U+2514 - light up and right
+░░▓░░
+░░▓░░
+░░▓▓▓
+░░░░░
+░░░░░
+U+2515 - up light and right heavy
+░░▓░░
+░░▓▓▓
+░░▓▓▓
+░░▓▓▓
+░░░░░
+U+2516 - up heavy and right light
+░▓▓▓░
+░▓▓▓░
+░▓▓▓▓
+░░░░░
+░░░░░
+U+2517 - heavy up and right
+░▓▓▓░
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓▓
+░░░░░
+U+2518 - light up and left
+░░▓░░
+░░▓░░
+▓▓▓░░
+░░░░░
+░░░░░
+U+2519 - up light and left heavy
+░░▓░░
+▓▓▓░░
+▓▓▓░░
+▓▓▓░░
+░░░░░
+U+251A - up heavy and left light
+░▓▓▓░
+░▓▓▓░
+▓▓▓▓░
+░░░░░
+░░░░░
+U+251B - heavy up and left
+░▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+░░░░░
+U+251C - light vertical and right
+░░▓░░
+░░▓░░
+░░▓▓▓
+░░▓░░
+░░▓░░
+U+251D - vertical light and right heavy
+░░▓░░
+░░▓▓▓
+░░▓▓▓
+░░▓▓▓
+░░▓░░
+U+251E - up heavy and right down light
+░▓▓▓░
+░▓▓▓░
+░▓▓▓▓
+░░▓░░
+░░▓░░
+U+251F - down heavy and right up light
+░░▓░░
+░░▓░░
+░▓▓▓▓
+░▓▓▓░
+░▓▓▓░
+U+2520 - vertical heavy and right light
+░▓▓▓░
+░▓▓▓░
+░▓▓▓▓
+░▓▓▓░
+░▓▓▓░
+U+2521 - down light and right up heavy
+░▓▓▓░
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓▓
+░░▓░░
+U+2522 - up light and right down heavy
+░░▓░░
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓░
+U+2523 - heavy vertical and right
+░▓▓▓░
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓░
+U+2524 - light vertical and left
+░░▓░░
+░░▓░░
+▓▓▓░░
+░░▓░░
+░░▓░░
+U+2525 - vertical light and left heavy
+░░▓░░
+▓▓▓░░
+▓▓▓░░
+▓▓▓░░
+░░▓░░
+U+2526 - up heavy and left down light
+░▓▓▓░
+░▓▓▓░
+▓▓▓▓░
+░░▓░░
+░░▓░░
+U+2527 - down heavy and left up light
+░░▓░░
+░░▓░░
+▓▓▓▓░
+░▓▓▓░
+░▓▓▓░
+U+2528 - vertical heavy and left light
+░▓▓▓░
+░▓▓▓░
+▓▓▓▓░
+░▓▓▓░
+░▓▓▓░
+U+2529 - down light and left up heavy
+░▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+░░▓░░
+U+252A - up light and left down heavy
+░░▓░░
+▓▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+░▓▓▓░
+U+252B - heavy vertical and left
+░▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+░▓▓▓░
+U+252C - light down and horizontal
+░░░░░
+░░░░░
+▓▓▓▓▓
+░░▓░░
+░░▓░░
+U+252D - left heavy and right down light
+░░░░░
+▓▓▓░░
+▓▓▓▓▓
+▓▓▓░░
+░░▓░░
+U+252E - right heavy and left down light
+░░░░░
+░░▓▓▓
+▓▓▓▓▓
+░░▓▓▓
+░░▓░░
+U+252F - down light and horizontal heavy
+░░░░░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░░▓░░
+U+2530 - down heavy and horizontal light
+░░░░░
+░░░░░
+▓▓▓▓▓
+░▓▓▓░
+░▓▓▓░
+U+2531 - right light and left down heavy
+░░░░░
+▓▓▓▓░
+▓▓▓▓▓
+▓▓▓▓░
+░▓▓▓░
+U+2532 - left light and right down heavy
+░░░░░
+░▓▓▓▓
+▓▓▓▓▓
+░▓▓▓▓
+░▓▓▓░
+U+2533 - heavy down and horizontal
+░░░░░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░▓▓▓░
+U+2534 - light up and horizontal
+░░▓░░
+░░▓░░
+▓▓▓▓▓
+░░░░░
+░░░░░
+U+2535 - left heavy and right up light
+░░▓░░
+▓▓▓░░
+▓▓▓▓▓
+▓▓▓░░
+░░░░░
+U+2536 - right heavy and left up light
+░░▓░░
+░░▓▓▓
+▓▓▓▓▓
+░░▓▓▓
+░░░░░
+U+2537 - up light and horizontal heavy
+░░▓░░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░░░░░
+U+2538 - up heavy and horizontal light
+░▓▓▓░
+░▓▓▓░
+▓▓▓▓▓
+░░░░░
+░░░░░
+U+2539 - right light and left up heavy
+░▓▓▓░
+▓▓▓▓░
+▓▓▓▓▓
+▓▓▓▓░
+░░░░░
+U+253A - left light and right up heavy
+░▓▓▓░
+░▓▓▓▓
+▓▓▓▓▓
+░▓▓▓▓
+░░░░░
+U+253B - heavy up and horizontal
+░▓▓▓░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░░░░░
+U+253C - light vertical and horizontal
+░░▓░░
+░░▓░░
+▓▓▓▓▓
+░░▓░░
+░░▓░░
+U+253D - left heavy and right vertical light
+░░▓░░
+▓▓▓░░
+▓▓▓▓▓
+▓▓▓░░
+░░▓░░
+U+253E - right heavy and left vertical light
+░░▓░░
+░░▓▓▓
+▓▓▓▓▓
+░░▓▓▓
+░░▓░░
+U+253F - vertical light and horizontal heavy
+░░▓░░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░░▓░░
+U+2540 - up heavy and down horizontal light
+░▓▓▓░
+░▓▓▓░
+▓▓▓▓▓
+░░▓░░
+░░▓░░
+U+2541 - down heavy and up horizontal light
+░░▓░░
+░░▓░░
+▓▓▓▓▓
+░▓▓▓░
+░▓▓▓░
+U+2542 - vertical heavy and horizontal light
+░▓▓▓░
+░▓▓▓░
+▓▓▓▓▓
+░▓▓▓░
+░▓▓▓░
+U+2543 - left up heavy and right down light
+░▓▓▓░
+▓▓▓▓░
+▓▓▓▓▓
+▓▓▓▓░
+░░▓░░
+U+2544 - right up heavy and left down light
+░▓▓▓░
+░▓▓▓▓
+▓▓▓▓▓
+░▓▓▓▓
+░░▓░░
+U+2545 - left down heavy and right up light
+░░▓░░
+▓▓▓▓░
+▓▓▓▓▓
+▓▓▓▓░
+░▓▓▓░
+U+2546 - right down heavy and left up light
+░░▓░░
+░▓▓▓▓
+▓▓▓▓▓
+░▓▓▓▓
+░▓▓▓░
+U+2547 - down light and up horizontal heavy
+░▓▓▓░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░░▓░░
+U+2548 - up light and down horizontal heavy
+░░▓░░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░▓▓▓░
+U+2549 - right light and left vertical heavy
+░▓▓▓░
+▓▓▓▓░
+▓▓▓▓▓
+▓▓▓▓░
+░▓▓▓░
+U+254A - left light and right vertical heavy
+░▓▓▓░
+░▓▓▓▓
+▓▓▓▓▓
+░▓▓▓▓
+░▓▓▓░
+U+254B - heavy vertical and horizontal
+░▓▓▓░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░▓▓▓░
+U+254C - not handled here: light double dash horizontal
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+254D - not handled here: heavy double dash horizontal
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+254E - not handled here: light double dash vertical
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+254F - not handled here: heavy double dash vertical
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2550 - double horizontal
+░░░░░
+▓▓▓▓▓
+░░░░░
+▓▓▓▓▓
+░░░░░
+U+2551 - double vertical
+░▓░▓░
+░▓░▓░
+░▓░▓░
+░▓░▓░
+░▓░▓░
+U+2552 - down single and right double
+░░░░░
+░░▓▓▓
+░░▓░░
+░░▓▓▓
+░░▓░░
+U+2553 - down double and right single
+░░░░░
+░░░░░
+░▓▓▓▓
+░▓░▓░
+░▓░▓░
+U+2554 - double down and right
+░░░░░
+░▓▓▓▓
+░▓░░░
+░▓░▓▓
+░▓░▓░
+U+2555 - down single and left double
+░░░░░
+▓▓▓░░
+░░▓░░
+▓▓▓░░
+░░▓░░
+U+2556 - down double and left single
+░░░░░
+░░░░░
+▓▓▓▓░
+░▓░▓░
+░▓░▓░
+U+2557 - double down and left
+░░░░░
+▓▓▓▓░
+░░░▓░
+▓▓░▓░
+░▓░▓░
+U+2558 - up single and right double
+░░▓░░
+░░▓▓▓
+░░▓░░
+░░▓▓▓
+░░░░░
+U+2559 - up double and right single
+░▓░▓░
+░▓░▓░
+░▓▓▓▓
+░░░░░
+░░░░░
+U+255A - double up and right
+░▓░▓░
+░▓░▓▓
+░▓░░░
+░▓▓▓▓
+░░░░░
+U+255B - up single and left double
+░░▓░░
+▓▓▓░░
+░░▓░░
+▓▓▓░░
+░░░░░
+U+255C - up double and left single
+░▓░▓░
+░▓░▓░
+▓▓▓▓░
+░░░░░
+░░░░░
+U+255D - double up and left
+░▓░▓░
+▓▓░▓░
+░░░▓░
+▓▓▓▓░
+░░░░░
+U+255E - vertical single and right double
+░░▓░░
+░░▓▓▓
+░░▓░░
+░░▓▓▓
+░░▓░░
+U+255F - vertical double and right single
+░▓░▓░
+░▓░▓░
+░▓░▓▓
+░▓░▓░
+░▓░▓░
+U+2560 - double vertical and right
+░▓░▓░
+░▓░▓▓
+░▓░░░
+░▓░▓▓
+░▓░▓░
+U+2561 - vertical single and left double
+░░▓░░
+▓▓▓░░
+░░▓░░
+▓▓▓░░
+░░▓░░
+U+2562 - vertical double and left single
+░▓░▓░
+░▓░▓░
+▓▓░▓░
+░▓░▓░
+░▓░▓░
+U+2563 - double vertical and left
+░▓░▓░
+▓▓░▓░
+░░░▓░
+▓▓░▓░
+░▓░▓░
+U+2564 - down single and horizontal double
+░░░░░
+▓▓▓▓▓
+░░░░░
+▓▓▓▓▓
+░░▓░░
+U+2565 - down double and horizontal single
+░░░░░
+░░░░░
+▓▓▓▓▓
+░▓░▓░
+░▓░▓░
+U+2566 - double down and horizontal
+░░░░░
+▓▓▓▓▓
+░░░░░
+▓▓░▓▓
+░▓░▓░
+U+2567 - up single and horizontal double
+░░▓░░
+▓▓▓▓▓
+░░░░░
+▓▓▓▓▓
+░░░░░
+U+2568 - up double and horizontal single
+░▓░▓░
+░▓░▓░
+▓▓▓▓▓
+░░░░░
+░░░░░
+U+2569 - double up and horizontal
+░▓░▓░
+▓▓░▓▓
+░░░░░
+▓▓▓▓▓
+░░░░░
+U+256A - vertical single and horizontal double
+░░▓░░
+▓▓▓▓▓
+░░▓░░
+▓▓▓▓▓
+░░▓░░
+U+256B - vertical double and horizontal single
+░▓░▓░
+░▓░▓░
+▓▓▓▓▓
+░▓░▓░
+░▓░▓░
+U+256C - double vertical and horizontal
+░▓░▓░
+▓▓░▓▓
+░░░░░
+▓▓░▓▓
+░▓░▓░
+U+256D - not handled here: light arc down and right
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+256E - not handled here: light arc down and left
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+256F - not handled here: light arc up and left
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2570 - not handled here: light arc up and right
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2571 - not handled here: light diagonal upper right to lower left
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2572 - not handled here: light diagonal upper left to lower right
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2573 - not handled here: light diagonal cross
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2574 - light left
+░░░░░
+░░░░░
+▓▓▓░░
+░░░░░
+░░░░░
+U+2575 - light up
+░░▓░░
+░░▓░░
+░░▓░░
+░░░░░
+░░░░░
+U+2576 - light right
+░░░░░
+░░░░░
+░░▓▓▓
+░░░░░
+░░░░░
+U+2577 - light down
+░░░░░
+░░░░░
+░░▓░░
+░░▓░░
+░░▓░░
+U+2578 - heavy left
+░░░░░
+▓▓▓░░
+▓▓▓░░
+▓▓▓░░
+░░░░░
+U+2579 - heavy up
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+░░░░░
+░░░░░
+U+257A - heavy right
+░░░░░
+░░▓▓▓
+░░▓▓▓
+░░▓▓▓
+░░░░░
+U+257B - heavy down
+░░░░░
+░░░░░
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+U+257C - light left and heavy right
+░░░░░
+░░▓▓▓
+▓▓▓▓▓
+░░▓▓▓
+░░░░░
+U+257D - light up and heavy down
+░░▓░░
+░░▓░░
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+U+257E - heavy left and light right
+░░░░░
+▓▓▓░░
+▓▓▓▓▓
+▓▓▓░░
+░░░░░
+U+257F - heavy up and light down
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+░░▓░░
+░░▓░░
diff --git a/src/box_drawing_generate.sh b/src/box_drawing_generate.sh
new file mode 100755
index 0000000..b1dff39
--- /dev/null
+++ b/src/box_drawing_generate.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+# Copyright © 2014 Egmont Koblinger
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+cat <<"END"
+/* Generated by box_drawing_generate.sh; do not edit! */
+
+#define VTE_BOX_DRAWING_5_BY_5_BITMAP(x11, x12, x13, x14, x15, \
+ x21, x22, x23, x24, x25, \
+ x31, x32, x33, x34, x35, \
+ x41, x42, x43, x44, x45, \
+ x51, x52, x53, x54, x55) \
+ (((x11) << 24) | ((x12) << 23) | ((x13) << 22) | ((x14) << 21) | ((x15) << 20) | \
+ ((x21) << 19) | ((x22) << 18) | ((x23) << 17) | ((x24) << 16) | ((x25) << 15) | \
+ ((x31) << 14) | ((x32) << 13) | ((x33) << 12) | ((x34) << 11) | ((x35) << 10) | \
+ ((x41) << 9) | ((x42) << 8) | ((x43) << 7) | ((x44) << 6) | ((x45) << 5) | \
+ ((x51) << 4) | ((x52) << 3) | ((x53) << 2) | ((x54) << 1) | ((x55)))
+
+/* Definition of most of the glyphs in the 2500..257F range as 5x5 bitmaps
+ (bits 24..0 in the obvious order), see bug 709556 and ../doc/boxes.txt */
+static const guint32 _vte_box_drawing_bitmaps[128] = {
+END
+
+LC_ALL=C
+pos=$((0x2500))
+while [ $pos -lt $((0x2580)) ]; do
+ read header
+ echo -e "\\t/* $header */"
+ echo -e "\\tVTE_BOX_DRAWING_5_BY_5_BITMAP("
+ for y in 1 2 3 4 5; do
+ echo -ne '\t\t'
+ read line
+ for x in 1 2 3 4 5; do
+ if [ "${line:0:3}" == "▓" ]; then
+ echo -n '1'
+ else
+ echo -n '0'
+ fi
+ line="${line:3}"
+ if [ $x = 5 -a $y = 5 ]; then
+ echo -n ')'
+ fi
+ echo -n ', '
+ if [ $x = 5 ]; then
+ echo
+ fi
+ done
+ done
+ echo
+ pos=$((pos+1))
+done
+
+cat <<"END"
+};
+
+#undef VTE_BOX_DRAWING_5_BY_5_BITMAP
+END
diff --git a/src/vte.c b/src/vte.c
index 0204344..3ffd572 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -9504,6 +9504,8 @@ vte_terminal_draw_rectangle(VteTerminal *terminal,
color, VTE_DRAW_OPAQUE);
}
+#include "box_drawing.h"
+
/* Draw the graphic representation of a line-drawing or special graphics
* character. */
static gboolean
@@ -9552,10 +9554,14 @@ vte_terminal_draw_graphic(VteTerminal *terminal, vteunistr c,
k_eights; \
})
- light_line_width = (terminal->char_width + 4) / 5;
+ light_line_width = terminal->char_width / 5;
light_line_width = MAX (light_line_width, 1);
- heavy_line_width = light_line_width + 2;
+ if (c >= 0x2550 && c <= 0x256c) {
+ heavy_line_width = 3 * light_line_width;
+ } else {
+ heavy_line_width = light_line_width + 2;
+ }
xcenter = x + left_half;
ycenter = y + upper_half;
@@ -9569,66 +9575,6 @@ vte_terminal_draw_graphic(VteTerminal *terminal, vteunistr c,
case 0x2501: /* box drawings heavy horizontal */
case 0x2502: /* box drawings light vertical */
case 0x2503: /* box drawings heavy vertical */
- case 0x2504: /* box drawings light triple dash horizontal */
- case 0x2505: /* box drawings heavy triple dash horizontal */
- case 0x2506: /* box drawings light triple dash vertical */
- case 0x2507: /* box drawings heavy triple dash vertical */
- case 0x2508: /* box drawings light quadruple dash horizontal */
- case 0x2509: /* box drawings heavy quadruple dash horizontal */
- case 0x250a: /* box drawings light quadruple dash vertical */
- case 0x250b: /* box drawings heavy quadruple dash vertical */
- case 0x254c: /* box drawings light double dash horizontal */
- case 0x254d: /* box drawings heavy double dash horizontal */
- case 0x254e: /* box drawings light double dash vertical */
- case 0x254f: /* box drawings heavy double dash vertical */
- {
- const guint v = c - 0x2500;
- int size, line_width;
-
- size = (v & 2) ? row_height : width;
-
- switch (v >> 2) {
- case 0: /* no dashes */
- break;
- case 1: /* triple dash */
- {
- double segment = size / 8.;
- double dashes[2] = { segment * 2., segment };
- cairo_set_dash(cr, dashes, G_N_ELEMENTS(dashes), 0.);
- break;
- }
- case 2: /* quadruple dash */
- {
- double segment = size / 11.;
- double dashes[2] = { segment * 2., segment };
- cairo_set_dash(cr, dashes, G_N_ELEMENTS(dashes), 0.);
- break;
- }
- case 19: /* double dash */
- {
- double segment = size / 5.;
- double dashes[2] = { segment * 2., segment };
- cairo_set_dash(cr, dashes, G_N_ELEMENTS(dashes), 0.);
- break;
- }
- }
-
- line_width = (v & 1) ? heavy_line_width : light_line_width;
- adjust = (line_width & 1) ? .5 : 0.;
-
- cairo_set_line_width(cr, line_width);
- cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
- if (v & 2) {
- cairo_move_to(cr, xcenter + adjust, y);
- cairo_line_to(cr, xcenter + adjust, y + row_height);
- } else {
- cairo_move_to(cr, x, ycenter + adjust);
- cairo_line_to(cr, x + width, ycenter + adjust);
- }
- cairo_stroke(cr);
- break;
- }
-
case 0x250c: /* box drawings light down and right */
case 0x250d: /* box drawings down light and right heavy */
case 0x250e: /* box drawings down heavy and right light */
@@ -9693,190 +9639,6 @@ vte_terminal_draw_graphic(VteTerminal *terminal, vteunistr c,
case 0x2549: /* box drawings right light and left vertical heavy */
case 0x254a: /* box drawings left light and right vertical heavy */
case 0x254b: /* box drawings heavy vertical and horizontal */
- case 0x2574: /* box drawings light left */
- case 0x2575: /* box drawings light up */
- case 0x2576: /* box drawings light right */
- case 0x2577: /* box drawings light down */
- case 0x2578: /* box drawings heavy left */
- case 0x2579: /* box drawings heavy up */
- case 0x257a: /* box drawings heavy right */
- case 0x257b: /* box drawings heavy down */
- case 0x257c: /* box drawings light left and heavy right */
- case 0x257d: /* box drawings light up and heavy down */
- case 0x257e: /* box drawings heavy left and light right */
- case 0x257f: /* box drawings heavy up and light down */
- {
- enum { BOX_LEFT_LIGHT = 1 << 0,
- BOX_LEFT_HEAVY = 1 << 1,
- BOX_RIGHT_LIGHT = 1 << 2,
- BOX_RIGHT_HEAVY = 1 << 3,
- BOX_TOP_LIGHT = 1 << 4,
- BOX_TOP_HEAVY = 1 << 5,
- BOX_BOTTOM_LIGHT = 1 << 6,
- BOX_BOTTOM_HEAVY = 1 << 7,
- BOX_HORIZONTAL_LIGHT = BOX_LEFT_LIGHT | BOX_RIGHT_LIGHT,
- BOX_HORIZONTAL_HEAVY = BOX_LEFT_HEAVY | BOX_RIGHT_HEAVY,
- BOX_VERTICAL_LIGHT = BOX_TOP_LIGHT | BOX_BOTTOM_LIGHT,
- BOX_VERTICAL_HEAVY = BOX_TOP_HEAVY | BOX_BOTTOM_HEAVY,
- BOX_LEFT = BOX_LEFT_LIGHT | BOX_LEFT_HEAVY,
- BOX_RIGHT = BOX_RIGHT_LIGHT | BOX_RIGHT_HEAVY,
- BOX_TOP = BOX_TOP_LIGHT | BOX_TOP_HEAVY,
- BOX_BOTTOM = BOX_BOTTOM_LIGHT | BOX_BOTTOM_HEAVY,
- BOX_HORIZONTAL = BOX_HORIZONTAL_LIGHT | BOX_HORIZONTAL_HEAVY,
- BOX_VERTICAL = BOX_VERTICAL_LIGHT | BOX_VERTICAL_HEAVY,
- BOX_LIGHT = BOX_HORIZONTAL_LIGHT | BOX_VERTICAL_LIGHT,
- BOX_HEAVY = BOX_HORIZONTAL_HEAVY | BOX_VERTICAL_HEAVY
- };
- static const guint8 const map[] = {
- BOX_BOTTOM_LIGHT | BOX_RIGHT_LIGHT,
- BOX_BOTTOM_LIGHT | BOX_RIGHT_HEAVY,
- BOX_BOTTOM_HEAVY | BOX_RIGHT_LIGHT,
- BOX_BOTTOM_HEAVY | BOX_RIGHT_HEAVY,
- BOX_BOTTOM_LIGHT | BOX_LEFT_LIGHT,
- BOX_BOTTOM_LIGHT | BOX_LEFT_HEAVY,
- BOX_BOTTOM_HEAVY | BOX_LEFT_LIGHT,
- BOX_BOTTOM_HEAVY | BOX_LEFT_HEAVY,
- BOX_TOP_LIGHT | BOX_RIGHT_LIGHT,
- BOX_TOP_LIGHT | BOX_RIGHT_HEAVY,
- BOX_TOP_HEAVY | BOX_RIGHT_LIGHT,
- BOX_TOP_HEAVY | BOX_RIGHT_HEAVY,
- BOX_TOP_LIGHT | BOX_LEFT_LIGHT,
- BOX_TOP_LIGHT | BOX_LEFT_HEAVY,
- BOX_TOP_HEAVY | BOX_LEFT_LIGHT,
- BOX_TOP_HEAVY | BOX_LEFT_HEAVY,
- BOX_VERTICAL_LIGHT | BOX_RIGHT_LIGHT,
- BOX_VERTICAL_LIGHT | BOX_RIGHT_HEAVY,
- BOX_TOP_HEAVY | BOX_RIGHT_LIGHT | BOX_BOTTOM_LIGHT,
- BOX_BOTTOM_HEAVY | BOX_RIGHT_LIGHT | BOX_TOP_LIGHT,
- BOX_VERTICAL_HEAVY | BOX_RIGHT_LIGHT,
- BOX_BOTTOM_LIGHT | BOX_RIGHT_HEAVY | BOX_TOP_HEAVY,
- BOX_TOP_LIGHT | BOX_RIGHT_HEAVY | BOX_BOTTOM_HEAVY,
- BOX_VERTICAL_HEAVY | BOX_RIGHT_HEAVY,
- BOX_VERTICAL_LIGHT | BOX_LEFT_LIGHT,
- BOX_VERTICAL_LIGHT | BOX_LEFT_HEAVY,
- BOX_TOP_HEAVY | BOX_LEFT_LIGHT | BOX_BOTTOM_LIGHT,
- BOX_BOTTOM_HEAVY | BOX_LEFT_LIGHT | BOX_TOP_LIGHT,
- BOX_VERTICAL_HEAVY | BOX_LEFT_LIGHT,
- BOX_BOTTOM_LIGHT | BOX_LEFT_HEAVY | BOX_TOP_HEAVY,
- BOX_TOP_LIGHT | BOX_LEFT_HEAVY | BOX_BOTTOM_HEAVY,
- BOX_VERTICAL_HEAVY | BOX_LEFT_HEAVY,
- BOX_BOTTOM_LIGHT | BOX_HORIZONTAL_LIGHT,
- BOX_LEFT_HEAVY | BOX_RIGHT_LIGHT | BOX_BOTTOM_LIGHT,
- BOX_RIGHT_HEAVY | BOX_LEFT_LIGHT | BOX_BOTTOM_LIGHT,
- BOX_BOTTOM_LIGHT | BOX_HORIZONTAL_HEAVY,
- BOX_BOTTOM_HEAVY | BOX_HORIZONTAL_LIGHT,
- BOX_RIGHT_LIGHT | BOX_LEFT_HEAVY | BOX_BOTTOM_HEAVY,
- BOX_LEFT_LIGHT | BOX_RIGHT_HEAVY | BOX_BOTTOM_HEAVY,
- BOX_BOTTOM_HEAVY| BOX_HORIZONTAL_HEAVY,
- BOX_TOP_LIGHT | BOX_HORIZONTAL_LIGHT,
- BOX_LEFT_HEAVY | BOX_RIGHT_LIGHT | BOX_TOP_LIGHT,
- BOX_RIGHT_HEAVY | BOX_LEFT_LIGHT | BOX_TOP_LIGHT,
- BOX_TOP_LIGHT | BOX_HORIZONTAL_HEAVY,
- BOX_TOP_HEAVY | BOX_HORIZONTAL_LIGHT,
- BOX_RIGHT_LIGHT | BOX_LEFT_HEAVY | BOX_TOP_HEAVY,
- BOX_LEFT_LIGHT | BOX_RIGHT_HEAVY | BOX_TOP_HEAVY,
- BOX_TOP_HEAVY | BOX_HORIZONTAL_HEAVY,
- BOX_VERTICAL_LIGHT | BOX_HORIZONTAL_LIGHT,
- BOX_LEFT_HEAVY | BOX_RIGHT_LIGHT | BOX_VERTICAL_LIGHT,
- BOX_RIGHT_HEAVY | BOX_LEFT_LIGHT | BOX_VERTICAL_LIGHT,
- BOX_VERTICAL_LIGHT | BOX_HORIZONTAL_HEAVY,
- BOX_TOP_HEAVY | BOX_BOTTOM_LIGHT | BOX_HORIZONTAL_LIGHT,
- BOX_BOTTOM_HEAVY| BOX_TOP_LIGHT | BOX_HORIZONTAL_LIGHT,
- BOX_VERTICAL_HEAVY | BOX_HORIZONTAL_LIGHT,
- BOX_LEFT_HEAVY | BOX_RIGHT_LIGHT | BOX_TOP_HEAVY | BOX_BOTTOM_LIGHT,
- BOX_RIGHT_HEAVY | BOX_TOP_HEAVY | BOX_LEFT_LIGHT | BOX_BOTTOM_LIGHT,
- BOX_LEFT_HEAVY | BOX_BOTTOM_HEAVY | BOX_RIGHT_LIGHT | BOX_TOP_LIGHT,
- BOX_RIGHT_HEAVY | BOX_BOTTOM_HEAVY | BOX_LEFT_LIGHT | BOX_TOP_LIGHT,
- BOX_BOTTOM_LIGHT | BOX_TOP_HEAVY | BOX_HORIZONTAL_HEAVY,
- BOX_TOP_LIGHT | BOX_BOTTOM_HEAVY | BOX_HORIZONTAL_HEAVY,
- BOX_RIGHT_LIGHT | BOX_LEFT_HEAVY | BOX_VERTICAL_HEAVY,
- BOX_LEFT_LIGHT | BOX_RIGHT_HEAVY | BOX_VERTICAL_HEAVY,
- BOX_VERTICAL_HEAVY | BOX_HORIZONTAL_HEAVY,
-
- /* U+254C - U+2573 are handled elsewhere */
- 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- BOX_LEFT_LIGHT,
- BOX_TOP_LIGHT,
- BOX_RIGHT_LIGHT,
- BOX_BOTTOM_LIGHT,
- BOX_LEFT_HEAVY,
- BOX_TOP_HEAVY,
- BOX_RIGHT_HEAVY,
- BOX_BOTTOM_HEAVY,
- BOX_LEFT_LIGHT | BOX_RIGHT_HEAVY,
- BOX_TOP_LIGHT | BOX_BOTTOM_HEAVY,
- BOX_LEFT_HEAVY | BOX_RIGHT_LIGHT,
- BOX_TOP_HEAVY | BOX_BOTTOM_LIGHT
- };
- G_STATIC_ASSERT(G_N_ELEMENTS(map) == (0x257f - 0x250c + 1));
- const guint v = c - 0x250c;
- const guint8 m = map[v];
- int line_width;
-
- cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
-
- if (m & BOX_LEFT) {
- line_width = (m & BOX_LEFT_HEAVY) ? heavy_line_width : light_line_width;
- adjust = (line_width & 1) ? .5 : 0.;
- cairo_set_line_width(cr, line_width);
- cairo_move_to(cr, x, ycenter + adjust);
- cairo_line_to(cr, xcenter, ycenter + adjust);
- cairo_stroke(cr);
- }
- if (m & BOX_RIGHT) {
- line_width = (m & BOX_RIGHT_HEAVY) ? heavy_line_width : light_line_width;
- adjust = (line_width & 1) ? .5 : 0.;
- cairo_set_line_width(cr, line_width);
- cairo_move_to(cr, xcenter, ycenter + adjust);
- cairo_line_to(cr, xright, ycenter + adjust);
- cairo_stroke(cr);
- }
- if (m & BOX_TOP) {
- line_width = (m & BOX_TOP_HEAVY) ? heavy_line_width : light_line_width;
- adjust = (line_width & 1) ? .5 : 0.;
- cairo_set_line_width(cr, line_width);
- cairo_move_to(cr, xcenter + adjust, y);
- cairo_line_to(cr, xcenter + adjust, ycenter);
- cairo_stroke(cr);
- }
- if (m & BOX_BOTTOM) {
- line_width = (m & BOX_BOTTOM_HEAVY) ? heavy_line_width : light_line_width;
- adjust = (line_width & 1) ? .5 : 0.;
- cairo_set_line_width(cr, line_width);
- cairo_move_to(cr, xcenter + adjust, ycenter);
- cairo_line_to(cr, xcenter + adjust, ybottom);
- cairo_stroke(cr);
- }
-
- /* Make the join not look jagged */
- if ((m & BOX_HORIZONTAL) && (m & BOX_VERTICAL)) {
- int xs, ys, w, h;
-
- if (m & BOX_HORIZONTAL_HEAVY) {
- ys = ycenter - heavy_line_width / 2;
- h = heavy_line_width;
- } else {
- ys = ycenter - light_line_width / 2;
- h = light_line_width;
- }
- if (m & BOX_VERTICAL_HEAVY) {
- xs = xcenter - heavy_line_width / 2;
- w = heavy_line_width;
- } else {
- xs = xcenter - light_line_width / 2;
- w = light_line_width;
- }
- cairo_rectangle(cr, xs, ys, w, h);
- cairo_fill(cr);
- }
-
- break;
- }
-
case 0x2550: /* box drawings double horizontal */
case 0x2551: /* box drawings double vertical */
case 0x2552: /* box drawings down single and right double */
@@ -9906,147 +9668,105 @@ vte_terminal_draw_graphic(VteTerminal *terminal, vteunistr c,
case 0x256a: /* box drawings vertical single and horizontal double */
case 0x256b: /* box drawings vertical double and horizontal single */
case 0x256c: /* box drawings double vertical and horizontal */
+ case 0x2574: /* box drawings light left */
+ case 0x2575: /* box drawings light up */
+ case 0x2576: /* box drawings light right */
+ case 0x2577: /* box drawings light down */
+ case 0x2578: /* box drawings heavy left */
+ case 0x2579: /* box drawings heavy up */
+ case 0x257a: /* box drawings heavy right */
+ case 0x257b: /* box drawings heavy down */
+ case 0x257c: /* box drawings light left and heavy right */
+ case 0x257d: /* box drawings light up and heavy down */
+ case 0x257e: /* box drawings heavy left and light right */
+ case 0x257f: /* box drawings heavy up and light down */
{
- enum { BOX_LEFT_SINGLE = 1 << 0,
- BOX_LEFT_DOUBLE = 1 << 1,
- BOX_RIGHT_SINGLE = 1 << 2,
- BOX_RIGHT_DOUBLE = 1 << 3,
- BOX_TOP_SINGLE = 1 << 4,
- BOX_TOP_DOUBLE = 1 << 5,
- BOX_BOTTOM_SINGLE = 1 << 6,
- BOX_BOTTOM_DOUBLE = 1 << 7,
- BOX_LEFT = BOX_LEFT_SINGLE | BOX_LEFT_DOUBLE,
- BOX_RIGHT = BOX_RIGHT_SINGLE | BOX_RIGHT_DOUBLE,
- BOX_TOP = BOX_TOP_SINGLE | BOX_TOP_DOUBLE,
- BOX_BOTTOM = BOX_BOTTOM_SINGLE | BOX_BOTTOM_DOUBLE,
- BOX_SINGLE = BOX_LEFT_SINGLE | BOX_RIGHT_SINGLE | BOX_TOP_SINGLE |
BOX_BOTTOM_SINGLE,
- BOX_DOUBLE = BOX_LEFT_DOUBLE | BOX_RIGHT_DOUBLE | BOX_TOP_DOUBLE |
BOX_BOTTOM_DOUBLE,
- BOX_HORIZONTAL_SINGLE = BOX_LEFT_SINGLE | BOX_RIGHT_SINGLE,
- BOX_HORIZONTAL_DOUBLE = BOX_LEFT_DOUBLE | BOX_RIGHT_DOUBLE,
- BOX_VERTICAL_SINGLE = BOX_TOP_SINGLE | BOX_BOTTOM_SINGLE,
- BOX_VERTICAL_DOUBLE = BOX_TOP_DOUBLE | BOX_BOTTOM_DOUBLE
- };
- static const guint8 const map[] = {
- BOX_HORIZONTAL_DOUBLE,
- BOX_VERTICAL_DOUBLE,
- BOX_BOTTOM_SINGLE | BOX_RIGHT_DOUBLE,
- BOX_BOTTOM_DOUBLE | BOX_RIGHT_SINGLE,
- BOX_BOTTOM_DOUBLE | BOX_RIGHT_DOUBLE,
- BOX_BOTTOM_SINGLE | BOX_LEFT_DOUBLE,
- BOX_BOTTOM_DOUBLE | BOX_LEFT_SINGLE,
- BOX_BOTTOM_DOUBLE | BOX_LEFT_DOUBLE,
- BOX_TOP_SINGLE | BOX_RIGHT_DOUBLE,
- BOX_TOP_DOUBLE | BOX_RIGHT_SINGLE,
- BOX_TOP_DOUBLE | BOX_RIGHT_DOUBLE,
- BOX_TOP_SINGLE | BOX_LEFT_DOUBLE,
- BOX_TOP_DOUBLE | BOX_LEFT_SINGLE,
- BOX_TOP_DOUBLE | BOX_LEFT_DOUBLE,
- BOX_VERTICAL_SINGLE | BOX_RIGHT_DOUBLE,
- BOX_VERTICAL_DOUBLE | BOX_RIGHT_SINGLE,
- BOX_VERTICAL_DOUBLE | BOX_RIGHT_DOUBLE,
- BOX_VERTICAL_SINGLE | BOX_LEFT_DOUBLE,
- BOX_VERTICAL_DOUBLE | BOX_LEFT_SINGLE,
- BOX_VERTICAL_DOUBLE | BOX_LEFT_DOUBLE,
- BOX_BOTTOM_SINGLE | BOX_HORIZONTAL_DOUBLE,
- BOX_BOTTOM_DOUBLE | BOX_HORIZONTAL_SINGLE,
- BOX_BOTTOM_DOUBLE | BOX_HORIZONTAL_DOUBLE,
- BOX_TOP_SINGLE | BOX_HORIZONTAL_DOUBLE,
- BOX_TOP_DOUBLE | BOX_HORIZONTAL_SINGLE,
- BOX_TOP_DOUBLE | BOX_HORIZONTAL_DOUBLE,
- BOX_VERTICAL_SINGLE | BOX_HORIZONTAL_DOUBLE,
- BOX_VERTICAL_DOUBLE | BOX_HORIZONTAL_SINGLE,
- BOX_VERTICAL_DOUBLE | BOX_HORIZONTAL_DOUBLE
- };
- G_STATIC_ASSERT(G_N_ELEMENTS(map) == (0x256c - 0x2550 + 1));
- const guint v = c - 0x2550;
- const guint8 m = map[v];
- int line_width;
- int double_line_width, half_double_line_width, half_double_line_width_plus_1;
- int inner_line_width;
+ guint32 bitmap = _vte_box_drawing_bitmaps[c - 0x2500];
+ int xboundaries[6] = { 0,
+ left_half - heavy_line_width / 2,
+ left_half - light_line_width / 2,
+ left_half - light_line_width / 2 + light_line_width,
+ left_half - heavy_line_width / 2 + heavy_line_width,
+ terminal->char_width};
+ int yboundaries[6] = { 0,
+ upper_half - heavy_line_width / 2,
+ upper_half - light_line_width / 2,
+ upper_half - light_line_width / 2 + light_line_width,
+ upper_half - heavy_line_width / 2 + heavy_line_width,
+ terminal->char_height};
+ int xi, yi;
+ cairo_set_line_width(cr, 0);
+ for (yi = 4; yi >= 0; yi--) {
+ for (xi = 4; xi >= 0; xi--) {
+ if (bitmap & 1) {
+ cairo_rectangle(cr,
+ x + xboundaries[xi],
+ y + yboundaries[yi],
+ xboundaries[xi + 1] - xboundaries[xi],
+ yboundaries[yi + 1] - yboundaries[yi]);
+ cairo_fill(cr);
+ }
+ bitmap >>= 1;
+ }
+ }
+ break;
+ }
- cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
+ case 0x2504: /* box drawings light triple dash horizontal */
+ case 0x2505: /* box drawings heavy triple dash horizontal */
+ case 0x2506: /* box drawings light triple dash vertical */
+ case 0x2507: /* box drawings heavy triple dash vertical */
+ case 0x2508: /* box drawings light quadruple dash horizontal */
+ case 0x2509: /* box drawings heavy quadruple dash horizontal */
+ case 0x250a: /* box drawings light quadruple dash vertical */
+ case 0x250b: /* box drawings heavy quadruple dash vertical */
+ case 0x254c: /* box drawings light double dash horizontal */
+ case 0x254d: /* box drawings heavy double dash horizontal */
+ case 0x254e: /* box drawings light double dash vertical */
+ case 0x254f: /* box drawings heavy double dash vertical */
+ {
+ const guint v = c - 0x2500;
+ int size, line_width;
- double_line_width = MAX (heavy_line_width, 3);
- half_double_line_width = double_line_width / 2;
- half_double_line_width_plus_1 = (double_line_width + 1) / 2;
- inner_line_width = double_line_width / 3;
- adjust = (inner_line_width & 1) ? .5 : 0.;
+ size = (v & 2) ? row_height : width;
- if (m & BOX_LEFT) {
- line_width = (m & BOX_LEFT_DOUBLE) ? double_line_width: light_line_width;
- adjust = (line_width & 1) ? .5 : 0.;
- cairo_set_line_width(cr, line_width);
- cairo_move_to(cr, x, ycenter + adjust);
- cairo_line_to(cr,
- (m & BOX_VERTICAL_DOUBLE) ? xcenter + half_double_line_width_plus_1:
xcenter,
- ycenter + adjust);
- cairo_stroke(cr);
+ switch (v >> 2) {
+ case 1: /* triple dash */
+ {
+ double segment = size / 8.;
+ double dashes[2] = { segment * 2., segment };
+ cairo_set_dash(cr, dashes, G_N_ELEMENTS(dashes), 0.);
+ break;
}
- if (m & BOX_RIGHT) {
- line_width = (m & BOX_RIGHT_DOUBLE) ? double_line_width: light_line_width;
- adjust = (line_width & 1) ? .5 : 0.;
- cairo_set_line_width(cr, line_width);
- cairo_move_to(cr,
- (m & BOX_VERTICAL_DOUBLE) ? xcenter - half_double_line_width: xcenter,
- ycenter + adjust);
- cairo_line_to(cr, xright, ycenter + adjust);
- cairo_stroke(cr);
+ case 2: /* quadruple dash */
+ {
+ double segment = size / 11.;
+ double dashes[2] = { segment * 2., segment };
+ cairo_set_dash(cr, dashes, G_N_ELEMENTS(dashes), 0.);
+ break;
}
- if (m & BOX_TOP) {
- line_width = (m & BOX_TOP_DOUBLE) ? double_line_width: light_line_width;
- adjust = (line_width & 1) ? .5 : 0.;
- cairo_set_line_width(cr, line_width);
- cairo_move_to(cr, xcenter + adjust, y);
- cairo_line_to(cr,
- xcenter + adjust,
- (m & BOX_HORIZONTAL_DOUBLE) ? ycenter + half_double_line_width_plus_1
: ycenter);
- cairo_stroke(cr);
+ case 19: /* double dash */
+ {
+ double segment = size / 5.;
+ double dashes[2] = { segment * 2., segment };
+ cairo_set_dash(cr, dashes, G_N_ELEMENTS(dashes), 0.);
+ break;
}
- if (m & BOX_BOTTOM) {
- line_width = (m & BOX_BOTTOM_DOUBLE) ? double_line_width: light_line_width;
- adjust = (line_width & 1) ? .5 : 0.;
- cairo_set_line_width(cr, line_width);
- cairo_move_to(cr,
- xcenter + adjust,
- (m & BOX_HORIZONTAL_DOUBLE) ? ycenter - half_double_line_width :
ycenter);
- cairo_line_to(cr, xcenter + adjust, ybottom);
- cairo_stroke(cr);
}
- /* Now take the inside out */
- cairo_set_source_rgba (cr,
- bg.red / 65535.,
- bg.green / 65535.,
- bg.blue / 65535.,
- 1.);
- cairo_set_line_width(cr, inner_line_width);
- cairo_set_line_join(cr, CAIRO_LINE_JOIN_MITER);
-
- if (m & BOX_VERTICAL_DOUBLE) {
- if (m & BOX_TOP) {
- cairo_move_to(cr, xcenter + adjust, y);
- cairo_line_to(cr, xcenter + adjust, ycenter);
- } else {
- cairo_move_to(cr, xcenter + adjust, ycenter);
- }
- if (m & BOX_BOTTOM) {
- cairo_line_to(cr, xcenter + adjust, ybottom);
- }
- cairo_stroke(cr);
- }
- if (m & BOX_HORIZONTAL_DOUBLE) {
- if (m & BOX_LEFT) {
- cairo_move_to(cr, x, ycenter + adjust);
- cairo_line_to(cr, xcenter, ycenter + adjust);
- } else {
- cairo_move_to(cr, xcenter, ycenter + adjust);
- }
- if (m & BOX_RIGHT) {
- cairo_line_to(cr, xright, ycenter + adjust);
- }
- cairo_stroke(cr);
- }
+ line_width = (v & 1) ? heavy_line_width : light_line_width;
+ adjust = (line_width & 1) ? .5 : 0.;
+ cairo_set_line_width(cr, line_width);
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
+ if (v & 2) {
+ cairo_move_to(cr, xcenter + adjust, y);
+ cairo_line_to(cr, xcenter + adjust, y + row_height);
+ } else {
+ cairo_move_to(cr, x, ycenter + adjust);
+ cairo_line_to(cr, x + width, ycenter + adjust);
+ }
+ cairo_stroke(cr);
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]