all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How much is one em (image size unit)?
@ 2023-03-31 13:38 Akib Azmain Turja
  2023-03-31 14:40 ` Manuel Giraud via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 13+ messages in thread
From: Akib Azmain Turja @ 2023-03-31 13:38 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]


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?

So far I've reached till this:

--8<---------------cut here---------------start------------->8---
(insert (propertize "f" 'display '(image :type xpm :height (1 . em) :ascent center :data "/* XPM */
static char * blarg_xpm[] = {
\"16 7 2 1\",
\"* c #000000\",
\". c #ffffff\",
\"**..*...........\",
\"*.*.*...........\",
\"**..*..**.**..**\",
\"*.*.*.*.*.*..*.*\",
\"**..*..**.*...**\",
\"...............*\",
\".............**.\"
};")))
--8<---------------cut here---------------end--------------->8---

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How much is one em (image size unit)?
  2023-03-31 13:38 How much is one em (image size unit)? Akib Azmain Turja
@ 2023-03-31 14:40 ` Manuel Giraud via Users list for the GNU Emacs text editor
  2023-03-31 16:32   ` Akib Azmain Turja
  0 siblings, 1 reply; 13+ messages in thread
From: Manuel Giraud via Users list for the GNU Emacs text editor @ 2023-03-31 14:40 UTC (permalink / raw)
  To: Akib Azmain Turja; +Cc: help-gnu-emacs

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.
-- 
Manuel Giraud



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How much is one em (image size unit)?
  2023-03-31 14:40 ` Manuel Giraud via Users list for the GNU Emacs text editor
@ 2023-03-31 16:32   ` Akib Azmain Turja
  2023-03-31 17:36     ` Manuel Giraud via Users list for the GNU Emacs text editor
  2023-03-31 17:57     ` Eli Zaretskii
  0 siblings, 2 replies; 13+ messages in thread
From: Akib Azmain Turja @ 2023-03-31 16:32 UTC (permalink / raw)
  To: Manuel Giraud via Users list for the GNU Emacs text editor; +Cc: Manuel Giraud

[-- Attachment #1: Type: text/plain, Size: 905 bytes --]

Manuel Giraud via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> 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.

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How much is one em (image size unit)?
  2023-03-31 16:32   ` Akib Azmain Turja
@ 2023-03-31 17:36     ` Manuel Giraud via Users list for the GNU Emacs text editor
  2023-03-31 17:57     ` Eli Zaretskii
  1 sibling, 0 replies; 13+ messages in thread
From: Manuel Giraud via Users list for the GNU Emacs text editor @ 2023-03-31 17:36 UTC (permalink / raw)
  To: Akib Azmain Turja
  Cc: Manuel Giraud via Users list for the GNU Emacs text editor

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]

Akib Azmain Turja <akib@disroot.org> writes:

[...]

> But 1 em is pretty smaller than the default font size.  I want to make
> the image height and the text height same.

Here is how it look on my Emacs:

[-- Attachment #2: 2023-03-31T19:33.png --]
[-- Type: image/png, Size: 3282 bytes --]

[-- Attachment #3: Type: text/plain, Size: 18 bytes --]

-- 
Manuel Giraud

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How much is one em (image size unit)?
  2023-03-31 16:32   ` Akib Azmain Turja
  2023-03-31 17:36     ` Manuel Giraud via Users list for the GNU Emacs text editor
@ 2023-03-31 17:57     ` Eli Zaretskii
  2023-03-31 18:15       ` Akib Azmain Turja
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2023-03-31 17:57 UTC (permalink / raw)
  To: help-gnu-emacs

> 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



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How much is one em (image size unit)?
  2023-03-31 17:57     ` Eli Zaretskii
@ 2023-03-31 18:15       ` Akib Azmain Turja
  2023-04-01 12:59         ` Eli Zaretskii
  2023-04-02 22:27         ` Fu Yuan
  0 siblings, 2 replies; 13+ messages in thread
From: Akib Azmain Turja @ 2023-03-31 18:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]

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?

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How much is one em (image size unit)?
  2023-03-31 18:15       ` Akib Azmain Turja
@ 2023-04-01 12:59         ` Eli Zaretskii
  2023-04-02 22:27         ` Fu Yuan
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2023-04-01 12:59 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Akib Azmain Turja <akib@disroot.org>
> Cc: help-gnu-emacs@gnu.org
> Date: Sat, 01 Apr 2023 00:15:06 +0600
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > 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?

I don't understand your problem well enough, so I cannot answer that,
sorry.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How much is one em (image size unit)?
  2023-03-31 18:15       ` Akib Azmain Turja
  2023-04-01 12:59         ` Eli Zaretskii
@ 2023-04-02 22:27         ` Fu Yuan
  2023-04-04  9:41           ` Akib Azmain Turja
  1 sibling, 1 reply; 13+ messages in thread
From: Fu Yuan @ 2023-04-02 22:27 UTC (permalink / raw)
  To: Akib Azmain Turja; +Cc: Eli Zaretskii, help-gnu-emacs


> 在 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 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How much is one em (image size unit)?
  2023-04-02 22:27         ` Fu Yuan
@ 2023-04-04  9:41           ` Akib Azmain Turja
  2023-04-04 13:51             ` [External] : " Drew Adams
  0 siblings, 1 reply; 13+ messages in thread
From: Akib Azmain Turja @ 2023-04-04  9:41 UTC (permalink / raw)
  To: Fu Yuan; +Cc: Eli Zaretskii, help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]

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."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [External] : Re: How much is one em (image size unit)?
  2023-04-04  9:41           ` Akib Azmain Turja
@ 2023-04-04 13:51             ` Drew Adams
  2023-04-04 18:13               ` Akib Azmain Turja
  2023-04-05 11:52               ` Michael Heerdegen
  0 siblings, 2 replies; 13+ messages in thread
From: Drew Adams @ 2023-04-04 13:51 UTC (permalink / raw)
  To: Akib Azmain Turja, Fu Yuan; +Cc: Eli Zaretskii, help-gnu-emacs@gnu.org

half an M&M?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [External] : Re: How much is one em (image size unit)?
  2023-04-04 13:51             ` [External] : " Drew Adams
@ 2023-04-04 18:13               ` Akib Azmain Turja
  2023-04-04 18:46                 ` Drew Adams
  2023-04-05 11:52               ` Michael Heerdegen
  1 sibling, 1 reply; 13+ messages in thread
From: Akib Azmain Turja @ 2023-04-04 18:13 UTC (permalink / raw)
  To: Drew Adams; +Cc: Fu Yuan, Eli Zaretskii, help-gnu-emacs@gnu.org

[-- Attachment #1: Type: text/plain, Size: 267 bytes --]

Drew Adams <drew.adams@oracle.com> writes:

> half an M&M?

What?

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [External] : Re: How much is one em (image size unit)?
  2023-04-04 18:13               ` Akib Azmain Turja
@ 2023-04-04 18:46                 ` Drew Adams
  0 siblings, 0 replies; 13+ messages in thread
From: Drew Adams @ 2023-04-04 18:46 UTC (permalink / raw)
  To: Akib Azmain Turja; +Cc: Fu Yuan, Eli Zaretskii, help-gnu-emacs@gnu.org

> > half an M&M?
> 
> What?

Sorry; I couldn't resist.

https://en.wikipedia.org/wiki/M%26M%27s



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [External] : Re: How much is one em (image size unit)?
  2023-04-04 13:51             ` [External] : " Drew Adams
  2023-04-04 18:13               ` Akib Azmain Turja
@ 2023-04-05 11:52               ` Michael Heerdegen
  1 sibling, 0 replies; 13+ messages in thread
From: Michael Heerdegen @ 2023-04-05 11:52 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams <drew.adams@oracle.com> writes:

> half an M&M?

That was a really really good one.

Michael.




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-04-05 11:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 13:38 How much is one em (image size unit)? Akib Azmain Turja
2023-03-31 14:40 ` Manuel Giraud via Users list for the GNU Emacs text editor
2023-03-31 16:32   ` Akib Azmain Turja
2023-03-31 17:36     ` Manuel Giraud via Users list for the GNU Emacs text editor
2023-03-31 17:57     ` Eli Zaretskii
2023-03-31 18:15       ` Akib Azmain Turja
2023-04-01 12:59         ` Eli Zaretskii
2023-04-02 22:27         ` Fu Yuan
2023-04-04  9:41           ` Akib Azmain Turja
2023-04-04 13:51             ` [External] : " Drew Adams
2023-04-04 18:13               ` Akib Azmain Turja
2023-04-04 18:46                 ` Drew Adams
2023-04-05 11:52               ` Michael Heerdegen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.