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