comparison src/font.c @ 95142:f64ddc606a66

(syms-of-font) <font-encoding-alist>: (Ffontp, Ffont_make_gstring): Fix typos in docstrings. (Flist_fonts, Ffont_family_list, Ffont_fill_gstring, Fquery_font, Ffont_otf_alternates): Doc fixes.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 20 May 2008 16:00:55 +0000
parents b7cee987e982
children 686d116f748d
comparison
equal deleted inserted replaced
95141:17032874a3da 95142:f64ddc606a66
1345 { 1345 {
1346 int spacing = (p0[1] == 'c' ? FONT_SPACING_CHARCELL 1346 int spacing = (p0[1] == 'c' ? FONT_SPACING_CHARCELL
1347 : p0[1] == 'm' ? FONT_SPACING_MONO 1347 : p0[1] == 'm' ? FONT_SPACING_MONO
1348 : FONT_SPACING_PROPORTIONAL); 1348 : FONT_SPACING_PROPORTIONAL);
1349 ASET (font, FONT_SPACING_INDEX, make_number (spacing)); 1349 ASET (font, FONT_SPACING_INDEX, make_number (spacing));
1350 } 1350 }
1351 else 1351 else
1352 { 1352 {
1353 /* unknown key */ 1353 /* unknown key */
1354 bcopy (p0, copy, p1 - p0); 1354 bcopy (p0, copy, p1 - p0);
1355 copy += p1 - p0; 1355 copy += p1 - p0;
1941 if (i == FONT_FAMILY_INDEX && CONSP (alternate_families)) 1941 if (i == FONT_FAMILY_INDEX && CONSP (alternate_families))
1942 { 1942 {
1943 int j; 1943 int j;
1944 1944
1945 for (j = 1; CONSP (alternate_families); 1945 for (j = 1; CONSP (alternate_families);
1946 j++, alternate_families = XCDR (alternate_families)) 1946 j++, alternate_families = XCDR (alternate_families))
1947 { 1947 {
1948 spec_str = XCAR (alternate_families); 1948 spec_str = XCAR (alternate_families);
1949 if (strcasecmp (SDATA (spec_str), SDATA (entity_str)) == 0) 1949 if (strcasecmp (SDATA (spec_str), SDATA (entity_str)) == 0)
1950 break; 1950 break;
1951 1951
1952 } 1952 }
1953 if (j > 3) 1953 if (j > 3)
1954 j = 3; 1954 j = 3;
1955 score |= j << sort_shift_bits[i]; 1955 score |= j << sort_shift_bits[i];
1956 } 1956 }
2367 family = AREF (spec, FONT_FAMILY_INDEX); 2367 family = AREF (spec, FONT_FAMILY_INDEX);
2368 if (NILP (family)) 2368 if (NILP (family))
2369 alternate_familes = Qnil; 2369 alternate_familes = Qnil;
2370 else 2370 else
2371 { 2371 {
2372 alternate_familes = Fassoc_string (family, 2372 alternate_familes = Fassoc_string (family,
2373 Vface_alternative_font_family_alist, 2373 Vface_alternative_font_family_alist,
2374 Qt); 2374 Qt);
2375 if (! NILP (alternate_familes)) 2375 if (! NILP (alternate_familes))
2376 alternate_familes = XCDR (alternate_familes); 2376 alternate_familes = XCDR (alternate_familes);
2377 n_family += XINT (Flength (alternate_familes)); 2377 n_family += XINT (Flength (alternate_familes));
3260 3260
3261 /* Check how many characters after POS (at most to LIMIT) can be 3261 /* Check how many characters after POS (at most to LIMIT) can be
3262 displayed by the same font. FACE is the face selected for the 3262 displayed by the same font. FACE is the face selected for the
3263 character as POS on frame F. STRING, if not nil, is the string to 3263 character as POS on frame F. STRING, if not nil, is the string to
3264 check instead of the current buffer. 3264 check instead of the current buffer.
3265 3265
3266 The return value is the position of the character that is displayed 3266 The return value is the position of the character that is displayed
3267 by the differnt font than that of the character as POS. */ 3267 by the differnt font than that of the character as POS. */
3268 3268
3269 EMACS_INT 3269 EMACS_INT
3270 font_range (pos, limit, face, f, string) 3270 font_range (pos, limit, face, f, string)
3324 3324
3325 DEFUN ("fontp", Ffontp, Sfontp, 1, 2, 0, 3325 DEFUN ("fontp", Ffontp, Sfontp, 1, 2, 0,
3326 doc: /* Return t if OBJECT is a font-spec, font-entity, or font-object. 3326 doc: /* Return t if OBJECT is a font-spec, font-entity, or font-object.
3327 Return nil otherwise. 3327 Return nil otherwise.
3328 Optional 2nd argument EXTRA-TYPE, if non-nil, specifies to check 3328 Optional 2nd argument EXTRA-TYPE, if non-nil, specifies to check
3329 which kind of font it is. It must be one of `font-spec', `font-entity' 3329 which kind of font it is. It must be one of `font-spec', `font-entity',
3330 `font-object'. */) 3330 `font-object'. */)
3331 (object, extra_type) 3331 (object, extra_type)
3332 Lisp_Object object, extra_type; 3332 Lisp_Object object, extra_type;
3333 { 3333 {
3334 if (NILP (extra_type)) 3334 if (NILP (extra_type))
3511 doc: /* List available fonts matching FONT-SPEC on the current frame. 3511 doc: /* List available fonts matching FONT-SPEC on the current frame.
3512 Optional 2nd argument FRAME specifies the target frame. 3512 Optional 2nd argument FRAME specifies the target frame.
3513 Optional 3rd argument NUM, if non-nil, limits the number of returned fonts. 3513 Optional 3rd argument NUM, if non-nil, limits the number of returned fonts.
3514 Optional 4th argument PREFER, if non-nil, is a font-spec to 3514 Optional 4th argument PREFER, if non-nil, is a font-spec to
3515 control the order of the returned list. Fonts are sorted by 3515 control the order of the returned list. Fonts are sorted by
3516 how they are close to PREFER. */) 3516 how close they are to PREFER. */)
3517 (font_spec, frame, num, prefer) 3517 (font_spec, frame, num, prefer)
3518 Lisp_Object font_spec, frame, num, prefer; 3518 Lisp_Object font_spec, frame, num, prefer;
3519 { 3519 {
3520 Lisp_Object vec, list, tail; 3520 Lisp_Object vec, list, tail;
3521 int n = 0, i, len; 3521 int n = 0, i, len;
3557 return list; 3557 return list;
3558 } 3558 }
3559 3559
3560 DEFUN ("font-family-list", Ffont_family_list, Sfont_family_list, 0, 1, 0, 3560 DEFUN ("font-family-list", Ffont_family_list, Sfont_family_list, 0, 1, 0,
3561 doc: /* List available font families on the current frame. 3561 doc: /* List available font families on the current frame.
3562 Optional argument FRAME specifies the target frame. */) 3562 Optional argument FRAME, if non-nil, specifies the target frame. */)
3563 (frame) 3563 (frame)
3564 Lisp_Object frame; 3564 Lisp_Object frame;
3565 { 3565 {
3566 FRAME_PTR f; 3566 FRAME_PTR f;
3567 struct font_driver_list *driver_list; 3567 struct font_driver_list *driver_list;
3716 } 3716 }
3717 3717
3718 return Qnil; 3718 return Qnil;
3719 } 3719 }
3720 3720
3721 /* The following three functions are still expremental. */ 3721 /* The following three functions are still experimental. */
3722 3722
3723 DEFUN ("font-make-gstring", Ffont_make_gstring, Sfont_make_gstring, 2, 2, 0, 3723 DEFUN ("font-make-gstring", Ffont_make_gstring, Sfont_make_gstring, 2, 2, 0,
3724 doc: /* Return a newly created g-string for FONT-OBJECT with NUM glyphs. 3724 doc: /* Return a newly created g-string for FONT-OBJECT with NUM glyphs.
3725 FONT-OBJECT may be nil if it is not yet known. 3725 FONT-OBJECT may be nil if it is not yet known.
3726 3726
3729 [ HEADER GLYPH ... ] 3729 [ HEADER GLYPH ... ]
3730 HEADER is a vector of this form: 3730 HEADER is a vector of this form:
3731 [FONT-OBJECT WIDTH LBEARING RBEARING ASCENT DESCENT] 3731 [FONT-OBJECT WIDTH LBEARING RBEARING ASCENT DESCENT]
3732 where 3732 where
3733 FONT-OBJECT is a font-object for all glyphs in the g-string, 3733 FONT-OBJECT is a font-object for all glyphs in the g-string,
3734 WIDTH thry DESCENT are the metrics (in pixels) of the whole G-string. 3734 WIDTH thru DESCENT are the metrics (in pixels) of the whole G-string.
3735 GLYPH is a vector of this form: 3735 GLYPH is a vector of this form:
3736 [ FROM-IDX TO-IDX C CODE WIDTH LBEARING RBEARING ASCENT DESCENT 3736 [ FROM-IDX TO-IDX C CODE WIDTH LBEARING RBEARING ASCENT DESCENT
3737 [ [X-OFF Y-OFF WADJUST] | nil] ] 3737 [ [X-OFF Y-OFF WADJUST] | nil] ]
3738 where 3738 where
3739 FROM-IDX and TO-IDX are used internally and should not be touched. 3739 FROM-IDX and TO-IDX are used internally and should not be touched.
3740 C is the character of the glyph. 3740 C is the character of the glyph.
3741 CODE is the glyph-code of C in FONT-OBJECT. 3741 CODE is the glyph-code of C in FONT-OBJECT.
3742 WIDTH thry DESCENT are the metrics (in pixels) of the glyph. 3742 WIDTH thru DESCENT are the metrics (in pixels) of the glyph.
3743 X-OFF and Y-OFF are offests to the base position for the glyph. 3743 X-OFF and Y-OFF are offests to the base position for the glyph.
3744 WADJUST is the adjustment to the normal width of the glyph. */) 3744 WADJUST is the adjustment to the normal width of the glyph. */)
3745 (font_object, num) 3745 (font_object, num)
3746 Lisp_Object font_object, num; 3746 Lisp_Object font_object, num;
3747 { 3747 {
3766 DEFUN ("font-fill-gstring", Ffont_fill_gstring, Sfont_fill_gstring, 4, 5, 0, 3766 DEFUN ("font-fill-gstring", Ffont_fill_gstring, Sfont_fill_gstring, 4, 5, 0,
3767 doc: /* Fill in glyph-string GSTRING by characters for FONT-OBJECT. 3767 doc: /* Fill in glyph-string GSTRING by characters for FONT-OBJECT.
3768 START and END specify the region to extract characters. 3768 START and END specify the region to extract characters.
3769 If optional 5rd argument OBJECT is non-nil, it is a buffer or a string from 3769 If optional 5rd argument OBJECT is non-nil, it is a buffer or a string from
3770 where to extract characters. 3770 where to extract characters.
3771 FONT-OBJECT may be nil if GSTRING already already contains one. */) 3771 FONT-OBJECT may be nil if GSTRING already contains one. */)
3772 (gstring, font_object, start, end, object) 3772 (gstring, font_object, start, end, object)
3773 Lisp_Object gstring, font_object, start, end, object; 3773 Lisp_Object gstring, font_object, start, end, object;
3774 { 3774 {
3775 int len, i, c; 3775 int len, i, c;
3776 unsigned code; 3776 unsigned code;
4061 3, 3, 0, 4061 3, 3, 0,
4062 doc: /* Return a list of alternate glyphs of CHARACTER in FONT-OBJECT. 4062 doc: /* Return a list of alternate glyphs of CHARACTER in FONT-OBJECT.
4063 OTF-FEATURES specifies which features of the font FONT-OBJECT to apply 4063 OTF-FEATURES specifies which features of the font FONT-OBJECT to apply
4064 in this format: 4064 in this format:
4065 (SCRIPT LANGSYS FEATURE ...) 4065 (SCRIPT LANGSYS FEATURE ...)
4066 See the documentation of `font-otf-gsub' for more detail. 4066 See the documentation of `font-drive-otf' for more detail.
4067 4067
4068 The value is a list of cons cells of the format (GLYPH-ID . CHARACTER), 4068 The value is a list of cons cells of the format (GLYPH-ID . CHARACTER),
4069 where GLYPH-ID is a glyph index of the font, and CHARACTER is a 4069 where GLYPH-ID is a glyph index of the font, and CHARACTER is a
4070 character code corresponding to the glyph or nil if there's no 4070 character code corresponding to the glyph or nil if there's no
4071 corresponding character. */) 4071 corresponding character. */)
4163 FILENAME is a string of the font file (or nil if the font backend 4163 FILENAME is a string of the font file (or nil if the font backend
4164 doesn't provide a file name). 4164 doesn't provide a file name).
4165 4165
4166 PIXEL-SIZE is a pixel size by which the font is opened. 4166 PIXEL-SIZE is a pixel size by which the font is opened.
4167 4167
4168 SIZE is a maximum advance width of the font in pixel. 4168 SIZE is a maximum advance width of the font in pixels.
4169 4169
4170 ASCENT, DESCENT, SPACE-WIDTH, AVERAGE-WIDTH are metrics of the font in 4170 ASCENT, DESCENT, SPACE-WIDTH, AVERAGE-WIDTH are metrics of the font in
4171 pixel. 4171 pixels.
4172 4172
4173 CAPABILITY is a list whose first element is a symbol representing the 4173 CAPABILITY is a list whose first element is a symbol representing the
4174 font format \(x, opentype, truetype, type1, pcf, or bdf) and the 4174 font format \(x, opentype, truetype, type1, pcf, or bdf) and the
4175 remaining elements describes a detail of the font capability. 4175 remaining elements describe the details of the font capability.
4176 4176
4177 If the font is OpenType font, the form of the list is 4177 If the font is OpenType font, the form of the list is
4178 \(opentype GSUB GPOS) 4178 \(opentype GSUB GPOS)
4179 where GSUB shows which "GSUB" features the font supports, and GPOS 4179 where GSUB shows which "GSUB" features the font supports, and GPOS
4180 shows which "GPOS" features the font supports. Both GSUB and GPOS are 4180 shows which "GPOS" features the font supports. Both GSUB and GPOS are
4451 Alist of fontname patterns vs the corresponding encoding and repertory info. 4451 Alist of fontname patterns vs the corresponding encoding and repertory info.
4452 Each element looks like (REGEXP . (ENCODING . REPERTORY)), 4452 Each element looks like (REGEXP . (ENCODING . REPERTORY)),
4453 where ENCODING is a charset or a char-table, 4453 where ENCODING is a charset or a char-table,
4454 and REPERTORY is a charset, a char-table, or nil. 4454 and REPERTORY is a charset, a char-table, or nil.
4455 4455
4456 If ENCDING and REPERTORY are the same, the element can have the form 4456 If ENCODING and REPERTORY are the same, the element can have the form
4457 \(REGEXP . ENCODING). 4457 \(REGEXP . ENCODING).
4458 4458
4459 ENCODING is for converting a character to a glyph code of the font. 4459 ENCODING is for converting a character to a glyph code of the font.
4460 If ENCODING is a charset, encoding a character by the charset gives 4460 If ENCODING is a charset, encoding a character by the charset gives
4461 the corresponding glyph code. If ENCODING is a char-table, looking up 4461 the corresponding glyph code. If ENCODING is a char-table, looking up
4462 the table by a character gives the corresponding glyph code. 4462 the table by a character gives the corresponding glyph code.
4463 4463
4464 REPERTORY specifies a repertory of characters supported by the font. 4464 REPERTORY specifies a repertory of characters supported by the font.
4465 If REPERTORY is a charset, all characters beloging to the charset are 4465 If REPERTORY is a charset, all characters beloging to the charset are
4466 supported. If REPERTORY is a char-table, all characters who have a 4466 supported. If REPERTORY is a char-table, all characters who have a
4467 non-nil value in the table are supported. It REPERTORY is nil, Emacs 4467 non-nil value in the table are supported. If REPERTORY is nil, Emacs
4468 gets the repertory information by an opened font and ENCODING. */); 4468 gets the repertory information by an opened font and ENCODING. */);
4469 Vfont_encoding_alist = Qnil; 4469 Vfont_encoding_alist = Qnil;
4470 4470
4471 #ifdef HAVE_WINDOW_SYSTEM 4471 #ifdef HAVE_WINDOW_SYSTEM
4472 #ifdef HAVE_FREETYPE 4472 #ifdef HAVE_FREETYPE