Style_set_text_font not working

Working in keil IDE on stm32H7 mcu
lvgl v 7.10
and cant change font.

in conf.h ive set #define LV_FONT_MONTSERRAT_26 1


global:
extern lv_font_t lv_font_montserrat_26;
static lv_style_t label_style;
static lv_style_t* labelstyle_pointer=&label_style;


style init code :
void init_label_style(void)
{
lv_style_init(labelstyle_pointer);
lv_style_set_text_font(labelstyle_pointer,LV_STATE_DEFAULT,&lv_font_montserrat_26);
}


label init code:
lv_obj_t* sample_label= lv_label_create(lv_scr_act(), NULL);
// lv_obj_align(sample_label, NULL, LV_ALIGN_IN_TOP_MID, -50, 0);
lv_label_set_align(sample_label, LV_LABEL_ALIGN_CENTER);
lv_label_set_text(sample_label, “sometext”);
lv_obj_add_style( sample_label, LV_OBJ_PART_MAIN,labelstyle_pointer);`


so compiler tells me that there are no problems at all (definition seems fine)
but default font seems used.
i still didnt understand if i should declare lv_style_t object in globals or not. (For example for simple lv objects i need only pointer variable)

so can someone tell me what i am douing wrong?
Also compiler is not makefile that comes with library. standard keil arm compiler is in use.

The way that the pointer is created and passed looks a bit over done, but should work. In my code I declare the style static not global but should have the same effect. But should you not first add the style and then set the text? Maybe that will help.

static lv_style_t* stylepointer;
lv_style_init(stylepointer);
  
lv_style_set_text_font(stylepointer,LV_STATE_DEFAULT,&lv_font_montserrat_26);
lv_style_set_shadow_color(stylepointer,LV_STATE_DEFAULT,LV_COLOR_YELLOW);

	lv_obj_t* newtext=lv_label_create(lv_scr_act(), NULL);	lv_obj_add_style(newtext, LV_OBJ_PART_MAIN,stylepointer);
	lv_obj_align(newtext, NULL, LV_ALIGN_CENTER, -50, 0);
	lv_label_set_text(newtext, "?TF is going on?");

ive tried another shot. This code is in main()

same here. font is not changing

also

static lv_style_t style_screen;	
lv_style_init(&style_screen);
lv_style_set_bg_color(&style_screen, LV_STATE_DEFAULT, LV_COLOR_BLACK);
lv_obj_add_style(lv_scr_act(), LV_OBJ_PART_MAIN, &style_screen);

works fine - so the problem is with fonts.

static lv_style_t stylepointer;	
lv_style_init(&stylepointer);
lv_style_set_text_font(&stylepointer,LV_STATE_DEFAULT,&lv_font_montserrat_48);
lv_style_set_shadow_color(&stylepointer,LV_STATE_DEFAULT,LV_COLOR_YELLOW);

	lv_obj_t* newtext=lv_label_create(lv_scr_act(), NULL);
	lv_obj_add_style(newtext, LV_OBJ_PART_ALL,&stylepointer);
	lv_obj_align(newtext, NULL, LV_ALIGN_CENTER, -50, 0);
	lv_label_set_text(newtext, "?TF is going on?");

stylepointer declared not as pointer as for style of screen, but still not working(ive changed to montserrat 48  in last example )

also ive found that style is not affecting on label. So even font color change not working…

problem solved

`lv_obj_add_style(newtext, LV_OBJ_PART_MAIN,&style);

lv_obj_add_style(newtext, LV_LABEL_PART_MAIN,&style);
`
i should use second string on label object instead of first. Thats why style wasnt working.