help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Attribute names when calling face-attribute


From: fatiparty
Subject: Attribute names when calling face-attribute
Date: Thu, 13 Jan 2022 02:09:33 +0100 (CET)

Jan 13, 2022, 12:54 by help-gnu-emacs@gnu.org:

> fatiparty--- via Users list for the GNU Emacs text editor wrote:
>
>> (* height ricci-scale)))) ; assumes height is integer
>>
>
> You can do 
>
>  (and (integerp height) height)
>
> to make sure it crashes on bogus data. This is better than to
> have it almost always crash on bogus data ...
>

Have changed like this, with (* glyph-size ricci-scale).  This seems to work.
I think that glyph-size should be a defined variable, rather than using "height"
as height seems to be only an attribute for the height of the font.
(defun ricci-size (glyph-size)
  "Return integer SIZE of superior and inferior glyph.
GLYPH-SIZE  Typeface height. Integer at 1/10 the point size.
Not smaller than value set by `ricci-minsize'."

  (ceiling
     (max

        (if (integerp ricci-minsize)
            ricci-minsize
          (condition-case nil ; for bootstrapping
              (* ricci-minsize (face-attribute 'default :height))
            (error 0)) )

        (* glyph-size ricci-scale)) ))  ; assumes height is integer.

I plan to allow floating point values, but that requires some thought. 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]