unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Text scale mode and additional fonts
@ 2023-12-30 11:10 Rahguzar
  2023-12-30 17:47 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Rahguzar @ 2023-12-30 11:10 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,
I sometimes write documents with a mix of Urdu and English. For Urdu I
have this in my config:

(setq +bidi-arabic-font (font-spec :family "Mehr Nastaliq Web"))

(set-fontset-font t 'arabic +bidi-arabic-font)

The font can be found here
https://mehrtype.com/product/mehr-nastaliq-web/

This works but Urdu text is too small. I can use `text-scale-increase`
but that also makes the English text bigger. So I tried this snippet
instead:

(setq +bidi-arabic-font (font-spec :family "Mehr Nastaliq Web" :size 28))

(set-fontset-font t 'arabic +bidi-arabic-font)

this makes the initial situation better but now the Urdu text is not
affected by the `text-scale-mode` commands.

To overcome this I have added a hook to `text-scale-mode-hook` to
manually adjust the font size. This improves the situation but feels
wrong since the `text-scale-mode` uses face remapping machinery which is
buffer local but the font sizes are global.

Is there a way to set a different size for my Urdu font that makes it
work seamlessly with `text-scale-mode`?

Thanks,
Rahguzar



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

* Re: Text scale mode and additional fonts
  2023-12-30 11:10 Text scale mode and additional fonts Rahguzar
@ 2023-12-30 17:47 ` Eli Zaretskii
  2023-12-30 18:12   ` [External] : " Drew Adams
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-12-30 17:47 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Rahguzar <rahguzar@zohomail.eu>
> Date: Sat, 30 Dec 2023 12:10:31 +0100
> 
> (setq +bidi-arabic-font (font-spec :family "Mehr Nastaliq Web" :size 28))
> 
> (set-fontset-font t 'arabic +bidi-arabic-font)
> 
> this makes the initial situation better but now the Urdu text is not
> affected by the `text-scale-mode` commands.

That's because the :size attribute is absolute: 28.  Instead, use a
relative value, a float such as 1.5, then it should scale with the
rest of the text.



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

* RE: [External] : Re: Text scale mode and additional fonts
  2023-12-30 17:47 ` Eli Zaretskii
@ 2023-12-30 18:12   ` Drew Adams
  2023-12-30 18:54     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2023-12-30 18:12 UTC (permalink / raw)
  To: Eli Zaretskii, help-gnu-emacs@gnu.org

> > (set-fontset-font t 'arabic +bidi-arabic-font)
> >
> > this makes the initial situation better but now the Urdu text is not
> > affected by the `text-scale-mode` commands.
> 
> That's because the :size attribute is absolute: 28.  Instead, use a
> relative value, a float such as 1.5, then it should scale with the
> rest of the text.

Very useful info.  But I don't see that spelled
out clearly in the doc.  There I find only
statements such as these.  Do they perhaps imply
what you stated? 

`:size'

VALUE must be a non-negative integer or a floating point number
specifying the font size.  It specifies the font size in pixels (if
VALUE is an integer), or in points (if VALUE is a float).
___

':size'
  The font size-either a non-negative integer that specifies the
  pixel size, or a floating-point number that specifies the
  point size.
___

Is such info already documented somewhere?
If not, should it be?  An explicit statement
about point-size being scalable might help.



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

* Re: Text scale mode and additional fonts
@ 2023-12-30 18:50 Rahguzar
  0 siblings, 0 replies; 7+ messages in thread
From: Rahguzar @ 2023-12-30 18:50 UTC (permalink / raw)
  To: eliz; +Cc: help-gnu-emacs

Hi Eli,

> That's because the :size attribute is absolute: 28.  Instead, use a
> relative value, a float such as 1.5, then it should scale with the
> rest of the text.

I tried

(setq +bidi-arabic-font (font-spec :family "Mehr Nastaliq Web" :size 28.0))

and it doesn't change the behavior. With it if I use `describe-char` on an
Urdu character, I always see,

ftcrhb:-ITU -Mehr Nastaliq Web-regular-normal-normal-*-37-*-*-*-*-0-iso10646-1 (#x8F)

regardless of the `text-scale-mode-amount`. So a float value changes the
units but not the behavior w.r.t. `text-scale-mode`.

Thanks,
Rahguzar



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

* Re: [External] : Re: Text scale mode and additional fonts
  2023-12-30 18:12   ` [External] : " Drew Adams
@ 2023-12-30 18:54     ` Eli Zaretskii
  2023-12-30 21:17       ` Drew Adams
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-12-30 18:54 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Drew Adams <drew.adams@oracle.com>
> Date: Sat, 30 Dec 2023 18:12:08 +0000
> 
> > > (set-fontset-font t 'arabic +bidi-arabic-font)
> > >
> > > this makes the initial situation better but now the Urdu text is not
> > > affected by the `text-scale-mode` commands.
> > 
> > That's because the :size attribute is absolute: 28.  Instead, use a
> > relative value, a float such as 1.5, then it should scale with the
> > rest of the text.
> 
> Very useful info.  But I don't see that spelled
> out clearly in the doc.  There I find only
> statements such as these.  Do they perhaps imply
> what you stated? 
> 
> `:size'
> 
> VALUE must be a non-negative integer or a floating point number
> specifying the font size.  It specifies the font size in pixels (if
> VALUE is an integer), or in points (if VALUE is a float).

Sorry, I was confused.  What I wrote is true for the :height
attribute of a face, not about :size in a font-spec.  IOW, to get what
he wants, the OP should define a face with :height attribute a float.



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

* RE: [External] : Re: Text scale mode and additional fonts
  2023-12-30 18:54     ` Eli Zaretskii
@ 2023-12-30 21:17       ` Drew Adams
  2023-12-31  0:58         ` Po Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2023-12-30 21:17 UTC (permalink / raw)
  To: Eli Zaretskii, help-gnu-emacs@gnu.org

> > > > (set-fontset-font t 'arabic +bidi-arabic-font)
> > > >
> > > > this makes the initial situation better but now the Urdu text is not
> > > > affected by the `text-scale-mode` commands.
> > >
> > > That's because the :size attribute is absolute: 28.  Instead, use a
> > > relative value, a float such as 1.5, then it should scale with the
> > > rest of the text.
> >
> > Very useful info.  But I don't see that spelled
> > out clearly in the doc.  There I find only
> > statements such as these.  Do they perhaps imply
> > what you stated?
> >
> > `:size'
> >
> > VALUE must be a non-negative integer or a floating point number
> > specifying the font size.  It specifies the font size in pixels (if
> > VALUE is an integer), or in points (if VALUE is a float).
> 
> Sorry, I was confused.  What I wrote is true for the :height
> attribute of a face, not about :size in a font-spec.  IOW, to get what
> he wants, the OP should define a face with :height attribute a float.

Thanks for clarifying.  That makes sense.




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

* Re: [External] : Re: Text scale mode and additional fonts
  2023-12-30 21:17       ` Drew Adams
@ 2023-12-31  0:58         ` Po Lu
  0 siblings, 0 replies; 7+ messages in thread
From: Po Lu @ 2023-12-31  0:58 UTC (permalink / raw)
  To: Drew Adams; +Cc: Eli Zaretskii, help-gnu-emacs@gnu.org

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

> Thanks for clarifying.  That makes sense.

It's also worth mentioning that face-font-rescale-alist frees you from
providing a scale factor in every place the font to be scaled is
specified.



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

end of thread, other threads:[~2023-12-31  0:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-30 11:10 Text scale mode and additional fonts Rahguzar
2023-12-30 17:47 ` Eli Zaretskii
2023-12-30 18:12   ` [External] : " Drew Adams
2023-12-30 18:54     ` Eli Zaretskii
2023-12-30 21:17       ` Drew Adams
2023-12-31  0:58         ` Po Lu
  -- strict thread matches above, loose matches on Subject: below --
2023-12-30 18:50 Rahguzar

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