}
\f
-/* Font name parser and unparser */
+/* Font name parser and unparser. */
static int parse_matrix (const char *);
static int font_expand_wildcards (Lisp_Object *, int);
/* This part (through the next ^L) is still experimental and not
tested much. We may drastically change codes. */
-/* OTF handler */
+/* OTF handler. */
#if 0
#endif /* 0 */
\f
-/* Font sorting */
+/* Font sorting. */
static unsigned font_score (Lisp_Object, Lisp_Object *);
static int font_compare (const void *, const void *);
return val;
}
-static int num_fonts;
static void
font_clear_cache (FRAME_PTR f, Lisp_Object cache, struct font_driver *driver)
{
eassert (font && driver == font->driver);
driver->close (f, font);
- num_fonts--;
}
}
if (driver->free_entity)
return Qnil;
ASET (entity, FONT_OBJLIST_INDEX,
Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX)));
- num_fonts++;
font = XFONT_OBJECT (font_object);
min_width = (font->min_width ? font->min_width
eassert (FRAME_X_DISPLAY_INFO (f)->n_fonts);
FRAME_X_DISPLAY_INFO (f)->n_fonts--;
#endif
- num_fonts--;
}
Lisp_Object it;
int i;
- /* Set boolean values to Qt or Qnil */
+ /* Set boolean values to Qt or Qnil. */
for (i = 0; boolean_properties[i] != NULL; ++i)
for (it = alist; ! NILP (it); it = XCDR (it))
{
#ifdef HAVE_WINDOW_SYSTEM
-/* Check how many characters after POS (at most to *LIMIT) can be
- displayed by the same font in the window W. FACE, if non-NULL, is
- the face selected for the character at POS. If STRING is not nil,
- it is the string to check instead of the current buffer. In that
- case, FACE must be not NULL.
+/* Check how many characters after character/byte position POS/POS_BYTE
+ (at most to *LIMIT) can be displayed by the same font in the window W.
+ FACE, if non-NULL, is the face selected for the character at POS.
+ If STRING is not nil, it is the string to check instead of the current
+ buffer. In that case, FACE must be not NULL.
The return value is the font-object for the character at POS.
*LIMIT is set to the position where that font can't be used.
It is assured that the current buffer (or STRING) is multibyte. */
Lisp_Object
-font_range (ptrdiff_t pos, ptrdiff_t *limit, struct window *w, struct face *face, Lisp_Object string)
+font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit,
+ struct window *w, struct face *face, Lisp_Object string)
{
- ptrdiff_t pos_byte, ignore;
+ ptrdiff_t ignore;
int c;
Lisp_Object font_object = Qnil;
if (NILP (string))
{
- pos_byte = CHAR_TO_BYTE (pos);
if (! face)
{
int face_id;
}
}
else
- {
- eassert (face);
- pos_byte = string_char_to_byte (string, pos);
- }
+ eassert (face);
while (pos < *limit)
{
#endif
\f
-/* Lisp API */
+/* Lisp API. */
DEFUN ("fontp", Ffontp, Sfontp, 1, 2, 0,
doc: /* Return t if OBJECT is a font-spec, font-entity, or font-object.
CHECK_FONT_GET_OBJECT (font_object, font);
- val = Fmake_vector (make_number (9), Qnil);
+ val = make_uninit_vector (9);
ASET (val, 0, AREF (font_object, FONT_NAME_INDEX));
ASET (val, 1, AREF (font_object, FONT_FILE_INDEX));
ASET (val, 2, make_number (font->pixel_size));
ASET (val, 7, make_number (font->average_width));
if (font->driver->otf_capability)
ASET (val, 8, Fcons (Qopentype, font->driver->otf_capability (font)));
+ else
+ ASET (val, 8, Qnil);
return val;
}
OPENED-NAME is the name used for opening the font,
FULL-NAME is the full name of the font,
SIZE is the pixelsize of the font,
- HEIGHT is the pixel-height of the font (i.e ascent + descent),
+ HEIGHT is the pixel-height of the font (i.e., ascent + descent),
BASELINE-OFFSET is the upward offset pixels from ASCII baseline,
RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling
how to compose characters.
return Qnil;
font = XFONT_OBJECT (font_object);
- info = Fmake_vector (make_number (7), Qnil);
+ info = make_uninit_vector (7);
ASET (info, 0, AREF (font_object, FONT_NAME_INDEX));
ASET (info, 1, AREF (font_object, FONT_FULLNAME_INDEX));
ASET (info, 2, make_number (font->pixel_size));
XSYMBOL (intern_c_string ("font-width-table"))->constant = 1;
staticpro (&font_style_table);
- font_style_table = Fmake_vector (make_number (3), Qnil);
+ font_style_table = make_uninit_vector (3);
ASET (font_style_table, 0, Vfont_weight_table);
ASET (font_style_table, 1, Vfont_slant_table);
ASET (font_style_table, 2, Vfont_width_table);