static void
pdf_load_substitute_cjk_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname, int ros, int serif)
{
	unsigned char *data;
	unsigned int len;

	data = pdf_lookup_substitute_cjk_font(ros, serif, &len);
	if (!data)
		fz_throw(ctx, "cannot find builtin CJK font");

	/* a glyph bbox cache is too big for droid sans fallback (51k glyphs!) */
	fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, 0, 0);

	fontdesc->font->ft_substitute = 1;
}
Beispiel #2
0
static void
pdf_load_substitute_cjk_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname, int ros, int serif)
{
	fontdesc->font = fz_load_system_cjk_font(ctx, fontname, ros, serif);
	if (!fontdesc->font)
	{
		unsigned char *data;
		unsigned int len;
		int index;

		data = pdf_lookup_substitute_cjk_font(ros, serif, fontdesc->wmode, &len, &index);
		if (!data)
			fz_throw(ctx, FZ_ERROR_GENERIC, "cannot find builtin CJK font");

		/* A glyph bbox cache is too big for CJK fonts. */
		fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, index, 0);
	}

	fontdesc->font->ft_substitute = 1;
}