* Attribute names when calling face-attribute
@ 2022-01-13 0:34 fatiparty--- via Users list for the GNU Emacs text editor
2022-01-13 0:54 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-13 8:20 ` Eli Zaretskii
0 siblings, 2 replies; 7+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-13 0:34 UTC (permalink / raw)
To: Help Gnu Emacs
I am implementing ricci calculus notation.
Regarding the face-attribute function. Is the attribute pre-defined or can
I select the attribute name?
For instance, could I call "(face-attribute 'default :size)" rather than
"(face-attribute 'default :height)"?
Here is my function
(defun ricci-size (size)
"Return integer SIZE of superior and inferior glyph.
SIZE typeface height. Integer scaled in 1/10 of 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)))
(* height ricci-scale)))) ; assumes height is integer.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Attribute names when calling face-attribute
2022-01-13 0:34 Attribute names when calling face-attribute fatiparty--- via Users list for the GNU Emacs text editor
@ 2022-01-13 0:54 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-13 1:09 ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-13 8:20 ` Eli Zaretskii
1 sibling, 1 reply; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-01-13 0:54 UTC (permalink / raw)
To: help-gnu-emacs
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 ...
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Attribute names when calling face-attribute
2022-01-13 0:54 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-01-13 1:09 ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-13 1:36 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 7+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-13 1:09 UTC (permalink / raw)
To: Emanuel Berg; +Cc: Help Gnu Emacs
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Attribute names when calling face-attribute
2022-01-13 1:09 ` fatiparty--- via Users list for the GNU Emacs text editor
@ 2022-01-13 1:36 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-13 2:20 ` fatiparty--- via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-01-13 1:36 UTC (permalink / raw)
To: help-gnu-emacs
fatiparty--- via Users list for the GNU Emacs text editor wrote:
>> 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.
Yuk!
What's with all the NO-BREAK SPACEs?
Remove please ...
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Attribute names when calling face-attribute
2022-01-13 1:36 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-01-13 2:20 ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-13 4:11 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 7+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-13 2:20 UTC (permalink / raw)
To: Emanuel Berg; +Cc: Help Gnu Emacs
Jan 13, 2022, 13:36 by help-gnu-emacs@gnu.org:
> fatiparty--- via Users list for the GNU Emacs text editor wrote:
>
>>> 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.
>>
>
> Yuk!
>
> What's with all the NO-BREAK SPACEs?
>
> Remove please ...
>
Has this to do with the email composition or the code?
> --
> underground experts united
> https://dataswamp.org/~incal
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Attribute names when calling face-attribute
2022-01-13 2:20 ` fatiparty--- via Users list for the GNU Emacs text editor
@ 2022-01-13 4:11 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 0 replies; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-01-13 4:11 UTC (permalink / raw)
To: help-gnu-emacs
fatiparty--- via Users list for the GNU Emacs text editor wrote:
>>> (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.
>>>
>>
>> Yuk!
>>
>> What's with all the NO-BREAK SPACEs?
>>
>> Remove please ...
>
> Has this to do with the email composition or the code?
Since the code is part of the message here if I kill and yank
it in an Elisp buffer it is still there, and I don't have any
other source (ha) for it ... maybe it is just the e-mail for
you but that doesn't help anyone else.
Normal SPACEs will do ...
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Attribute names when calling face-attribute
2022-01-13 0:34 Attribute names when calling face-attribute fatiparty--- via Users list for the GNU Emacs text editor
2022-01-13 0:54 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-01-13 8:20 ` Eli Zaretskii
1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2022-01-13 8:20 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Thu, 13 Jan 2022 01:34:53 +0100 (CET)
> From: fatiparty--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
>
> Regarding the face-attribute function. Is the attribute pre-defined or can
> I select the attribute name?
They are predefined (and documented in the ELisp manual).
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-01-13 8:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-13 0:34 Attribute names when calling face-attribute fatiparty--- via Users list for the GNU Emacs text editor
2022-01-13 0:54 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-13 1:09 ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-13 1:36 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-13 2:20 ` fatiparty--- via Users list for the GNU Emacs text editor
2022-01-13 4:11 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-13 8:20 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).