(font_prop_validate_style): Adjusted for the format
authorKenichi Handa <handa@m17n.org>
Thu, 22 May 2008 05:21:06 +0000 (05:21 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 22 May 2008 05:21:06 +0000 (05:21 +0000)
change of font_style_table.

src/ChangeLog
src/font.c

index 77e7dc8..f9ed274 100644 (file)
@@ -1,5 +1,8 @@
 2008-05-22  Kenichi Handa  <handa@m17n.org>
 
+       * font.c (font_prop_validate_style): Adjusted for the format
+       change of font_style_table.
+
        * w32font.c (w32font_open_internal): Call Ffont_xlfd_name with
        two args.
 
 
        * font.c: Checking of FONT_DEBUG is moved to font.h.  All calls of
        xassert are changed to font_assert.  Delete many unused variables.
-       (Vfont_weight_table, Vfont_slant_table, Vfont_width_table):
-       New variables.
+       (Vfont_weight_table, Vfont_slant_table, Vfont_width_table): New
+       variables.
        (struct table_entry): Move from xfaces.c and modified.
        (weight_table, slant_table, width_table): Move from xfaces.c and
        contents adjusted for the change of struct table_entry.
-       (font_style_to_value, font_style_symbolic): Adjut for the format
-       change of font_style_table.
+       (font_style_to_value, font_style_symbolic): Adjusted for the
+       format change of font_style_table.
        (font_parse_family_registry): Don't overwrite existing foundry and
        family of font_spec.
        (font_score): Fix calculation of diff for sizes.
        (font_sort_entites): Call font_add_log.
        (font_delete_unmatched): Return a newly created list.
        (font_list_entities): Fix previous change.  Call font_add_log.
-       (font_matching_entity, font_open_entity, font_close_entity):
-       Call font_add_log.
+       (font_matching_entity, font_open_entity, font_close_entity): Call
+       font_add_log.
        (Ffont_xlfd_name): New arg FOLD-WILDCARDS.
        (Finternal_set_font_style_table): Delete.
        (BUILD_STYLE_TABLE): New macro.
index 44c5aef..84f2a2a 100644 (file)
@@ -500,13 +500,16 @@ font_prop_validate_style (style, val)
   if (INTEGERP (val))
     {
       n = XINT (val);
-      if ((n & 0xFF)
+      if (((n >> 4) & 0xF)
          >= ASIZE (AREF (font_style_table, prop - FONT_WEIGHT_INDEX)))
        val = Qerror;
       else
        {
-         Lisp_Object elt = AREF (AREF (font_style_table, prop - FONT_WEIGHT_INDEX), n & 0xFF);
-         if (XINT (XCDR (elt)) != (n >> 8))
+         Lisp_Object elt = AREF (AREF (font_style_table, prop - FONT_WEIGHT_INDEX), (n >> 4) & 0xF);
+
+         if ((n & 0xF) + 1 >= ASIZE (elt))
+           val = Qerror;
+         else if (XINT (AREF (elt, 0)) != (n >> 8))
            val = Qerror;
        }
     }