[cairo] [patch] type1 fonts support lenIV; type1 parse_charstring stack management fix

Adrian Johnson ajohnson at redneon.com
Sat Oct 6 23:06:19 PDT 2012


On 03/10/12 10:39, David Maxwell wrote:
> cairo_type1_font_subset_write_private_dict  assumed that the font's
> lenIV (which defines the number of random characters at the start of
> each charstring) is 4.  But it need not be: MinionPro uses 0.
> Failure to use the correct lenIV prevents detection of glyph widths,
> which leads to an incorrect /Widths array for the font in PDF output,
> which leads to incorrect spacing at final rendering.
> 
> cairo_type1_font_subset_parse_charstring did not handle the stack
> correctly when calling a subroutine.

Thanks for the patch. As these are two separate bugs they should be in
separate patches. I've split the patch and pushed them with some white
space fixes.

> @@ -778,6 +780,12 @@ cairo_type1_font_subset_parse_charstring
> (cairo_type1_font_subset_t *font, font->build_stack.top_value <
> font->num_subrs) { subr_num = font->build_stack.top_value; +
>  +            font->build_stack.sp--; +
> if(font->build_stack.sp>0) { +
> font->build_stack.top_value =
> font->build_stack.stack[font->build_stack.sp-1];

Setting the top_value is not required since last_op_was_integer is set
to false. I removed this line from the patch.

> +            } + font->subrs[subr_num].used = TRUE; 
> last_op_was_integer = FALSE; status =
> cairo_type1_font_subset_parse_charstring (font,



More information about the cairo mailing list