Exemplo n.º 1
0
static int ascii_mode_init(EditState *s, ModeSavedData *saved_data)
{
    QEFont *font;
    QEStyleDef style;
    int num_width;
    int ret;

    ret = text_mode_init(s, saved_data);
    if (ret)
        return ret;

    /* get typical number width */
    get_style(s, &style, s->default_style);
    font = select_font(s->screen, style.font_style, style.font_size);
    num_width = glyph_width(s->screen, font, '0');
    release_font(s->screen, font);

    s->disp_width = (s->screen->width / num_width) - 10;
    /* align on 16 byte boundary */
    s->disp_width &= ~15;
    if (s->disp_width < 16)
        s->disp_width = 16;
    s->insert = 0;
    s->hex_mode = 0;
    s->wrap = WRAP_TRUNCATE;
    return 0;
}
Exemplo n.º 2
0
void unload_font (MyFont * font)
#endif
{
#if defined(LOG_FONT_CALLS) && defined(DEBUG_ALLOCS)
	log_call (file, line, "unload_font", font->name);
#endif
	if (font->as_font) {
		release_font (font->as_font);
		font->as_font = NULL;
	}

	if (font->name != NULL)
		free (font->name);
	font->name = NULL;
}