unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How does Emacs render glyphs?
@ 2024-11-24 15:03 Roland Lutz
  2024-11-24 16:33 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Roland Lutz @ 2024-11-24 15:03 UTC (permalink / raw)
  To: emacs-devel

Hi,

I've been fiddling with Pango text rendering and noticed that the output 
looks kind of weird.  Using the same font and size, glyphs rendered via 
Pango appear to be one pixel shorter and slightly narrower than in Emacs:

https://hedmen.org/vera-11-emacs.png
https://hedmen.org/vera-11-pango.png

Since I very much prefer the way Emacs renders text, I'd like to replicate 
this behavior.  Do I assume correctly that Emacs uses Pango internally? 
Are there specific parameters I need to pass to Pango in order to achieve 
this result?

Roland




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

* Re: How does Emacs render glyphs?
  2024-11-24 15:03 How does Emacs render glyphs? Roland Lutz
@ 2024-11-24 16:33 ` Eli Zaretskii
  2024-11-25  0:37   ` Po Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2024-11-24 16:33 UTC (permalink / raw)
  To: Roland Lutz, Po Lu; +Cc: emacs-devel

> Date: Sun, 24 Nov 2024 16:03:29 +0100 (CET)
> From: Roland Lutz <rlutz@hedmen.org>
> 
> Hi,
> 
> I've been fiddling with Pango text rendering and noticed that the output 
> looks kind of weird.  Using the same font and size, glyphs rendered via 
> Pango appear to be one pixel shorter and slightly narrower than in Emacs:
> 
> https://hedmen.org/vera-11-emacs.png
> https://hedmen.org/vera-11-pango.png
> 
> Since I very much prefer the way Emacs renders text, I'd like to replicate 
> this behavior.  Do I assume correctly that Emacs uses Pango internally? 

No, I don't think Emacs uses Pango, at least not directly.  Emacs
built with Cairo might use Pango indirectly; all the other
configurations AFAIK do not.

Po Lu, please correct me if I'm wrong.



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

* Re: How does Emacs render glyphs?
  2024-11-24 16:33 ` Eli Zaretskii
@ 2024-11-25  0:37   ` Po Lu
  2024-11-27 15:59     ` Roland Lutz
  0 siblings, 1 reply; 4+ messages in thread
From: Po Lu @ 2024-11-25  0:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Roland Lutz, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Sun, 24 Nov 2024 16:03:29 +0100 (CET)
>> From: Roland Lutz <rlutz@hedmen.org>
>> 
>> Hi,
>> 
>> I've been fiddling with Pango text rendering and noticed that the output 
>> looks kind of weird.  Using the same font and size, glyphs rendered via 
>> Pango appear to be one pixel shorter and slightly narrower than in Emacs:
>> 
>> https://hedmen.org/vera-11-emacs.png
>> https://hedmen.org/vera-11-pango.png
>> 
>> Since I very much prefer the way Emacs renders text, I'd like to replicate 
>> this behavior.  Do I assume correctly that Emacs uses Pango internally? 
>
> No, I don't think Emacs uses Pango, at least not directly.  Emacs
> built with Cairo might use Pango indirectly; all the other
> configurations AFAIK do not.
>
> Po Lu, please correct me if I'm wrong.

No, Emacs doesn't use Pango.  The discrepancy observed by the OP is
probably the product of inconsistencies between either hinting or glyph
metrics rounding (but it's hard to say from this description who is in
the wrong).



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

* Re: How does Emacs render glyphs?
  2024-11-25  0:37   ` Po Lu
@ 2024-11-27 15:59     ` Roland Lutz
  0 siblings, 0 replies; 4+ messages in thread
From: Roland Lutz @ 2024-11-27 15:59 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

On Mon, 25 Nov 2024, Po Lu wrote:
> No, Emacs doesn't use Pango.  The discrepancy observed by the OP is
> probably the product of inconsistencies between either hinting or glyph
> metrics rounding (but it's hard to say from this description who is in
> the wrong).

Thank you!  This was the hint that allowed me to solve this.

When rendering glyphs via FreeType and disabling hinting, I get the 
desired result.  For reference, here is the regular FreeType output 
(with hinting):

https://hedmen.org/vera-11-freetype.png

Roland




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

end of thread, other threads:[~2024-11-27 15:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-24 15:03 How does Emacs render glyphs? Roland Lutz
2024-11-24 16:33 ` Eli Zaretskii
2024-11-25  0:37   ` Po Lu
2024-11-27 15:59     ` Roland Lutz

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