# HG changeset patch # User Ka-Hing Cheung # Date 1229296287 0 # Node ID da1a76d4b7da3d8539a8f9eb5cf6dfa600dd537e # Parent 959d7fa3038b7ff054ded4bbdba599fa508b735b# Parent 974619c83bc77f579821245716792fc77a99695f merge of '2b2413559685df17d16670e7769c19d61235fc28' and '8b034c35a9f2c21bf8518d26554e162075186c07' diff -r 974619c83bc7 -r da1a76d4b7da libpurple/protocols/myspace/markup.c --- a/libpurple/protocols/myspace/markup.c Sun Dec 14 22:01:15 2008 +0000 +++ b/libpurple/protocols/myspace/markup.c Sun Dec 14 23:11:27 2008 +0000 @@ -81,7 +81,9 @@ * 1 2 3 4 5 6 7 */ static gdouble _font_scale[] = { .85, .95, 1, 1.2, 1.44, 1.728, 2.0736 }; -#define MAX_FONT_SIZE 7 /* Purple maximum font size */ +/* Purple maximum font size. Equivalent to sizeof(_font_scale) / sizeof(_font_scale[0]) */ +#define MAX_FONT_SIZE 7 + #define POINTS_PER_INCH 72 /* How many pt's in an inch */ /* Text formatting bits for */ @@ -116,15 +118,11 @@ msim_point_to_purple_size(MsimSession *session, guint point) { guint size, this_point, base; - gdouble scale; base = purple_account_get_int(session->account, "base_font_size", MSIM_BASE_FONT_POINT_SIZE); - for (size = 0; - size < sizeof(_font_scale) / sizeof(_font_scale[0]); - ++size) { - scale = _font_scale[CLAMP(size, 1, MAX_FONT_SIZE) - 1]; - this_point = (guint)msim_round(scale * base); + for (size = 0; size < MAX_FONT_SIZE; ++size) { + this_point = (guint)msim_round(base * _font_scale[size]); if (this_point >= point) { purple_debug_info("msim", "msim_point_to_purple_size: %d pt -> size=%d\n",