[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How much is one em (image size unit)?
From: |
Akib Azmain Turja |
Subject: |
Re: How much is one em (image size unit)? |
Date: |
Tue, 04 Apr 2023 15:41:06 +0600 |
Fu Yuan <casouri@gmail.com> writes:
>> 在 2023年4月1日,上午5:35,Akib Azmain Turja <akib@disroot.org> 写道:
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>>>> From: Akib Azmain Turja <akib@disroot.org>
>>>> Cc: Manuel Giraud <manuel@ledu-giraud.fr>
>>>> Date: Fri, 31 Mar 2023 22:32:49 +0600
>>>>
>>>>> Akib Azmain Turja <akib@disroot.org> writes:
>>>>>
>>>>>> I'm trying to show an image such that it has same height as the text and
>>>>>> resizes relatively with text scale. I've achieved this with the 'em'
>>>>>> unit as described in (elisp)Image Descriptors. But 1 em seems to be
>>>>>> pretty smaller than the font size. How to figure out correct value in
>>>>>> em unit such that image and the text has correct height?
>>>>>
>>>>> Hi,
>>>>>
>>>>> FWIW, your example works for me and scales accordingly when I zoom.
>>>>
>>>> But 1 em is pretty smaller than the default font size. I want to make
>>>> the image height and the text height same.
>>>
>>> Maybe this page will help you:
>>>
>>> https://learn.microsoft.com/en-us/typography/opentype/spec/ttch01
>>>
>>
>> Thanks, but I couldn't understand much. Say the line height is X em,
>> then how can I figure out that X?
>
> 1 em equals to the text height. If your 1 em looks smaller than the text
> height, something might be wrong. Perhaps post a screenshot of what you get?
>
> Yuan
I have found the size of em unit, it's actually the font size (as in the
the SIZE argument of font-spec). So, line height in em is:
#+begin_src emacs-lisp
(/ (float (default-font-height)) (font-get (font-spec :name (face-font
'default)) :size))
#+end_src
--
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."
signature.asc
Description: PGP signature