diff options
Diffstat (limited to 'src/font.c')
| -rw-r--r-- | src/font.c | 74 |
1 files changed, 34 insertions, 40 deletions
diff --git a/src/font.c b/src/font.c index ab00402b40b..5c01c7ff796 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -4847,21 +4847,18 @@ If the font is not OpenType font, CAPABILITY is nil. */) | |||
| 4847 | (Lisp_Object font_object) | 4847 | (Lisp_Object font_object) |
| 4848 | { | 4848 | { |
| 4849 | struct font *font = CHECK_FONT_GET_OBJECT (font_object); | 4849 | struct font *font = CHECK_FONT_GET_OBJECT (font_object); |
| 4850 | Lisp_Object val = make_uninit_vector (9); | 4850 | return CALLN (Fvector, |
| 4851 | 4851 | AREF (font_object, FONT_NAME_INDEX), | |
| 4852 | ASET (val, 0, AREF (font_object, FONT_NAME_INDEX)); | 4852 | AREF (font_object, FONT_FILE_INDEX), |
| 4853 | ASET (val, 1, AREF (font_object, FONT_FILE_INDEX)); | 4853 | make_fixnum (font->pixel_size), |
| 4854 | ASET (val, 2, make_fixnum (font->pixel_size)); | 4854 | make_fixnum (font->max_width), |
| 4855 | ASET (val, 3, make_fixnum (font->max_width)); | 4855 | make_fixnum (font->ascent), |
| 4856 | ASET (val, 4, make_fixnum (font->ascent)); | 4856 | make_fixnum (font->descent), |
| 4857 | ASET (val, 5, make_fixnum (font->descent)); | 4857 | make_fixnum (font->space_width), |
| 4858 | ASET (val, 6, make_fixnum (font->space_width)); | 4858 | make_fixnum (font->average_width), |
| 4859 | ASET (val, 7, make_fixnum (font->average_width)); | 4859 | (font->driver->otf_capability |
| 4860 | if (font->driver->otf_capability) | 4860 | ? Fcons (Qopentype, font->driver->otf_capability (font)) |
| 4861 | ASET (val, 8, Fcons (Qopentype, font->driver->otf_capability (font))); | 4861 | : Qnil)); |
| 4862 | else | ||
| 4863 | ASET (val, 8, Qnil); | ||
| 4864 | return val; | ||
| 4865 | } | 4862 | } |
| 4866 | 4863 | ||
| 4867 | DEFUN ("font-get-glyphs", Ffont_get_glyphs, Sfont_get_glyphs, 3, 4, 0, | 4864 | DEFUN ("font-get-glyphs", Ffont_get_glyphs, Sfont_get_glyphs, 3, 4, 0, |
| @@ -4889,7 +4886,7 @@ the corresponding element is nil. */) | |||
| 4889 | { | 4886 | { |
| 4890 | struct font *font = CHECK_FONT_GET_OBJECT (font_object); | 4887 | struct font *font = CHECK_FONT_GET_OBJECT (font_object); |
| 4891 | ptrdiff_t len; | 4888 | ptrdiff_t len; |
| 4892 | Lisp_Object *chars, vec; | 4889 | Lisp_Object *chars; |
| 4893 | USE_SAFE_ALLOCA; | 4890 | USE_SAFE_ALLOCA; |
| 4894 | 4891 | ||
| 4895 | if (NILP (object)) | 4892 | if (NILP (object)) |
| @@ -4957,7 +4954,7 @@ the corresponding element is nil. */) | |||
| 4957 | else | 4954 | else |
| 4958 | wrong_type_argument (Qarrayp, object); | 4955 | wrong_type_argument (Qarrayp, object); |
| 4959 | 4956 | ||
| 4960 | vec = make_uninit_vector (len); | 4957 | Lisp_Object vec = make_nil_vector (len); |
| 4961 | for (ptrdiff_t i = 0; i < len; i++) | 4958 | for (ptrdiff_t i = 0; i < len; i++) |
| 4962 | { | 4959 | { |
| 4963 | Lisp_Object g; | 4960 | Lisp_Object g; |
| @@ -5168,24 +5165,23 @@ If the named font cannot be opened and loaded, return nil. */) | |||
| 5168 | return Qnil; | 5165 | return Qnil; |
| 5169 | font = XFONT_OBJECT (font_object); | 5166 | font = XFONT_OBJECT (font_object); |
| 5170 | 5167 | ||
| 5171 | info = make_uninit_vector (14); | 5168 | info = CALLN (Fvector, |
| 5172 | ASET (info, 0, AREF (font_object, FONT_NAME_INDEX)); | 5169 | AREF (font_object, FONT_NAME_INDEX), |
| 5173 | ASET (info, 1, AREF (font_object, FONT_FULLNAME_INDEX)); | 5170 | AREF (font_object, FONT_FULLNAME_INDEX), |
| 5174 | ASET (info, 2, make_fixnum (font->pixel_size)); | 5171 | make_fixnum (font->pixel_size), |
| 5175 | ASET (info, 3, make_fixnum (font->height)); | 5172 | make_fixnum (font->height), |
| 5176 | ASET (info, 4, make_fixnum (font->baseline_offset)); | 5173 | make_fixnum (font->baseline_offset), |
| 5177 | ASET (info, 5, make_fixnum (font->relative_compose)); | 5174 | make_fixnum (font->relative_compose), |
| 5178 | ASET (info, 6, make_fixnum (font->default_ascent)); | 5175 | make_fixnum (font->default_ascent), |
| 5179 | ASET (info, 7, make_fixnum (font->max_width)); | 5176 | make_fixnum (font->max_width), |
| 5180 | ASET (info, 8, make_fixnum (font->ascent)); | 5177 | make_fixnum (font->ascent), |
| 5181 | ASET (info, 9, make_fixnum (font->descent)); | 5178 | make_fixnum (font->descent), |
| 5182 | ASET (info, 10, make_fixnum (font->space_width)); | 5179 | make_fixnum (font->space_width), |
| 5183 | ASET (info, 11, make_fixnum (font->average_width)); | 5180 | make_fixnum (font->average_width), |
| 5184 | ASET (info, 12, AREF (font_object, FONT_FILE_INDEX)); | 5181 | AREF (font_object, FONT_FILE_INDEX), |
| 5185 | if (font->driver->otf_capability) | 5182 | (font->driver->otf_capability |
| 5186 | ASET (info, 13, Fcons (Qopentype, font->driver->otf_capability (font))); | 5183 | ? Fcons (Qopentype, font->driver->otf_capability (font)) |
| 5187 | else | 5184 | : Qnil)); |
| 5188 | ASET (info, 13, Qnil); | ||
| 5189 | 5185 | ||
| 5190 | #if 0 | 5186 | #if 0 |
| 5191 | /* As font_object is still in FONT_OBJLIST of the entity, we can't | 5187 | /* As font_object is still in FONT_OBJLIST of the entity, we can't |
| @@ -5203,7 +5199,7 @@ If the named font cannot be opened and loaded, return nil. */) | |||
| 5203 | static Lisp_Object | 5199 | static Lisp_Object |
| 5204 | build_style_table (const struct table_entry *entry, int nelement) | 5200 | build_style_table (const struct table_entry *entry, int nelement) |
| 5205 | { | 5201 | { |
| 5206 | Lisp_Object table = make_uninit_vector (nelement); | 5202 | Lisp_Object table = make_nil_vector (nelement); |
| 5207 | for (int i = 0; i < nelement; i++) | 5203 | for (int i = 0; i < nelement; i++) |
| 5208 | { | 5204 | { |
| 5209 | int j; | 5205 | int j; |
| @@ -5494,10 +5490,8 @@ This variable cannot be set; trying to do so will signal an error. */); | |||
| 5494 | make_symbol_constant (intern_c_string ("font-width-table")); | 5490 | make_symbol_constant (intern_c_string ("font-width-table")); |
| 5495 | 5491 | ||
| 5496 | staticpro (&font_style_table); | 5492 | staticpro (&font_style_table); |
| 5497 | font_style_table = make_uninit_vector (3); | 5493 | font_style_table = CALLN (Fvector, Vfont_weight_table, Vfont_slant_table, |
| 5498 | ASET (font_style_table, 0, Vfont_weight_table); | 5494 | Vfont_width_table); |
| 5499 | ASET (font_style_table, 1, Vfont_slant_table); | ||
| 5500 | ASET (font_style_table, 2, Vfont_width_table); | ||
| 5501 | 5495 | ||
| 5502 | DEFVAR_LISP ("font-log", Vfont_log, doc: /* | 5496 | DEFVAR_LISP ("font-log", Vfont_log, doc: /* |
| 5503 | A list that logs font-related actions and results, for debugging. | 5497 | A list that logs font-related actions and results, for debugging. |