diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2012-04-06 09:23:50 +0930 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2012-04-06 09:23:50 +0930 |
commit | a6d955fcc46ae2da8d6f3b2cadeae64c03066461 (patch) | |
tree | 640538d87eea3bbb63eed96b2ba893a7e2c5a00b /src | |
parent | 70b2856ed3d31b41e69b3d82fb9c5c11c2b3d3d4 (diff) |
fix indentation in cairo_type1_font_subset_parse_charstring
Diffstat (limited to 'src')
-rw-r--r-- | src/cairo-type1-subset.c | 147 |
1 files changed, 74 insertions, 73 deletions
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c index ba1008a1..ddef8aec 100644 --- a/src/cairo-type1-subset.c +++ b/src/cairo-type1-subset.c @@ -1,3 +1,4 @@ +/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ /* cairo - a vector graphics library with display and print output * * Copyright © 2006 Red Hat, Inc @@ -750,86 +751,79 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font, if (*p < 32) { command = *p++; switch (command) { - case TYPE1_CHARSTRING_COMMAND_HSBW: - if (! last_op_was_integer) - return CAIRO_INT_STATUS_UNSUPPORTED; + case TYPE1_CHARSTRING_COMMAND_HSBW: + if (! last_op_was_integer) + return CAIRO_INT_STATUS_UNSUPPORTED; + + font->glyphs[glyph].width = font->build_stack.stack[1]/font->base.units_per_em; + font->build_stack.sp = 0; + last_op_was_integer = FALSE; + break; + + case TYPE1_CHARSTRING_COMMAND_CALLSUBR: + if (font->subset_subrs && + last_op_was_integer && + font->build_stack.top_value >= 0 && + font->build_stack.top_value < font->num_subrs) + { + subr_num = font->build_stack.top_value; + font->subrs[subr_num].used = TRUE; + last_op_was_integer = FALSE; + status = cairo_type1_font_subset_parse_charstring (font, + glyph, + font->subrs[subr_num].subr_string, + font->subrs[subr_num].subr_length); + } else { + font->subset_subrs = FALSE; + } + break; + + case TYPE1_CHARSTRING_COMMAND_ESCAPE: + command = command << 8 | *p++; + switch (command) { + case TYPE1_CHARSTRING_COMMAND_SEAC: + /* The seac command takes five integer arguments. The + * last two are glyph indices into the PS standard + * encoding give the names of the glyphs that this + * glyph is composed from. All we need to do is to + * make sure those glyphs are present in the subset + * under their standard names. */ + status = use_standard_encoding_glyph (font, font->build_stack.stack[3]); + if (unlikely (status)) + return status; + + status = use_standard_encoding_glyph (font, font->build_stack.stack[4]); + if (unlikely (status)) + return status; - font->glyphs[glyph].width = font->build_stack.stack[1]/font->base.units_per_em; font->build_stack.sp = 0; last_op_was_integer = FALSE; break; - case TYPE1_CHARSTRING_COMMAND_CALLSUBR: - if (font->subset_subrs && - last_op_was_integer && - font->build_stack.top_value >= 0 && - font->build_stack.top_value < font->num_subrs) - { - subr_num = font->build_stack.top_value; - font->subrs[subr_num].used = TRUE; - last_op_was_integer = FALSE; - status = cairo_type1_font_subset_parse_charstring (font, - glyph, - font->subrs[subr_num].subr_string, - font->subrs[subr_num].subr_length); - } else { - font->subset_subrs = FALSE; - } + case TYPE1_CHARSTRING_COMMAND_SBW: + if (! last_op_was_integer) + return CAIRO_INT_STATUS_UNSUPPORTED; + + font->glyphs[glyph].width = font->build_stack.stack[2]/font->base.units_per_em; + font->build_stack.sp = 0; + last_op_was_integer = FALSE; break; - case TYPE1_CHARSTRING_COMMAND_ESCAPE: - command = command << 8 | *p++; - switch (command) { - case TYPE1_CHARSTRING_COMMAND_SEAC: - /* The seac command takes five integer arguments. The - * last two are glyph indices into the PS standard - * encoding give the names of the glyphs that this - * glyph is composed from. All we need to do is to - * make sure those glyphs are present in the subset - * under their standard names. */ - status = use_standard_encoding_glyph (font, font->build_stack.stack[3]); - if (unlikely (status)) - return status; - - status = use_standard_encoding_glyph (font, font->build_stack.stack[4]); - if (unlikely (status)) - return status; - - font->build_stack.sp = 0; - last_op_was_integer = FALSE; - break; - - case TYPE1_CHARSTRING_COMMAND_SBW: - if (! last_op_was_integer) - return CAIRO_INT_STATUS_UNSUPPORTED; - - font->glyphs[glyph].width = font->build_stack.stack[2]/font->base.units_per_em; - font->build_stack.sp = 0; - last_op_was_integer = FALSE; - break; - - case TYPE1_CHARSTRING_COMMAND_CALLOTHERSUBR: - for (i = 0; i < font->build_stack.sp; i++) - font->ps_stack.other_subr_args[i] = font->build_stack.stack[i]; - font->ps_stack.num_other_subr_args = font->build_stack.sp; - font->ps_stack.cur_other_subr_arg = 0; - font->build_stack.sp = 0; - last_op_was_integer = FALSE; - break; - - case TYPE1_CHARSTRING_COMMAND_POP: - if (font->ps_stack.num_other_subr_args > font->ps_stack.cur_other_subr_arg) { - font->build_stack.top_value = font->ps_stack.other_subr_args[font->ps_stack.cur_other_subr_arg++]; - last_op_was_integer = TRUE; - } else { - font->subset_subrs = FALSE; - } - break; - - default: - font->build_stack.sp = 0; - last_op_was_integer = FALSE; - break; + case TYPE1_CHARSTRING_COMMAND_CALLOTHERSUBR: + for (i = 0; i < font->build_stack.sp; i++) + font->ps_stack.other_subr_args[i] = font->build_stack.stack[i]; + font->ps_stack.num_other_subr_args = font->build_stack.sp; + font->ps_stack.cur_other_subr_arg = 0; + font->build_stack.sp = 0; + last_op_was_integer = FALSE; + break; + + case TYPE1_CHARSTRING_COMMAND_POP: + if (font->ps_stack.num_other_subr_args > font->ps_stack.cur_other_subr_arg) { + font->build_stack.top_value = font->ps_stack.other_subr_args[font->ps_stack.cur_other_subr_arg++]; + last_op_was_integer = TRUE; + } else { + font->subset_subrs = FALSE; } break; @@ -837,6 +831,13 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font, font->build_stack.sp = 0; last_op_was_integer = FALSE; break; + } + break; + + default: + font->build_stack.sp = 0; + last_op_was_integer = FALSE; + break; } } else { /* integer argument */ |