changeset 24678:da1a76d4b7da

merge of '2b2413559685df17d16670e7769c19d61235fc28' and '8b034c35a9f2c21bf8518d26554e162075186c07'
author Ka-Hing Cheung <khc@hxbc.us>
date Sun, 14 Dec 2008 23:11:27 +0000
parents 959d7fa3038b (diff) 974619c83bc7 (current diff)
children c09a647fd538 fbb239fc7396 ae77e98f42ba
files
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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 <f s=#> */
@@ -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",