DviFont *font;
font = ref->ref;
- xfree(ref);
+ mdvi_free(ref);
/* drop all children */
for(ref = font->subfonts; ref; ref = ref->next) {
/* just adjust the reference counts */
/* get rid of subfonts (but can't use `drop_chain' here) */
for(; (ref = font->subfonts); ) {
font->subfonts = ref->next;
- xfree(ref);
+ mdvi_free(ref);
}
/* remove this font */
font_reset_font_glyphs(dev, font, MDVI_FONTSEL_GLYPH);
font->finfo->freedata(font);
/* destroy characters */
if(font->chars)
- xfree(font->chars);
- xfree(font->fontname);
- xfree(font->filename);
- xfree(font);
+ mdvi_free(font->chars);
+ mdvi_free(font->fontname);
+ mdvi_free(font->filename);
+ mdvi_free(font);
}
DEBUG((DBG_FONTS, "%d unused fonts removed\n", count));
return count;
{
DviFont *font;
DviFontRef *ref;
+ DviFontRef *subfont_ref;
/* see if there is a font with the same characteristics */
for(font = (DviFont *)fontlist.head; font; font = font->next) {
}
ref = xalloc(DviFontRef);
ref->ref = font;
+
font->links++;
+ for(subfont_ref = font->subfonts; subfont_ref; subfont_ref = subfont_ref->next) {
+ /* just adjust the reference counts */
+ subfont_ref->ref->links++;
+ }
+
ref->fontid = id;
if(LIST(font) != fontlist.head) {