-struct font *
-fontset_ascii_font (f, id)
- FRAME_PTR f;
- int id;
-{
- Lisp_Object fontset = FONTSET_FROM_ID (id);
- Lisp_Object ascii_slot = FONTSET_ASCII (fontset);
- Lisp_Object val, font_object;
-
- if (CONSP (ascii_slot))
- {
- Lisp_Object ascii_font_name = XCAR (ascii_slot);
-
- font_object = Qnil;
- for (val = XCDR (ascii_slot); ! NILP (val); val = XCDR (val))
- {
- Lisp_Object frame = font_get_frame (XCAR (val));
-
- if (NILP (frame) || XFRAME (frame) == f)
- {
- font_object = XCAR (val);
- if (XSAVE_VALUE (font_object)->integer == 0)
- {
- font_object = font_open_by_name (f, SDATA (ascii_font_name));
- XSETCAR (val, font_object);
- }
- break;
- }
- }
- if (NILP (font_object))
- {
- font_object = font_open_by_name (f, SDATA (ascii_font_name));
- XSETCDR (ascii_slot, Fcons (font_object, XCDR (ascii_slot)));
- }
- }
- else
- {
- font_object = font_open_by_name (f, SDATA (ascii_slot));
- FONTSET_ASCII (fontset) = Fcons (ascii_slot, Fcons (font_object, Qnil));
- }
- if (NILP (font_object))
- return NULL;
- return XSAVE_VALUE (font_object)->pointer;
-}
-
-#endif /* USE_FONT_BACKEND */
-
-DEFUN ("font-info", Ffont_info, Sfont_info, 1, 2, 0,
- doc: /* Return information about a font named NAME on frame FRAME.
-If FRAME is omitted or nil, use the selected frame.
-The returned value is a vector of OPENED-NAME, FULL-NAME, CHARSET, SIZE,
- HEIGHT, BASELINE-OFFSET, RELATIVE-COMPOSE, and DEFAULT-ASCENT,
-where
- OPENED-NAME is the name used for opening the font,
- FULL-NAME is the full name of the font,
- SIZE is the maximum bound width of the font,
- HEIGHT is the height of the font,
- BASELINE-OFFSET is the upward offset pixels from ASCII baseline,
- RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling
- how to compose characters.
-If the named font is not yet loaded, return nil. */)
- (name, frame)
- Lisp_Object name, frame;
-{
- FRAME_PTR f;
- struct font_info *fontp;
- Lisp_Object info;
- Lisp_Object font_object;
-
- (*check_window_system_func) ();
-
- CHECK_STRING (name);
- name = Fdowncase (name);
- if (NILP (frame))
- frame = selected_frame;
- CHECK_LIVE_FRAME (frame);
- f = XFRAME (frame);
-
- if (!query_font_func)
- error ("Font query function is not supported");
-
-#ifdef USE_FONT_BACKEND
- if (enable_font_backend)
- {
- font_object = font_open_by_name (f, SDATA (name));
- if (NILP (font_object))
- fontp = NULL;
- else
- fontp = (struct font_info *) XSAVE_VALUE (font_object)->pointer;
- }
- else
-#endif /* USE_FONT_BACKEND */
- fontp = (*query_font_func) (f, SDATA (name));
- if (!fontp)
- return Qnil;