1. Trammell Hudson
  2. pebble

Commits

Trammell Hudson  committed 43494bf

Only call fonts_load_custom_font() once per font

  • Participants
  • Parent commits d321992
  • Branches default

Comments (0)

Files changed (1)

File words/src/words.c

View file
  • Ignore whitespace
 #define FONT_W 12
 #define FONT_ON		RESOURCE_ID_FONT_COURIER_BOLD_20
 #define FONT_OFF	RESOURCE_ID_FONT_COURIER_20
-
+static GFont font_on;
+static GFont font_off;
 
 typedef struct
 {
 
 	text_layer_set_font(
 		layer,
-		fonts_load_custom_font(resource_get_handle(on ? FONT_ON : FONT_OFF))
+		on ? font_on : font_off
 	);
 }
 
 	TextLayer * const layer = &layers[which];
 	const word_t * const w = &words[which];
 
+	font_on = fonts_load_custom_font(resource_get_handle(FONT_ON));
+	font_off = fonts_load_custom_font(resource_get_handle(FONT_OFF));
+
 	GRect frame = GRect(
 		w->col*FONT_W,
 		w->row*FONT_H - 4,