From 5eb7dbd1363f89756ce965f279859fbe687b3997 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 30 Apr 2008 07:38:08 +0000 Subject: [PATCH] *** empty log message *** --- src/font.c | 22 ++++++++++------------ src/font.h | 1 + src/ftfont.c | 4 ++-- src/lisp.h | 1 + src/xfaces.c | 25 +++++++++++++++---------- src/xftfont.c | 4 ++-- 6 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/font.c b/src/font.c index ba48c276b78..cadf0bff723 100644 --- a/src/font.c +++ b/src/font.c @@ -213,17 +213,16 @@ font_pixel_size (f, spec) { Lisp_Object size = AREF (spec, FONT_SIZE_INDEX); double point_size; - int pixel_size, dpi; + int dpi, pixel_size; Lisp_Object extra, val; if (INTEGERP (size)) return XINT (size); if (NILP (size)) - return 0; - xassert (FLOATP (size)); + return 0; xassert (FLOATP (size)); point_size = XFLOAT_DATA (size); - dpi = AREF (spec, FONT_DPI_INDEX); - if (INTEGERP (dpi)) + val = AREF (spec, FONT_DPI_INDEX); + if (INTEGERP (val)) dpi = XINT (XCDR (val)); else dpi = f->resy; @@ -330,7 +329,6 @@ extern Lisp_Object Vface_alternative_font_family_alist; extern Lisp_Object find_font_encoding P_ ((Lisp_Object)); -EXFUN (Fassoc_string, 3); /* Return encoding charset and repertory charset for REGISTRY in ENCODING and REPERTORY correspondingly. If correct information for @@ -443,7 +441,7 @@ font_prop_validate_style (style, val) { int n = font_style_to_value (prop, val, 0); - val = n >= 0 ? make_number (val) : Qerror; + val = n >= 0 ? make_number (n) : Qerror; } else val = Qerror; @@ -1015,7 +1013,7 @@ font_parse_xlfd (name, font) val = INTERN_FIELD (XLFD_SPACING_INDEX); if (! NILP (val)) { - val = font_prop_validate_spacing (FONT_SPACING_INDEX, val); + val = font_prop_validate_spacing (QCspacing, val); if (! INTEGERP (val)) return -1; ASET (font, FONT_SPACING_INDEX, val); @@ -1091,7 +1089,7 @@ font_parse_xlfd (name, font) ASET (font, FONT_DPI_INDEX, prop[XLFD_RESY_INDEX]); if (! NILP (prop[XLFD_SPACING_INDEX])) { - val = font_prop_validate_spacing (FONT_SPACING_INDEX, + val = font_prop_validate_spacing (QCspacing, prop[XLFD_SPACING_INDEX]); if (! INTEGERP (val)) return -1; @@ -1486,7 +1484,7 @@ font_parse_name (name, font) void font_parse_family_registry (family, registry, font_spec) - Lisp_Object family, registry; + Lisp_Object family, registry, font_spec; { int len; char *p0, *p1; @@ -2781,7 +2779,7 @@ font_find_for_lface (f, attrs, spec, c) if (INTEGERP (size)) ASET (prefer, FONT_SIZE_INDEX, size); else if (FLOATP (size)) - ASET (prefer, FONT_SIZE_INDEX, font_pixel_size (f, spec)); + ASET (prefer, FONT_SIZE_INDEX, make_number (font_pixel_size (f, spec))); else { double pt = XINT (attrs[LFACE_HEIGHT_INDEX]); @@ -3272,7 +3270,7 @@ Optional 2nd argument EXTRA-TYPE, if non-nil, specifies to check which kind of font it is. It must be one of `font-spec', `font-entity' `font-object'. */) (object, extra_type) - Lisp_Object object; + Lisp_Object object, extra_type; { if (NILP (extra_type)) return (FONTP (object) ? Qt : Qnil); diff --git a/src/font.h b/src/font.h index ed688525d4c..320555d5f86 100644 --- a/src/font.h +++ b/src/font.h @@ -763,6 +763,7 @@ EXFUN (Ffont_spec, MANY); EXFUN (Fcopy_font_spec, 1); EXFUN (Fmerge_font_spec, 2); EXFUN (Ffont_get, 2); +EXFUN (Ffont_put, 3); EXFUN (Flist_fonts, 4); EXFUN (Ffont_family_list, 1); EXFUN (Fclear_font_cache, 0); diff --git a/src/ftfont.c b/src/ftfont.c index 84a15e80b5b..7360742231d 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -421,9 +421,9 @@ ftfont_spec_pattern (spec, otlayout, otspec) return NULL; if (INTEGERP (AREF (spec, FONT_DPI_INDEX))) - dpi = XINT (dpi); + dpi = XINT (AREF (spec, FONT_DPI_INDEX)); if (INTEGERP (AREF (spec, FONT_SPACING_INDEX))) - spacing = XINT (val); + spacing = XINT (AREF (spec, FONT_SPACING_INDEX)); if (INTEGERP (AREF (spec, FONT_AVGWIDTH_INDEX)) && XINT (AREF (spec, FONT_AVGWIDTH_INDEX)) == 0) scalable = 1; diff --git a/src/lisp.h b/src/lisp.h index 2b08ec89b8a..1752cb865d8 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2975,6 +2975,7 @@ EXFUN (Fread_minibuffer, 2); EXFUN (Feval_minibuffer, 2); EXFUN (Fread_string, 5); EXFUN (Fread_no_blanks_input, 3); +EXFUN (Fassoc_string, 3); extern Lisp_Object get_minibuffer P_ ((int)); extern void temp_echo_area_glyphs P_ ((Lisp_Object)); extern void init_minibuf_once P_ ((void)); diff --git a/src/xfaces.c b/src/xfaces.c index 8575e171c1b..0bc81fb1de2 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -319,7 +319,7 @@ Lisp_Object QCfontset; /* Keywords symbols used for font properties. */ extern Lisp_Object QCfoundry, QCadstyle, QCregistry; -extern QCspacing, QCsize, QCavgwidth; +extern Lisp_Object QCspacing, QCsize, QCavgwidth; extern Lisp_Object Qp; /* Symbols used for attribute values. */ @@ -1892,15 +1892,19 @@ the face font sort order. */) for (i = 0; i < 4; i++) switch (font_sort_order[i]) { - case XLFD_SWIDTH: font_props_for_sorting[i] = QCwidth; break; - case XLFD_POINT_SIZE: font_props_for_sorting[i] = QCsize; break; - case XLFD_WEIGHT: font_props_for_sorting[i] = QCweight; break; - default: font_props_for_sorting[i] = QCslant; break; + case XLFD_SWIDTH: + font_props_for_sorting[i] = FONT_WIDTH_INDEX; break; + case XLFD_POINT_SIZE: + font_props_for_sorting[i] = FONT_SIZE_INDEX; break; + case XLFD_WEIGHT: + font_props_for_sorting[i] = FONT_WEIGHT_INDEX; break; + default: + font_props_for_sorting[i] = FONT_SLANT_INDEX; break; } - font_sort_order[i++] = QCfamily; - font_sort_order[i++] = QCfoundry; - font_sort_order[i++] = QCadstyle; - font_sort_order[i++] = QCregistry; + font_props_for_sorting[i++] = FONT_FAMILY_INDEX; + font_props_for_sorting[i++] = FONT_FOUNDRY_INDEX; + font_props_for_sorting[i++] = FONT_ADSTYLE_INDEX; + font_props_for_sorting[i++] = FONT_REGISTRY_INDEX; qsort (XVECTOR (vec)->contents, nfonts, sizeof (Lisp_Object), compare_fonts_by_sort_order); @@ -1916,7 +1920,8 @@ the face font sort order. */) ASET (v, 0, AREF (font, FONT_FAMILY_INDEX)); ASET (v, 1, FONT_WIDTH_SYMBOLIC (font)); - point = PIXEL_TO_POINT (AREF (font, FONT_SIZE_INDEX) * 10, f->resy); + point = PIXEL_TO_POINT (XINT (AREF (font, FONT_SIZE_INDEX)) * 10, + f->resy); ASET (v, 2, make_number (point)); ASET (v, 3, FONT_WEIGHT_SYMBOLIC (font)); ASET (v, 4, FONT_SLANT_SYMBOLIC (font)); diff --git a/src/xftfont.c b/src/xftfont.c index 1324b4dcd5b..da72df45393 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -545,7 +545,7 @@ xftfont_shape (lgstring) { struct font *font; struct xftfont_info *xftfont_info; - int result; + Lisp_Object result; FT_Face ft_face; CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font); @@ -563,7 +563,7 @@ xftfont_shape (lgstring) OTF_close (otf); xftfont_info->maybe_otf = 0; XftUnlockFace (xftfont_info->xftfont); - return 0; + return Qnil; } xftfont_info->otf = otf; } -- 2.39.5