}
/* Score the size. Maximum difference is 127. */
- i = FONT_SIZE_INDEX;
if (! NILP (spec_prop[FONT_SIZE_INDEX])
&& XINT (AREF (entity, FONT_SIZE_INDEX)) > 0)
{
: font->average_width ? font->average_width
: font->space_width ? font->space_width
: 1);
- height = (font->height ? font->height : 1);
+
+ int font_ascent, font_descent;
+ get_font_ascent_descent (font, &font_ascent, &font_descent);
+ height = font_ascent + font_descent;
+ if (height <= 0)
+ height = 1;
#ifdef HAVE_WINDOW_SYSTEM
FRAME_DISPLAY_INFO (f)->n_fonts++;
if (FRAME_DISPLAY_INFO (f)->n_fonts == 1)
/* No font is listed for SPEC, but each font-backend may have
different criteria about "font matching". So, try it. */
entity = font_matching_entity (f, attrs, spec);
+ /* Perhaps the user asked for a font "Foobar-123", and we
+ interpreted "-123" as the size, whereas it really is part of
+ the name. So we reset the size to nil and the family name to
+ the entire "Foobar-123" thing, and try again with that. */
+ if (NILP (entity))
+ {
+ name = Ffont_get (spec, QCuser_spec);
+ if (STRINGP (name))
+ {
+ char *p = SSDATA (name), *q = strrchr (p, '-');
+
+ if (q != NULL && c_isdigit (q[1]))
+ {
+ char *tail;
+ double font_size = strtod (q + 1, &tail);
+
+ if (font_size > 0 && tail != q + 1)
+ {
+ Lisp_Object lsize = Ffont_get (spec, QCsize);
+
+ if ((FLOATP (lsize) && XFLOAT_DATA (lsize) == font_size)
+ || (INTEGERP (lsize) && XINT (lsize) == font_size))
+ {
+ ASET (spec, FONT_FAMILY_INDEX,
+ font_intern_prop (p, tail - p, 1));
+ ASET (spec, FONT_SIZE_INDEX, Qnil);
+ entity = font_matching_entity (f, attrs, spec);
+ }
+ }
+ }
+ }
+ }
if (NILP (entity))
return Qnil;
}
`:foundry'
-VALUE must be a string or a symbol specifying the font foundry, e.g. ``misc''.
+VALUE must be a string or a symbol specifying the font foundry, e.g. `misc'.
`:adstyle'
VALUE must be a string or a symbol specifying the additional
-typographic style information of a font, e.g. ``sans''.
+typographic style information of a font, e.g. `sans'.
`:registry'
VALUE must be a string or a symbol specifying the charset registry and
-encoding of a font, e.g. ``iso8859-1''.
+encoding of a font, e.g. `iso8859-1'.
`:size'
`:lang'
-VALUE must be a symbol of two-letter ISO-639 language names,
-e.g. `ja'.
+VALUE must be a symbol whose name is a two-letter ISO-639 language
+name, e.g. `ja'. The value is matched against the "Additional Style"
+field of the XLFD spec of a font, if it's non-empty, on X, and
+against the codepages supported by the font on w32.
`:otf'
GSUB: List of OpenType GSUB feature tag symbols, or nil if none required.
GPOS: List of OpenType GPOS feature tag symbols, or nil if none required.
-GSUB and GPOS may contain `nil' element. In such a case, the font
+GSUB and GPOS may contain nil elements. In such a case, the font
must not have any of the remaining elements.
For instance, if the VALUE is `(thai nil nil (mark))', the font must
static Lisp_Object Vfont_log_deferred;
/* Prepend the font-related logging data in Vfont_log if it is not
- `t'. ACTION describes a kind of font-related action (e.g. listing,
+ t. ACTION describes a kind of font-related action (e.g. listing,
opening), ARG is the argument for the action, and RESULT is the
result of the action. */
void
DEFSYM (Qiso8859_1, "iso8859-1");
DEFSYM (Qiso10646_1, "iso10646-1");
DEFSYM (Qunicode_bmp, "unicode-bmp");
- DEFSYM (Qunicode_sip, "unicode-sip");
-
- /* Unicode category `Cf'. */
- DEFSYM (QCf, "Cf");
/* Symbols representing keys of font extra info. */
DEFSYM (QCotf, ":otf");
DEFSYM (QCscalable, ":scalable");
DEFSYM (QCavgwidth, ":avgwidth");
DEFSYM (QCfont_entity, ":font-entity");
- DEFSYM (QCfc_unknown_spec, ":fc-unknown-spec");
/* Symbols representing values of font spacing property. */
DEFSYM (Qc, "c");
ASET (font_style_table, 2, Vfont_width_table);
DEFVAR_LISP ("font-log", Vfont_log, doc: /*
-*Logging list of font related actions and results.
-The value t means to suppress the logging.
-The initial value is set to nil if the environment variable
-EMACS_FONT_LOG is set. Otherwise, it is set to t. */);
+A list that logs font-related actions and results, for debugging.
+The default value is t, which means to suppress logging.
+Set it to nil to enable logging. If the environment variable
+EMACS_FONT_LOG is set at startup, it defaults to nil. */);
Vfont_log = Qnil;
#ifdef HAVE_WINDOW_SYSTEM
#ifdef HAVE_FREETYPE
syms_of_ftfont ();
#ifdef HAVE_X_WINDOWS
+#ifdef USE_CAIRO
+ syms_of_ftcrfont ();
+#else
syms_of_xfont ();
syms_of_ftxfont ();
#ifdef HAVE_XFT
syms_of_xftfont ();
#endif /* HAVE_XFT */
+#endif /* not USE_CAIRO */
#endif /* HAVE_X_WINDOWS */
#else /* not HAVE_FREETYPE */
#ifdef HAVE_X_WINDOWS