+2008-02-17 Kenichi Handa <handa@m17n.org>
+
+ * ftfont.c (ftfont_shape): Return Lispy number.
+
+ * xfaces.c (prepare_face_for_display): Use display_info->font->fid
+ for GCs.
+ (Finternal_set_font_selection_order): Call font_update_sort_order
+ only when enable_font_backend is set.
+ (realize_x_face): Set face->font_info to that of default face only
+ when enable_font_backend is set.
+
+ * xdisp.c (handle_composition_prop): Set it->c to the fist
+ characte of the composed region.
+ (fill_composite_glyph_string): Set base_face->font_info to
+ s->font_info. Get a face for ascii from base_face->ascii_face.
+ (BUILD_COMPOSITE_GLYPH_STRING): Call fill_composite_glyph_string
+ with a face already decided.
+ (x_produce_glyphs): Be sure to set it->ascent and it->descent to
+ non-negative.
+ (x_produce_glyphs): If the composition method is
+ ..._WITH_GLYPH_STRING, call font_prepare_composition
+ unconditionally.
+
+ * xfns.c (x_make_gc): Use the default font id of the frame for
+ GCs.
+
+ * xterm.h (struct x_display_info): New member font.
+
+ * xterm.c (x_set_cursor_gc): Use display_info->font->fid for GCs.
+ (x_set_mouse_face_gc, x_new_font): Likewise.
+ (x_term_init): Setup display_info->font.
+ (x_delete_terminal): Free display_info->font.
+
+ * xfont.c (xfont_draw): Use BLOCK_INPUT and UNBLOCK_INPUT.
+
+ * ftxfont.c (ftxfont_default_fid): Delete it.
+ (ftxfont_open): Set xfont->fid to 0.
+ (ftxfont_end_for_frame): Clear data specifi to the frame and the
+ font-driver.
+
+ * xftfont.c (xftfont_default_fid): Delete it.
+ (xftfont_open): Set xfont->fid to 0.
+
+ * fontset.c (FONTSET_OBJLIST): New macro.
+ (fontset_find_font): Update font-object list of the fontset.
+ (free_realized_fontset): New function.
+ (free_face_fontset): Call free_realized_fontset.
+ (Ffont_info): Call font_close_object only when enable_font_backend
+ is set.
+
+ * font.c [HAVE_X_WINDOWS]: Include xterm.h.
+ [HAVE_NTGUI]: Include w32term.h.
+ [MAC_OS]: Include macterm.ch.
+ (font_otf_ValueRecord): Use make_number.
+ (font_finish_cache): Fix handling of reference count.
+ (font_clear_cache): Update num_fonts.
+ (font_open_entity): Update smallest_char_width and
+ smallest_font_height of the frame.
+ (font_close_object): Update num_fonts.
+ (Fclear_font_cache): Fix finding the target cache data.
+
2008-02-16 Glenn Morris <rgm@gnu.org>
* fontset.c (Finternal_char_font): Fix compilation warning.
#include "fontset.h"
#include "font.h"
+#ifdef HAVE_X_WINDOWS
+#include "xterm.h"
+#endif /* HAVE_X_WINDOWS */
+
+#ifdef HAVE_NTGUI
+#include "w32term.h"
+#endif /* HAVE_NTGUI */
+
+#ifdef MAC_OS
+#include "macterm.h"
+#endif /* MAC_OS */
+
#ifndef FONT_DEBUG
#define FONT_DEBUG
#endif
Lisp_Object val = Fmake_vector (make_number (8), Qnil);
if (value_format & OTF_XPlacement)
- ASET (val, 0, value_record->XPlacement);
+ ASET (val, 0, make_number (value_record->XPlacement));
if (value_format & OTF_YPlacement)
- ASET (val, 1, value_record->YPlacement);
+ ASET (val, 1, make_number (value_record->YPlacement));
if (value_format & OTF_XAdvance)
- ASET (val, 2, value_record->XAdvance);
+ ASET (val, 2, make_number (value_record->XAdvance));
if (value_format & OTF_YAdvance)
- ASET (val, 3, value_record->YAdvance);
+ ASET (val, 3, make_number (value_record->YAdvance));
if (value_format & OTF_XPlaDevice)
ASET (val, 4, font_otf_DeviceTable (&value_record->XPlaDevice));
if (value_format & OTF_YPlaDevice)
}
}
+
static void
font_finish_cache (f, driver)
FRAME_PTR f;
cache = val, val = XCDR (val);
xassert (! NILP (val));
tmp = XCDR (XCAR (val));
+ XSETCAR (tmp, make_number (XINT (XCAR (tmp)) - 1));
if (XINT (XCAR (tmp)) == 0)
{
font_clear_cache (f, XCAR (val), driver);
XSETCDR (cache, XCDR (val));
}
- else
- {
- XSETCAR (tmp, make_number (XINT (XCAR (tmp)) - 1));
- }
}
+
static Lisp_Object
font_get_cache (f, driver)
FRAME_PTR f;
return val;
}
+static int num_fonts;
+
static void
font_clear_cache (f, cache, driver)
FRAME_PTR f;
driver->close (f, font);
p->pointer = NULL;
p->integer = 0;
+ num_fonts--;
}
if (driver->free_entity)
driver->free_entity (entity);
return entity;
}
-static int num_fonts;
-
/* Open a font of ENTITY and PIXEL_SIZE on frame F, and return the
opened font object. */
int pixel_size;
{
struct font_driver_list *driver_list;
- Lisp_Object objlist, size, val;
+ Lisp_Object objlist, size, val, font_object;
struct font *font;
size = AREF (entity, FONT_SIZE_INDEX);
if (XINT (size) != 0)
pixel_size = XINT (size);
+ font_object = Qnil;
for (objlist = AREF (entity, FONT_OBJLIST_INDEX); CONSP (objlist);
objlist = XCDR (objlist))
{
font = XSAVE_VALUE (XCAR (objlist))->pointer;
if (font->pixel_size == pixel_size)
{
- XSAVE_VALUE (XCAR (objlist))->integer++;
- return XCAR (objlist);
+ font_object = XCAR (objlist);
+ XSAVE_VALUE (font_object)->integer++;
+ break;
}
}
- xassert (FONT_ENTITY_P (entity));
- val = AREF (entity, FONT_TYPE_INDEX);
- for (driver_list = f->font_driver_list;
- driver_list && ! EQ (driver_list->driver->type, val);
- driver_list = driver_list->next);
- if (! driver_list)
- return Qnil;
+ if (NILP (font_object))
+ {
+ val = AREF (entity, FONT_TYPE_INDEX);
+ for (driver_list = f->font_driver_list;
+ driver_list && ! EQ (driver_list->driver->type, val);
+ driver_list = driver_list->next);
+ if (! driver_list)
+ return Qnil;
- font = driver_list->driver->open (f, entity, pixel_size);
- if (! font)
- return Qnil;
- font->scalable = XINT (size) == 0;
+ font = driver_list->driver->open (f, entity, pixel_size);
+ if (! font)
+ return Qnil;
+ font->scalable = XINT (size) == 0;
- val = make_save_value (font, 1);
- ASET (entity, FONT_OBJLIST_INDEX,
- Fcons (val, AREF (entity, FONT_OBJLIST_INDEX)));
- num_fonts++;
- return val;
+ font_object = make_save_value (font, 1);
+ ASET (entity, FONT_OBJLIST_INDEX,
+ Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX)));
+ num_fonts++;
+ }
+
+ if (FRAME_SMALLEST_CHAR_WIDTH (f) > font->min_width)
+ FRAME_SMALLEST_CHAR_WIDTH (f) = font->min_width;
+ if (FRAME_SMALLEST_CHAR_WIDTH (f) <= 0)
+ FRAME_SMALLEST_CHAR_WIDTH (f) = 1;
+ if (FRAME_SMALLEST_FONT_HEIGHT (f) > font->font.height)
+ FRAME_SMALLEST_FONT_HEIGHT (f) = font->font.height;
+ if (FRAME_SMALLEST_FONT_HEIGHT (f) <= 0)
+ FRAME_SMALLEST_FONT_HEIGHT (f) = 1;
+
+ return font_object;
}
Lisp_Object objlist;
Lisp_Object tail, prev = Qnil;
+ xassert (XSAVE_VALUE (font_object)->integer > 0);
XSAVE_VALUE (font_object)->integer--;
- xassert (XSAVE_VALUE (font_object)->integer >= 0);
if (XSAVE_VALUE (font_object)->integer > 0)
return;
ASET (font->entity, FONT_OBJLIST_INDEX, XCDR (objlist));
else
XSETCDR (prev, XCDR (objlist));
+ num_fonts--;
return;
}
abort ();
Lisp_Object val;
val = XCDR (cache);
- while (! EQ (XCAR (val), driver_list->driver->type))
+ while (! NILP (val)
+ && ! EQ (XCAR (XCAR (val)), driver_list->driver->type))
val = XCDR (val);
+ xassert (! NILP (val));
val = XCDR (XCAR (val));
if (XINT (XCAR (val)) == 0)
{