shithub: riscv

Download patch

ref: 3504122012e3f7ee778efa048e462510619c13b4
parent: 4e5f39796d548fc1b530ae87e25f2db0830b5851
author: Russ Cox <rsc@swtch.com>
date: Sat Jul 18 19:52:58 EDT 2020

acme: add font control message

--- a/sys/man/4/acme
+++ b/sys/man/4/acme
@@ -31,7 +31,7 @@
 windows.
 Some of them are virtual versions of system files for dealing
 with the virtual console; others control operations
-of 
+of
 .I acme
 itself.
 When a command is run under
@@ -252,6 +252,11 @@
 Equivalent to the
 .B Get
 interactive command with no arguments; accepts no arguments.
+.TP
+.BI font " path
+Equivalent to the
+.B Font
+interactive command with a single (required) argument.
 .TP
 .B limit=addr
 When the
--- a/sys/src/cmd/acme/xfid.c
+++ b/sys/src/cmd/acme/xfid.c
@@ -664,6 +664,24 @@
 			winsetname(w, r, nr);
 			m += (q+1) - pp;
 		}else
+		if(strncmp(p, "font ", 5) == 0){		/* execute font command */
+			pp = p+5;
+			m = 5;
+			q = memchr(pp, '\n', e-pp);
+			if(q==nil || q==pp){
+				err = Ebadctl;
+				break;
+			}
+			*q = 0;
+			nulls = FALSE;
+			cvttorunes(pp, q-pp, r, &nb, &nr, &nulls);
+			if(nulls){
+				err = "nulls in font string";
+				break;
+			}
+			fontx(&w->body, nil, nil, FALSE, XXX, r, nr);
+			m += (q+1) - pp;
+		}else
 		if(strncmp(p, "dump ", 5) == 0){	/* set dump string */
 			pp = p+5;
 			m = 5;