+ free(scratch);
+}
+
+void appearance_minsize(Appearance *l, int *w, int *h)
+{
+ int i;
+ *w = *h = 1;
+
+ switch (l->surface.type) {
+ case Surface_Planar:
+ if (l->surface.data.planar.relief != Flat) {
+ switch (l->surface.data.planar.bevel) {
+ case Bevel1:
+ *w = *h = 2;
+ break;
+ case Bevel2:
+ *w = *h = 4;
+ break;
+ }
+ } else if (l->surface.data.planar.border)
+ *w = *h = 2;
+
+ for (i = 0; i < l->textures; ++i)
+ switch (l->texture[i].type) {
+ case Bitmask:
+ *w += l->texture[i].data.mask.mask->w;
+ *h += l->texture[i].data.mask.mask->h;
+ break;
+ case Text:
+ *w +=font_measure_string(l->texture[i].data.text.font,
+ l->texture[i].data.text.string,
+ l->texture[i].data.text.shadow,
+ l->texture[i].data.text.offset);
+ *h += font_height(l->texture[i].data.text.font,
+ l->texture[i].data.text.shadow,
+ l->texture[i].data.text.offset);
+ break;
+ case RGBA:
+ *w += l->texture[i].data.rgba.width;
+ *h += l->texture[i].data.rgba.height;
+ break;
+ case NoTexture:
+ break;
+ }
+ break;
+ }