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
This commit is contained in:
matheuristic 2023-09-04 13:47:37 -04:00 committed by Dan Cross
parent 65c090346a
commit dfbafb68e2

View file

@ -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));