#include #include #include "style.h" #include "stylesheet.h" #include "frame.h" InlineStyleInfo * inlinestyleinfo_new(Frame *f) { InlineStyleInfo *p; if ((p = malloc(sizeof(*p))) == NULL) { perror("inlinestyleinfo_new"); exit(1); } if (f->pinfo) { p->size = f->pinfo->istyle->size; p->fonttype = f->pinfo->istyle->fonttype; p->oc = f->pinfo->istyle->oc; p->pixel = f->pinfo->istyle->pixel; } else { p->size = f->basefont - 1; p->fonttype = FONTTYPE_NORMAL; p->oc = f->font[p->fonttype][p->size]; p->pixel = f->foreground; } p->next = NULL; return p; } void inlinestyleinfo_delete(InlineStyleInfo *p) { if (p) free(p); } void inlinestyleinfo_setcolor(Frame *f, InlineStyleInfo *s, char *name) { if (name) frame_alloc_color(f, name, &s->pixel); } void inlinestyleinfo_setsize(Frame *f, InlineStyleInfo *s, int size) { s->size = size; s->oc = f->font[s->fonttype][s->size]; } void inlinestyleinfo_setfonttype(Frame *f, InlineStyleInfo *s, int type) { if (s->fonttype < FONTTYPE_PRE && type < FONTTYPE_PRE) s->fonttype |= type; else s->fonttype = type; /* fprintf(stderr, "fonttype: %d\n", s->fonttype);*/ s->oc = f->font[s->fonttype][s->size]; } BlockStyleInfo * blockstyleinfo_new(void) { BlockStyleInfo *p; if ((p = malloc(sizeof(*p))) == NULL) { perror("blockstyleinfo_new"); exit(1); } return p; } void blockstyleinfo_delete(BlockStyleInfo *p) { if (p) free(p); }