plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

commit dfbafb68e22de866ab0a708862230acbac50910a
parent 65c090346a38a8c30cb242d345aa71060116340c
Author: matheuristic <matheuristic@users.noreply.github.com>
Date:   Mon,  4 Sep 2023 13:47:37 -0400

acme: have Dump save both low and high DPI fontnames

Instead of only saving a window's currently displayed font's name to the
dump file, have Acme's Dump command save that window's combined low DPI
and high DPI font names when both are available.

See 9fans/plan9port#630

Diffstat:
Msrc/cmd/acme/rows.c | 17+++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/cmd/acme/rows.c b/src/cmd/acme/rows.c @@ -319,7 +319,7 @@ rowdump(Row *row, char *file) int i, j, fd, m, n, start, dumped; uint q0, q1; Biobuf *b; - char *buf, *a, *fontname; + char *buf, *a, *fontname, *fontfmt, *fontnamelo, *fontnamehi; Rune *r; Column *c; Window *w, *w1; @@ -394,9 +394,17 @@ rowdump(Row *row, char *file) if(w1->nopen[QWevent]) goto Continue2; } - fontname = ""; - if(t->reffont->f != font) - fontname = t->reffont->f->name; + fontfmt = "%s"; + fontnamelo = ""; + fontnamehi = nil; + if(t->reffont->f != font){ + fontnamelo = t->reffont->f->lodpi->name; + if(t->reffont->f->hidpi != nil){ + fontfmt = "%s,%s"; + fontnamehi = t->reffont->f->hidpi->name; + } + } + fontname = smprint(fontfmt, fontnamelo, fontnamehi); if(t->file->nname) a = runetobyte(t->file->name, t->file->nname); else @@ -428,6 +436,7 @@ rowdump(Row *row, char *file) 100.0*(w->r.min.y-c->r.min.y)/Dy(c->r), w->body.file->b.nc, fontname); } + free(fontname); free(a); winctlprint(w, buf, 0); Bwrite(b, buf, strlen(buf));