popup: use system fonts exclusively

This commit is contained in:
2026-08-14 15:17:00 +09:00
parent 54355b8190
commit 08369e718e
14 changed files with 34 additions and 116 deletions

25
font.c
View File

@@ -43,37 +43,14 @@ setfont(void)
}
int
textinit(char **path, int npath)
textinit(void)
{
GError *err;
int i;
textclear();
if(path == nil || npath < 1 || npath > Maxfonts){
fprint(2, "strans: popup: need 1-%d font files\n", Maxfonts);
return 0;
}
fontmap = pango_cairo_font_map_new();
if(fontmap == nil){
fprint(2, "strans: popup: can't initialize PangoCairo\n");
return 0;
}
for(i = 0; i < npath; i++){
if(path[i] == nil){
fprint(2, "strans: popup: invalid font file\n");
textclear();
return 0;
}
err = nil;
if(!pango_font_map_add_font_file(fontmap, path[i], &err)){
fprint(2, "strans: popup: can't register font: %s: %s\n",
path[i], err == nil ? "unknown error" : err->message);
if(err != nil)
g_error_free(err);
textclear();
return 0;
}
}
pango_cairo_font_map_set_resolution(PANGO_CAIRO_FONT_MAP(fontmap), 96);
context = pango_font_map_create_context(fontmap);
if(context != nil)