unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: Font size
  2021-08-04 13:45   ` Eli Zaretskii
@ 2021-08-04 13:58     ` Kévin Le Gouguec
  2021-08-04 15:46       ` Yuri Khan
  0 siblings, 1 reply; 15+ messages in thread
From: Kévin Le Gouguec @ 2021-08-04 13:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: masm+emacs, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> One hiccup: unless I'm mistaken, this build does not consult
>> ~/.Xresources anymore.
>
> That's by design, AFAIU.  Yuuki even said that not so long ago.

Right.  To recap my other questions:

1. Why do Xresources and GSettings sizes differ from what C-u C-x =
   reports?

2. Why doesn't "10.5" work with GSettings, despite it working with
   Xresources?

3. Is there a bug to report there?



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

* Re: Font size
  2021-08-04 13:55   ` Font size (was: Merging the pgtk branch) Eli Zaretskii
@ 2021-08-04 14:15     ` Kévin Le Gouguec
  0 siblings, 0 replies; 15+ messages in thread
From: Kévin Le Gouguec @ 2021-08-04 14:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: masm+emacs, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Kévin Le Gouguec <kevin.legouguec@gmail.com>
>> Date: Wed, 04 Aug 2021 14:53:04 +0200
>> Cc: Yuuki Harano <masm+emacs@masm11.me>, Eli Zaretskii <eliz@gnu.org>
>> 
>> $ gsettings set org.gnome.desktop.interface monospace-font-name 'DejaVu Sans Mono 10.5'
>> 
>> Emacs emits a warning:
>> 
>> > set-face-attribute: Font not available: #<font-spec nil nil DejaVu\
>> > Sans\ Mono\ 10\.5 nil nil nil nil nil nil nil nil nil ((:name
>> > . "DejaVu Sans Mono 10.5") (:user-spec . "DejaVu Sans Mono 10.5"))>
>> 
>> Is this expected?
>
> I don't know if it's expected, but the error message says that the
> "10.5" part is not expected there.  What happens if you use "10"
> instead of "10.5"?

Cf. the paragraph just above:

> On master --with-gconf and feature/pgtk, with font-use-system-font set
> to t, here is what C-u C-x = says for various GSettings:
> 
> GSettings³      C-u C-x =
> 9               12
> 10              13
> 10.5            ERROR (see below)
> 11              15
> 
> ³ "XX" in "gsettings org.gnome.desktop.interface monospace-font-name 'DejaVu Sans Mono XX'"

What I don't understand:

1. How come GSettings/Xresources and Emacs use different "units"?
   (Apologies if the answer lies somewhere in the manual, which it most
   certainly does)

2. Why does 10.5 work with Xresources and not GSettings?



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

* Re: Font size
  2021-08-04 13:58     ` Font size Kévin Le Gouguec
@ 2021-08-04 15:46       ` Yuri Khan
  2021-08-04 16:11         ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Yuri Khan @ 2021-08-04 15:46 UTC (permalink / raw)
  To: Kévin Le Gouguec; +Cc: Eli Zaretskii, masm+emacs, Emacs developers

On Wed, 4 Aug 2021 at 20:59, Kévin Le Gouguec <kevin.legouguec@gmail.com> wrote:
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> One hiccup: unless I'm mistaken, this build does not consult
> >> ~/.Xresources anymore.
> >
> > That's by design, AFAIU.  Yuuki even said that not so long ago.
>
> Right.  To recap my other questions:
>
> 1. Why do Xresources and GSettings sizes differ from what C-u C-x =
>    reports?

Likely because the former are specified in points (1 pt = 1/72 in) and
the latter in pixels (1 px = 1/96 in by default).



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

* Re: Font size
  2021-08-04 15:46       ` Yuri Khan
@ 2021-08-04 16:11         ` Eli Zaretskii
  2021-08-04 17:09           ` Yuri Khan
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2021-08-04 16:11 UTC (permalink / raw)
  To: Yuri Khan; +Cc: masm+emacs, emacs-devel, kevin.legouguec

> From: Yuri Khan <yuri.v.khan@gmail.com>
> Date: Wed, 4 Aug 2021 22:46:25 +0700
> Cc: Eli Zaretskii <eliz@gnu.org>, masm+emacs@masm11.me, 
> 	Emacs developers <emacs-devel@gnu.org>
> 
> > 1. Why do Xresources and GSettings sizes differ from what C-u C-x =
> >    reports?
> 
> Likely because the former are specified in points (1 pt = 1/72 in) and
> the latter in pixels (1 px = 1/96 in by default).

is this tru also for GSettings font sizes in the X+GTK build of Emacs?
Because then we'd need to document that in the "Fonts" section of the
Emacs manual, where all the different methods of specifying a font are
described.



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

* Re: Font size
  2021-08-04 16:11         ` Eli Zaretskii
@ 2021-08-04 17:09           ` Yuri Khan
  2021-08-04 18:23             ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Yuri Khan @ 2021-08-04 17:09 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: masm+emacs, Emacs developers, Kévin Le Gouguec

On Wed, 4 Aug 2021 at 23:11, Eli Zaretskii <eliz@gnu.org> wrote:

> > > 1. Why do Xresources and GSettings sizes differ from what C-u C-x =
> > >    reports?
> >
> > Likely because the former are specified in points (1 pt = 1/72 in) and
> > the latter in pixels (1 px = 1/96 in by default).
>
> is this tru also for GSettings font sizes in the X+GTK build of Emacs?
> Because then we'd need to document that in the "Fonts" section of the
> Emacs manual, where all the different methods of specifying a font are
> described.

The org.gnome.desktop.interface GSettings schema does not say
explicitly which units the size is specified in, and whether
fractional values are allowed.

    <key name="font-name" type="s">
      <default>'Cantarell 11'</default>
      <summary>Default font</summary>
      <description>
        Name of the default font used by gtk+.
      </description>
    </key>
    <key name="document-font-name" type="s">
      <default>'Cantarell 11'</default>
      <summary>Document font</summary>
      <description>
        Name of the default font used for reading documents.
      </description>
    </key>
    <key name="monospace-font-name" type="s">
      <default>'Source Code Pro 10'</default>
      <summary>Monospace font</summary>
      <description>
        Name of a monospaced (fixed-width) font for use in locations like
        terminals.
      </description>
    </key>



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

* Re: Font size
  2021-08-04 17:09           ` Yuri Khan
@ 2021-08-04 18:23             ` Eli Zaretskii
  2021-08-04 18:33               ` Yuri Khan
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2021-08-04 18:23 UTC (permalink / raw)
  To: Yuri Khan; +Cc: masm+emacs, emacs-devel, kevin.legouguec

> From: Yuri Khan <yuri.v.khan@gmail.com>
> Date: Thu, 5 Aug 2021 00:09:47 +0700
> Cc: Kévin Le Gouguec <kevin.legouguec@gmail.com>, 
> 	masm+emacs@masm11.me, Emacs developers <emacs-devel@gnu.org>
> 
> On Wed, 4 Aug 2021 at 23:11, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > > > 1. Why do Xresources and GSettings sizes differ from what C-u C-x =
> > > >    reports?
> > >
> > > Likely because the former are specified in points (1 pt = 1/72 in) and
> > > the latter in pixels (1 px = 1/96 in by default).
> >
> > is this tru also for GSettings font sizes in the X+GTK build of Emacs?
> > Because then we'd need to document that in the "Fonts" section of the
> > Emacs manual, where all the different methods of specifying a font are
> > described.
> 
> The org.gnome.desktop.interface GSettings schema does not say
> explicitly which units the size is specified in, and whether
> fractional values are allowed.

My question was whether the same units are likely to be used in the
X+GTK build as they are in the PGTK build.  IOW, that your guess of
the units being 1/96 inch is true or false for both of them.



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

* Re: Font size
  2021-08-04 18:23             ` Eli Zaretskii
@ 2021-08-04 18:33               ` Yuri Khan
  2021-08-05 14:51                 ` Robert Pluim
  0 siblings, 1 reply; 15+ messages in thread
From: Yuri Khan @ 2021-08-04 18:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: masm+emacs, Emacs developers, Kévin Le Gouguec

On Thu, 5 Aug 2021 at 01:24, Eli Zaretskii <eliz@gnu.org> wrote:

> My question was whether the same units are likely to be used in the
> X+GTK build as they are in the PGTK build.  IOW, that your guess of
> the units being 1/96 inch is true or false for both of them.

I’m not related to GNOME or GTK+ development, but I would be much
surprised if font sizes were specified in anything other than points
(which are 1/72 in, not 1/96 in); and especially if GTK behaved
differently in that regard between X and Wayland and/or depended on
other factors other than poorly configured screen DPI.



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

* Re: Font size
  2021-08-04 18:33               ` Yuri Khan
@ 2021-08-05 14:51                 ` Robert Pluim
  2021-08-05 16:19                   ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Robert Pluim @ 2021-08-05 14:51 UTC (permalink / raw)
  To: Yuri Khan
  Cc: Eli Zaretskii, Kévin Le Gouguec, masm+emacs,
	Emacs developers

>>>>> On Thu, 5 Aug 2021 01:33:16 +0700, Yuri Khan <yuri.v.khan@gmail.com> said:

    Yuri> On Thu, 5 Aug 2021 at 01:24, Eli Zaretskii <eliz@gnu.org> wrote:
    >> My question was whether the same units are likely to be used in the
    >> X+GTK build as they are in the PGTK build.  IOW, that your guess of
    >> the units being 1/96 inch is true or false for both of them.

    Yuri> I’m not related to GNOME or GTK+ development, but I would be much
    Yuri> surprised if font sizes were specified in anything other than points
    Yuri> (which are 1/72 in, not 1/96 in); and especially if GTK behaved
    Yuri> differently in that regard between X and Wayland and/or depended on
    Yuri> other factors other than poorly configured screen DPI.

Fontconfig talks about sizes in points (but allows them to be
fractional, the underlying data type is a double)

Robert
-- 



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

* Re: Font size
  2021-08-05 14:51                 ` Robert Pluim
@ 2021-08-05 16:19                   ` Eli Zaretskii
  0 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2021-08-05 16:19 UTC (permalink / raw)
  To: Robert Pluim; +Cc: masm+emacs, emacs-devel, kevin.legouguec, yuri.v.khan

> From: Robert Pluim <rpluim@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  masm+emacs@masm11.me,  Emacs developers
>  <emacs-devel@gnu.org>,  Kévin Le Gouguec
>  <kevin.legouguec@gmail.com>
> Date: Thu, 05 Aug 2021 16:51:57 +0200
> 
> >>>>> On Thu, 5 Aug 2021 01:33:16 +0700, Yuri Khan <yuri.v.khan@gmail.com> said:
> 
>     Yuri> On Thu, 5 Aug 2021 at 01:24, Eli Zaretskii <eliz@gnu.org> wrote:
>     >> My question was whether the same units are likely to be used in the
>     >> X+GTK build as they are in the PGTK build.  IOW, that your guess of
>     >> the units being 1/96 inch is true or false for both of them.
> 
>     Yuri> I’m not related to GNOME or GTK+ development, but I would be much
>     Yuri> surprised if font sizes were specified in anything other than points
>     Yuri> (which are 1/72 in, not 1/96 in); and especially if GTK behaved
>     Yuri> differently in that regard between X and Wayland and/or depended on
>     Yuri> other factors other than poorly configured screen DPI.
> 
> Fontconfig talks about sizes in points (but allows them to be
> fractional, the underlying data type is a double)

I wasn't talking about the Fontconfig format of specifying a font, I
was talking about the GTK format.  They are different, see the node
"Fonts" in the Emacs manual.



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

* Font size
@ 2024-08-20  5:25 Anand Tamariya
  2024-08-20 12:11 ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Anand Tamariya @ 2024-08-20  5:25 UTC (permalink / raw)
  To: Emacs Devel

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

Why does this API keep increasing the font size? With a selection, try the
test command.

Alternatively, what's the best way to query the font-size at point and
re-apply using face property?


font-info
[ OPENED-NAME FULL-NAME SIZE *HEIGHT* BASELINE-OFFSET RELATIVE-COMPOSE
    DEFAULT-ASCENT MAX-WIDTH ASCENT DESCENT SPACE-WIDTH AVERAGE-WIDTH
    FILENAME CAPABILITY ]

(defun test(start end)
  (interactive "r")
  (let* ((size (* 10 (aref (font-info (font-at start)) 3))))
    (put-text-property start end 'face
      (list :inherit 'unspecified :height size))))

[-- Attachment #2: Type: text/html, Size: 776 bytes --]

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

* Re: Font size
  2024-08-20  5:25 Font size Anand Tamariya
@ 2024-08-20 12:11 ` Eli Zaretskii
  2024-08-20 12:56   ` Anand Tamariya
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2024-08-20 12:11 UTC (permalink / raw)
  To: Anand Tamariya; +Cc: emacs-devel

> From: Anand Tamariya <atamariya@gmail.com>
> Date: Tue, 20 Aug 2024 10:55:45 +0530
> 
> Why does this API keep increasing the font size? With a selection, try the test command.

Because the factor of 10 is wrong, AFAIU.

> Alternatively, what's the best way to query the font-size at point and re-apply using face property?

I don't understand: if you don't want to change the height, then why
do you have :height in the face spec at all?

In any case, :height could be a relative value of 1.0.



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

* Re: Font size
  2024-08-20 12:11 ` Eli Zaretskii
@ 2024-08-20 12:56   ` Anand Tamariya
  2024-08-20 13:17     ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Anand Tamariya @ 2024-08-20 12:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

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

> Why does this API keep increasing the font size? With a selection, try
> the test command.
>
> Because the factor of 10 is wrong, AFAIU.
>
Factor of 1 decreases the font size.

> Alternatively, what's the best way to query the font-size at point and
> re-apply using face property?
>
> I don't understand: if you don't want to change the height, then why
> do you have :height in the face spec at all?
>
> In any case, :height could be a relative value of 1.0.
>
 I'm trying to increase/decrease the font size in the selected region. So I
need a base value to work with.

[-- Attachment #2: Type: text/html, Size: 1016 bytes --]

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

* Re: Font size
  2024-08-20 12:56   ` Anand Tamariya
@ 2024-08-20 13:17     ` Eli Zaretskii
  2024-08-20 13:37       ` Anand Tamariya
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2024-08-20 13:17 UTC (permalink / raw)
  To: Anand Tamariya; +Cc: emacs-devel

> From: Anand Tamariya <atamariya@gmail.com>
> Date: Tue, 20 Aug 2024 18:26:15 +0530
> Cc: emacs-devel@gnu.org
> 
> 
>  > Why does this API keep increasing the font size? With a selection, try the test command.
> 
>  Because the factor of 10 is wrong, AFAIU.
> 
> Factor of 1 decreases the font size. 

Yes, because 1 is also wrong.

>  > Alternatively, what's the best way to query the font-size at point and re-apply using face property?
> 
>  I don't understand: if you don't want to change the height, then why
>  do you have :height in the face spec at all?
> 
>  In any case, :height could be a relative value of 1.0.
> 
>  I'm trying to increase/decrease the font size in the selected region. So I need a base value to work with.

And relative values like 1.2 or 0.8 don't fit the bill in your case?
Using relative sizes frees you from the need to compute absolute size
values.



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

* Re: Font size
  2024-08-20 13:17     ` Eli Zaretskii
@ 2024-08-20 13:37       ` Anand Tamariya
  2024-08-20 13:52         ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Anand Tamariya @ 2024-08-20 13:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

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

> >  I'm trying to increase/decrease the font size in the selected region.
> So I need a base value to work with.
>
> And relative values like 1.2 or 0.8 don't fit the bill in your case?
> Using relative sizes frees you from the need to compute absolute size
> values.
>
I'm exploring a scenario where the text is inside a fixed shape. So
absolute size is important.

[-- Attachment #2: Type: text/html, Size: 623 bytes --]

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

* Re: Font size
  2024-08-20 13:37       ` Anand Tamariya
@ 2024-08-20 13:52         ` Eli Zaretskii
  0 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2024-08-20 13:52 UTC (permalink / raw)
  To: Anand Tamariya; +Cc: emacs-devel

> From: Anand Tamariya <atamariya@gmail.com>
> Date: Tue, 20 Aug 2024 19:07:33 +0530
> Cc: emacs-devel@gnu.org
> 
>  >  I'm trying to increase/decrease the font size in the selected region. So I need a base value to work
>  with.
> 
>  And relative values like 1.2 or 0.8 don't fit the bill in your case?
>  Using relative sizes frees you from the need to compute absolute size
>  values.
> 
> I'm exploring a scenario where the text is inside a fixed shape. So absolute size is important. 

Not sure I understand why float values don't do what you want, but you
could find the right value of the factor empirically.  In my case, I
found that 6 is the right value.



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

end of thread, other threads:[~2024-08-20 13:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-20  5:25 Font size Anand Tamariya
2024-08-20 12:11 ` Eli Zaretskii
2024-08-20 12:56   ` Anand Tamariya
2024-08-20 13:17     ` Eli Zaretskii
2024-08-20 13:37       ` Anand Tamariya
2024-08-20 13:52         ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2021-08-01  8:53 Merging the pgtk branch Eli Zaretskii
2021-08-04 12:53 ` Font size (was: Merging the pgtk branch) Kévin Le Gouguec
2021-08-04 13:45   ` Eli Zaretskii
2021-08-04 13:58     ` Font size Kévin Le Gouguec
2021-08-04 15:46       ` Yuri Khan
2021-08-04 16:11         ` Eli Zaretskii
2021-08-04 17:09           ` Yuri Khan
2021-08-04 18:23             ` Eli Zaretskii
2021-08-04 18:33               ` Yuri Khan
2021-08-05 14:51                 ` Robert Pluim
2021-08-05 16:19                   ` Eli Zaretskii
2021-08-04 13:55   ` Font size (was: Merging the pgtk branch) Eli Zaretskii
2021-08-04 14:15     ` Font size Kévin Le Gouguec

Code repositories for project(s) associated with this public inbox

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

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