Index: trunk/src/font.c =================================================================== --- trunk/src/font.c (revision 7022) +++ trunk/src/font.c (revision 7023) @@ -212,6 +212,9 @@ if (id == 0) return NULL; + if (id < 0) + id = fk->last_id + 1; + hash_setup(fk); /* do not attempt to overwrite/reuse existing font of the same ID, rather report error */ @@ -224,6 +227,9 @@ f->name = pcb_strdup(name); f->id = id; + if (f->id > fk->last_id) + fk->last_id = f->id; + return f; } @@ -248,4 +254,5 @@ htip_uninit(&fk->fonts); fk->hash_inited = 0; } + fk->last_id = 0; } Index: trunk/src/font.h =================================================================== --- trunk/src/font.h (revision 7022) +++ trunk/src/font.h (revision 7023) @@ -57,6 +57,7 @@ pcb_font_t dflt; /* default, fallback font, also the sysfont */ htip_t fonts; pcb_bool valid, hash_inited; + pcb_font_id_t last_id; /* highest font id ever seen in this kit */ }; /* Look up font. If not found: Return NULL (fallback=0), or return the