}
struct graphics_font *
-graphics_font_new(struct graphics *gra, int size)
+graphics_font_new(struct graphics *gra, int size, int flags)
{
struct graphics_font *this_;
this_=g_new0(struct graphics_font,1);
- this_->priv=gra->meth.font_new(gra->priv, &this_->meth, size);
+ this_->priv=gra->meth.font_new(gra->priv, &this_->meth, size, flags);
return this_;
}
p.x=di->pnt[0].x+3;
p.y=di->pnt[0].y+10;
if (! gra->font[e->label_size])
- gra->font[e->label_size]=graphics_font_new(gra, e->label_size*20);
+ gra->font[e->label_size]=graphics_font_new(gra, e->label_size*20, 0);
gra->meth.draw_text(gra->priv, gra->gc[2]->priv, gra->gc[1]->priv, gra->font[e->label_size]->priv, di->label, &p, 0x10000, 0);
}
break;
case element_label:
if (di->label) {
if (! gra->font[e->label_size])
- gra->font[e->label_size]=graphics_font_new(gra, e->label_size*20);
+ gra->font[e->label_size]=graphics_font_new(gra, e->label_size*20, 0);
label_line(gra, gra->gc[2], gra->gc[1], gra->font[e->label_size], di->pnt, di->count, di->label);
}
break;
void (*draw_image)(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img);
void (*draw_image_warp)(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data);
void (*draw_restore)(struct graphics_priv *gr, struct point *p, int w, int h);
- struct graphics_font_priv *(*font_new)(struct graphics_priv *gr, struct graphics_font_methods *meth, int size);
+ struct graphics_font_priv *(*font_new)(struct graphics_priv *gr, struct graphics_font_methods *meth, int size, int flags);
struct graphics_gc_priv *(*gc_new)(struct graphics_priv *gr, struct graphics_gc_methods *meth);
void (*background_gc)(struct graphics_priv *gr, struct graphics_gc_priv *gc);
struct graphics_priv *(*overlay_new)(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h);
void graphics_register_resize_callback(struct graphics *this_, void (*callback)(void *data, int w, int h), void *data);
void graphics_register_button_callback(struct graphics *this_, void (*callback)(void *data, int pressed, int button, struct point *p), void *data);
void graphics_register_motion_callback(struct graphics *this_, void (*callback)(void *data, struct point *p), void *data);
-struct graphics_font *graphics_font_new(struct graphics *gra, int size);
+struct graphics_font *graphics_font_new(struct graphics *gra, int size, int flags);
struct graphics_gc *graphics_gc_new(struct graphics *gra);
void graphics_gc_destroy(struct graphics_gc *gc);
void graphics_gc_set_foreground(struct graphics_gc *gc, struct color *c);
* First search for each of the font families and require and exact match on family
* If no font found, let fontconfig pick the best match
*/
-static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, int size)
+static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, int size, int flags)
{
struct graphics_font_priv *font=g_new(struct graphics_font_priv, 1);
while (*family && !found) {
dbg(1, "Looking for font family %s. exact=%d\n", *family, exact);
FcPattern *required = FcPatternBuild(NULL, FC_FAMILY, FcTypeString, *family, NULL);
+ if (flags)
+ FcPatternAddInteger(required,FC_WEIGHT,FC_WEIGHT_BOLD);
FcConfigSubstitute(FcConfigGetCurrent(), required, FcMatchFont);
FcDefaultSubstitute(required);
FcResult result;
graphics_gc_set_foreground(this->green, &c);
graphics_gc_set_linewidth(this->green, 2);
- this->font=graphics_font_new(this->gr, 200);
+ this->font=graphics_font_new(this->gr, 200, 1);
navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_compass_draw), attr_position_coord_geo, this));
osd_compass_draw(this, nav, NULL);
graphics_gc_set_foreground(this->white, &c);
graphics_gc_set_linewidth(this->white, 2);
- this->font=graphics_font_new(this->gr, 200);
+ this->font=graphics_font_new(this->gr, 200, 1);
this->flag=graphics_image_new(this->gr, flag);
navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_eta_draw), attr_position_coord_geo, this));
struct graphics_font *font;
int active;
char last_distance[16];
+ char *last_name;
};
static void
osd_navigation_draw(struct osd_navigation *this, struct navit *navit, struct vehicle *v)
{
struct point p;
- char navigation[16];
char distance[16];
- int days=0,do_draw=1;
- time_t navigationt;
- struct tm tm,navigation_tm,navigation_tm0;
+ int do_draw=0;
struct attr attr;
struct navigation *nav=NULL;
struct map *map=NULL;
if (item_attr_get(item, attr_length, &attr)) {
format_distance(distance, attr.u.num);
}
+ if (this->active != 1 || strcmp(this->last_distance, distance) || this->last_name != name) {
+ this->active=1;
+ strcpy(this->last_distance, distance);
+ this->last_name=name;
+ do_draw=1;
+ }
+ } else {
+ if (this->active != 0) {
+ this->active=0;
+ do_draw=1;
+ }
}
if (mr)
map_rect_destroy(mr);
p.x=0;
p.y=0;
graphics_draw_rectangle(this->gr, this->bg, &p, this->w, this->h);
- image=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/xpm/", name, "_32.xpm", NULL);
- gr_image=graphics_image_new(this->gr, image);
- if (! gr_image) {
- g_free(image);
- image=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/xpm/unknown.xpm", NULL);
+ if (this->active) {
+ image=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/xpm/", name, "_32.xpm", NULL);
gr_image=graphics_image_new(this->gr, image);
+ if (! gr_image) {
+ g_free(image);
+ image=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/xpm/unknown.xpm", NULL);
+ gr_image=graphics_image_new(this->gr, image);
+ }
+ dbg(1,"gr_image=%p\n", gr_image);
+ if (gr_image) {
+ p.x=(this->w-gr_image->width)/2;
+ p.y=(46-gr_image->height)/2;
+ graphics_draw_image(this->gr, this->white, &p, gr_image);
+ graphics_image_free(this->gr, gr_image);
+ }
+ p.x=12;
+ p.y=56;
+ graphics_draw_text(this->gr, this->white, NULL, this->font, distance, &p, 0x10000, 0);
}
- dbg(1,"gr_image=%p\n", gr_image);
- if (gr_image) {
- p.x=(this->w-gr_image->width)/2;
- p.y=(46-gr_image->height)/2;
- graphics_draw_image(this->gr, this->white, &p, gr_image);
- graphics_image_free(this->gr, gr_image);
- }
- p.x=12;
- p.y=56;
- graphics_draw_text(this->gr, this->white, NULL, this->font, distance, &p, 0x10000, 0);
graphics_draw_mode(this->gr, draw_mode_end);
}
}
graphics_gc_set_foreground(this->white, &c);
graphics_gc_set_linewidth(this->white, 2);
- this->font=graphics_font_new(this->gr, 200);
+ this->font=graphics_font_new(this->gr, 200, 1);
navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_navigation_draw), attr_position_coord_geo, this));
osd_navigation_draw(this, nav, NULL);