/[emacs]/emacs/src/xdisp.c
ViewVC logotype

Diff of /emacs/src/xdisp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.950 by handa, Thu Dec 30 12:25:28 2004 UTC revision 1.951 by kfstorm, Thu Dec 30 18:01:59 2004 UTC
# Line 308  Lisp_Object Qleft_margin, Qright_margin, Line 308  Lisp_Object Qleft_margin, Qright_margin,
308  Lisp_Object Qslice;  Lisp_Object Qslice;
309  Lisp_Object Qcenter;  Lisp_Object Qcenter;
310  Lisp_Object Qmargin, Qpointer;  Lisp_Object Qmargin, Qpointer;
311  Lisp_Object Qline_height, Qtotal;  Lisp_Object Qline_height;
312  extern Lisp_Object Qheight;  extern Lisp_Object Qheight;
313  extern Lisp_Object QCwidth, QCheight, QCascent;  extern Lisp_Object QCwidth, QCheight, QCascent;
314  extern Lisp_Object Qscroll_bar;  extern Lisp_Object Qscroll_bar;
# Line 3290  handle_display_prop (it) Line 3290  handle_display_prop (it)
3290  {  {
3291    Lisp_Object prop, object;    Lisp_Object prop, object;
3292    struct text_pos *position;    struct text_pos *position;
3293    /* Nonzero if some property replaces the display of the text itself.  */    /* Nonzero if some property replaces the display of the text itself.  */
3294    int display_replaced_p = 0;    int display_replaced_p = 0;
3295    
3296    if (STRINGP (it->string))    if (STRINGP (it->string))
# Line 3455  handle_single_display_spec (it, spec, ob Line 3455  handle_single_display_spec (it, spec, ob
3455      {      {
3456        if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))        if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))
3457          return 0;          return 0;
3458          
3459        it->font_height = XCAR (XCDR (spec));        it->font_height = XCAR (XCDR (spec));
3460        if (!NILP (it->font_height))        if (!NILP (it->font_height))
3461          {          {
# Line 18791  produce_stretch_glyph (it) Line 18791  produce_stretch_glyph (it)
18791    take_vertical_position_into_account (it);    take_vertical_position_into_account (it);
18792  }  }
18793    
18794  /* Calculate line-height and line-spacing properties.  /* Get line-height and line-spacing property at point.
18795     An integer value specifies explicit pixel value.     If line-height has format (HEIGHT TOTAL), return TOTAL
18796     A float value specifies relative value to current face height.     in TOTAL_HEIGHT.  */
    A cons (float . face-name) specifies relative value to  
    height of specified face font.  
   
    Returns height in pixels, or nil.  */  
18797    
18798  static Lisp_Object  static Lisp_Object
18799  calc_line_height_property (it, prop, font, boff, total)  get_line_height_property (it, prop)
18800       struct it *it;       struct it *it;
18801       Lisp_Object prop;       Lisp_Object prop;
      XFontStruct *font;  
      int boff, *total;  
18802  {  {
18803    Lisp_Object position, val;    Lisp_Object position, val;
   Lisp_Object face_name = Qnil;  
   int ascent, descent, height, override;  
18804    
18805    if (STRINGP (it->object))    if (STRINGP (it->object))
18806      position = make_number (IT_STRING_CHARPOS (*it));      position = make_number (IT_STRING_CHARPOS (*it));
# Line 18817  calc_line_height_property (it, prop, fon Line 18809  calc_line_height_property (it, prop, fon
18809    else    else
18810      return Qnil;      return Qnil;
18811    
18812    val = Fget_char_property (position, prop, it->object);    return Fget_char_property (position, prop, it->object);
18813    }
18814    
18815    if (NILP (val))  /* Calculate line-height and line-spacing properties.
18816      return val;     An integer value specifies explicit pixel value.
18817       A float value specifies relative value to current face height.
18818       A cons (float . face-name) specifies relative value to
18819       height of specified face font.
18820    
18821    if (total && CONSP (val) && EQ (XCAR (val), Qtotal))     Returns height in pixels, or nil.  */
     {  
       *total = 1;  
       val = XCDR (val);  
     }  
18822    
18823    if (INTEGERP (val))  
18824    static Lisp_Object
18825    calc_line_height_property (it, val, font, boff, override)
18826         struct it *it;
18827         Lisp_Object val;
18828         XFontStruct *font;
18829         int boff, override;
18830    {
18831      Lisp_Object face_name = Qnil;
18832      int ascent, descent, height;
18833    
18834      if (NILP (val) || INTEGERP (val) || (override && EQ (val, Qt)))
18835      return val;      return val;
18836    
18837    if (CONSP (val))    if (CONSP (val))
18838      {      {
18839        face_name = XCDR (val);        face_name = XCAR (val);
18840        val = XCAR (val);        val = XCDR (val);
18841      }        if (!NUMBERP (val))
18842    else if (SYMBOLP (val))          val = make_number (1);
18843      {        if (NILP (face_name))
18844        face_name = val;          {
18845        val = Qnil;            height = it->ascent + it->descent;
18846              goto scale;
18847            }
18848      }      }
18849    
   override = EQ (prop, Qline_height);  
   
18850    if (NILP (face_name))    if (NILP (face_name))
18851      {      {
18852        font = FRAME_FONT (it->f);        font = FRAME_FONT (it->f);
# Line 18885  calc_line_height_property (it, prop, fon Line 18888  calc_line_height_property (it, prop, fon
18888      }      }
18889    
18890    height = ascent + descent;    height = ascent + descent;
18891    
18892     scale:
18893    if (FLOATP (val))    if (FLOATP (val))
18894      height = (int)(XFLOAT_DATA (val) * height);      height = (int)(XFLOAT_DATA (val) * height);
18895    else if (INTEGERP (val))    else if (INTEGERP (val))
# Line 19097  x_produce_glyphs (it) Line 19102  x_produce_glyphs (it)
19102               increase that height */               increase that height */
19103    
19104            Lisp_Object height;            Lisp_Object height;
19105              Lisp_Object total_height = Qnil;
19106    
19107            it->override_ascent = -1;            it->override_ascent = -1;
19108            it->pixel_width = 0;            it->pixel_width = 0;
19109            it->nglyphs = 0;            it->nglyphs = 0;
19110    
19111            height = calc_line_height_property(it, Qline_height, font, boff, 0);            height = get_line_height_property(it, Qline_height);
19112              /* Split (line-height total-height) list */
19113              if (CONSP (height) && CONSP (XCDR (height)))
19114                {
19115                  total_height = XCAR (XCDR (height));
19116                  height = XCAR (height);
19117                }
19118              height = calc_line_height_property(it, height, font, boff, 1);
19119    
19120            if (it->override_ascent >= 0)            if (it->override_ascent >= 0)
19121              {              {
# Line 19116  x_produce_glyphs (it) Line 19129  x_produce_glyphs (it)
19129                it->descent = FONT_DESCENT (font) - boff;                it->descent = FONT_DESCENT (font) - boff;
19130              }              }
19131    
19132            if (EQ (height, make_number(0)))            if (EQ (height, Qt))
19133              {              {
19134                if (it->descent > it->max_descent)                if (it->descent > it->max_descent)
19135                  {                  {
# Line 19152  x_produce_glyphs (it) Line 19165  x_produce_glyphs (it)
19165                    && XINT (height) > it->ascent + it->descent)                    && XINT (height) > it->ascent + it->descent)
19166                  it->ascent = XINT (height) - it->descent;                  it->ascent = XINT (height) - it->descent;
19167    
19168                spacing = calc_line_height_property(it, Qline_spacing, font, boff, &total);                if (!NILP (total_height))
19169                    spacing = calc_line_height_property(it, total_height, font, boff, 0);
19170                  else
19171                    {
19172                      spacing = get_line_height_property(it, Qline_spacing);
19173                      spacing = calc_line_height_property(it, spacing, font, boff, 0);
19174                    }
19175                if (INTEGERP (spacing))                if (INTEGERP (spacing))
19176                  {                  {
19177                    extra_line_spacing = XINT (spacing);                    extra_line_spacing = XINT (spacing);
19178                    if (total)                    if (!NILP (total_height))
19179                      extra_line_spacing -= (it->phys_ascent + it->phys_descent);                      extra_line_spacing -= (it->phys_ascent + it->phys_descent);
19180                  }                  }
19181              }              }
# Line 22174  syms_of_xdisp () Line 22193  syms_of_xdisp ()
22193    staticpro (&Qcenter);    staticpro (&Qcenter);
22194    Qline_height = intern ("line-height");    Qline_height = intern ("line-height");
22195    staticpro (&Qline_height);    staticpro (&Qline_height);
   Qtotal = intern ("total");  
   staticpro (&Qtotal);  
22196    QCalign_to = intern (":align-to");    QCalign_to = intern (":align-to");
22197    staticpro (&QCalign_to);    staticpro (&QCalign_to);
22198    QCrelative_width = intern (":relative-width");    QCrelative_width = intern (":relative-width");

Legend:
Removed from v.1.950  
changed lines
  Added in v.1.951

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26