Example #1
0
void
fz_dropfont(fz_font *font)
{
	int fterr;
	int i;

	if (font && --font->refs == 0)
	{
		if (font->t3procs)
		{
			for (i = 0; i < 256; i++)
				if (font->t3procs[i])
					fz_droptree(font->t3procs[i]);
			{ /* HACK: make sure the static pixmap is freed through a dummy call */
				fz_glyph glyph; fz_matrix tmr = { 0 };
				font->t3procs[0] = nil;
				fz_rendert3glyph(&glyph, font, 0, tmr);
			}
			fz_free(font->t3procs);
			fz_free(font->t3widths);
		}

		if (font->ftface)
		{
			fterr = FT_Done_Face((FT_Face)font->ftface);
			if (fterr)
				fz_warn("freetype finalizing face: %s", ft_errorstring(fterr));
			fz_finalizefreetype();
		}

		fz_free(font);
	}
}
void
fz_dropfont(fz_font *font)
{
	int fterr;
	int i;

	if (font && --font->refs == 0)
	{
		if (font->t3procs)
		{
			if (font->t3resources)
				fz_dropobj(font->t3resources);
			for (i = 0; i < 256; i++)
				if (font->t3procs[i])
					fz_dropbuffer(font->t3procs[i]);
			fz_free(font->t3procs);
			fz_free(font->t3widths);
		}

		if (font->ftface)
		{
			fterr = FT_Done_Face((FT_Face)font->ftface);
			if (fterr)
				fz_warn("freetype finalizing face: %s", ft_errorstring(fterr));
			fz_finalizefreetype();
		}

		if (font->widthtable)
			fz_free(font->widthtable);

		fz_free(font);
	}
}