static void set_layout(GnmStyle * style,const psiconv_sheet_cell_layout psi_layout) { GnmColor *color; set_format(style,psi_layout->numberformat); gnm_style_set_font_size(style,psi_layout->character->font_size); gnm_style_set_font_italic(style,psi_layout->character->italic?TRUE:FALSE); gnm_style_set_font_bold(style,psi_layout->character->bold?TRUE:FALSE); gnm_style_set_font_uline(style, psi_layout->character->underline?TRUE:FALSE); gnm_style_set_font_strike(style, psi_layout->character->strikethrough?TRUE:FALSE); gnm_style_set_font_name(style, (const char *) psi_layout->character->font->name); color = get_color(psi_layout->character->color); if (color) gnm_style_set_font_color (style, color); /* TODO: Character level layouts: super_sub */ /* TODO: Paragraph level layouts: all */ /* TODO: Background color: add transparant if white */ #if 0 color = get_color(psi_layout->paragraph->back_color); if (color) { gnm_style_set_back_color(style, color); gnm_style_set_pattern_color(style, color); /* TODO: Replace 24 with some symbol */ gnm_style_set_pattern(style,1); } #endif }
static gboolean sylk_rtd_p_parse (SylkReader *state, char *str) { char *next; int font_size; GnmStyle *font = NULL; for (; *str != '\0' ; str = next) { next = sylk_next_token (str); switch (*str) { case 'P' : /* format */ g_ptr_array_add (state->formats, go_format_new_from_XL (str+1)); break; case 'F' : /* some sort of global font name */ break; case 'E' : /* font name */ if (str[1] != '\0') { if (NULL == font) font = gnm_style_new (); gnm_style_set_font_name (font, str+1); } break; case 'L' : /* font color ? */ break; case 'M' : /* font size * 20 */ if (sylk_parse_int (str+1, &font_size) && font_size > 0) { if (NULL == font) font = gnm_style_new (); gnm_style_set_font_size (font, font_size / 20.0); } break; case 'S' : for (str++ ; *str && *str != ';' ; str++) switch (*str) { case 'I': if (NULL == font) font = gnm_style_new (); gnm_style_set_font_italic (font, TRUE); break; case 'B': if (NULL == font) font = gnm_style_new (); gnm_style_set_font_bold (font, TRUE); break; } break; default : sylk_read_warning (state, "unknown P option '%c'", *str); } } if (NULL != font) g_ptr_array_add (state->fonts, font); return TRUE; }