New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rounding differences between harfbuzz and cairo #1892
Comments
What kind of hinting setting is that with? |
everything is default: font options: antialias 0 subpixel_order 0 hint-style 0 hint-metrics 0 i can turn hint-metrics off if you think it matters for what cairo returns Look at that, it does:
This is cairo with hint-metrics off |
Where does this leave us ? harfbuzz is giving me the same values are cairo with hint-metrics off. |
On 07/08/2019 01:38, Matthias Clasen wrote:
Where does this leave us ? harfbuzz is giving me the same values are
cairo with hint-metrics off.
But rounding those values on the pango side does not reproduce the same
values as cairo with hint-metrics on.
Simply rounding metrics to integer pixel values is not the same as
hinting them. The instructions in the font may decide to modify the
nominal metrics (e.g. to maintain consistent stem widths or counters or
sidebearings across a glyph like "m") more extensively than just
rounding to pixels.
|
Having read through the chain of issues (arch, two pango issues, and here) it looks like pango has dropped support for metric hinting? Looking through the changes I see where pango_fc_hb_font_get_glyph_advance was no longer set on the hb_font_funcs_t but I don't see where the hinting was restored. It appears the the raw font data is being passed to HarfBuzz, but HarfBuzz doesn't do hinting itself, and don't see a place where pango is creating an FT_Face to pass to HarfBuzz set up to return hinted metrics (I'm pretty sure it isn't doing this, otherwise BDF fonts would still work). |
Yes, Pango uses HarfBuzz OT font function and thus intentionally not using hinted metrics. I don’t think there is any issue to fix here, everything is working as intended. |
I suppose my point was that pango appears to now be incapable of doing layout with hinted metrics, but users are still drawing with hinted glyphs... leading to less than desirable spacing (Chromium had this issue for a while, I think it's mostly fixed now). HarfBuzz is working as intended, but I'm not sure that pango realized that it was dropping support for hinting here. At the very least the FT_Face returned from pango_fc_font_lock_face may have hinting set (which the user may use to render) which the shaper never used when computing metrics. I suppose this explanation is getting to the point where it would be better to comment on the upstream issue. I just wanted to explicitly point out here the HarfBuzz behavior around not hinting since the effect of that hadn't yet been explicitly called out (this probably isn't just a rounding issue). |
It is my understanding that the switch to unhinted metrics was intentional , see the last paragraph in https://blogs.gnome.org/mclasen/2019/05/25/pango-future-directions/. But I agree that Pango should then render unhinted glyphs, by setting suitable cairo font options. |
Right. Also need to turn hinting off, or to 'slight' which disable horizontal hinting. |
Always, you mean ? Or only when we are not rounding glyph positions ? This |
You don’t want hinting to change the advance width, regardless of whether the positions are rounded or not. |
When you and I agreed on a plan, it was to enable subpixel positioning, which lets us disable horizontal hinting, which would enable us using HarfBuzz font funcs. |
Yes, we just need to get on with it, by getting a cairo release out |
So, do I understand correctly that on back-ends that do not support subpixel positioning (notably win32 according to https://gitlab.gnome.org/GNOME/pango/issues/385) we still won't use horizontal hinting anymore and - consequently - will end up with bad font rendering (at least on "normal" displays that not have high DPI)? Even subpixel positioning is usually a lot less readable compared to a font that's properly hinted for screen display. I can understand that the general direction outlined in https://blogs.gnome.org/mclasen/2019/05/25/pango-future-directions/ is desirable in the long-term, but it sounds a bit premature, considering high-DPI displays are far from being standard today. |
Side-note:
All browsers on Windows use DirectWrite, which doesn't do much horizontal grid fitting and uses subpixel positioning, even on today's screens. Most fonts out there don't even have horizontal hinting. It's fine. |
This is a followup on the initial pango issue reported (apparently the discussion continues here). The issue was mentioning Roboto, and I can also reproduce it with ProFont (https://tobiasjung.name/profont/ - OTB version, the one released in order to address the PCF/BDF issue): Using The 2nd output is definitely not desired. |
Just checked the original ProFont bitmap fonts and converted ProFont OpenType fonts with ftdump. Maybe the ppem value is relevant to this issue.
|
Hey, any news on this? |
There is nothing to fix here in HarfBuzz, it is a Pango issue. |
@khaledhosny Which is/are the relevant Pango issue(s) then? It seems there are multiple downstream issues that depend on this one so we can't just close it without properly tracking it somewhere else:
So apparently at least @matthiasclasen intended to continue the discussion here... I don't really have enough insight into harfbuzz/pango/cairo to know where the issues need to be tracked (I hope people with more insight can figure out this part and make sure it's tracked properly). There seem to be at least two blocking issues made visible with pango 1.44 which still have no fix:
|
and i cant even keep pango downgraded on Arch because programs need 1.44 😟 |
It's still held back on MSYS2 because of https://gitlab.gnome.org/GNOME/pango/issues/385. |
The discussion here is already resolved, HarfBuzz is working as intended and there is nothing broken in it to fix. |
I believe the current blocker for forward progress is
? I see some commits by @matthiasclasen about subpixel positioning in https://gitlab.freedesktop.org/cairo/cairo/commits/master that are unreleased. Behdad asked for a new release on the mailing list back in August: https://lists.cairographics.org/archives/cairo/2019-August/028910.html. No one responded. |
debian-installer (20210731+parrot1) lts-updates; urgency=medium . * Import new Debian release. * Update bootloader background. * Use choose direct downloads from parrot servers. * Bump Linux kernel ABI to 5.15.0-5parrot1. * Update preseed. * Disable secure boot (we don't support it yet). * Use Parrot 5.0 repo. . debian-installer (20210731+deb11u2) bullseye; urgency=medium . * Bump Linux kernel ABI to 5.10.0-10. . debian-installer (20210731+deb11u1) bullseye; urgency=medium . * Set USE_PROPOSED_UPDATES=1 for the bullseye stable branch. * Update USE_UDEBS_FROM default from unstable to bullseye, so that users don't have to know about the debian/rules heuristics when performing manual, local builds. * Bump Linux kernel ABI to 5.10.0-9. . debian-installer (20210731) unstable; urgency=medium . [ Cyril Brulebois ] * Update translation-status for the release. . [ Steve McIntyre ] * Make mini.iso work with UEFI boot * Bump Linux kernel ABI to 5.10.0-8 . debian-installer (20210415) unstable; urgency=medium . [ Shawn Guo ] * Build in libinput instead of evdev driver for gtk installer. . [ Steve McIntyre ] * Bump Linux kernel ABI to 5.10.0-6 . [ Holger Wansing ] * Add wireless-regdb-udeb to all Linux arch images (#979104). * Correct keyword for bootloader arguments in netboot/xen/debian.cfg example file. Closes: #904131 * Update of debian-internals manual to current development state. . [ Vagrant Cascadian ] * [arm64] Add support for puma-rk3399. * [arm64] Update to use u-boot-install-sunxi. * [armhf] Make hd-media and netboot sdcard images start at offset 32768, for compatibility with rockchip platforms. * [arm64, armhf] Update SD-card-images sizes for netboot, netboot-gtk and hd-media. . [ Samuel Thibault ] * On hurd-i386, mips, and powerpc, add debian-ports-archive-keyring-udeb also in the monolithic images for bootstraping from debian-ports' unreleased. * Update minimum disk and memory sizes. * Makefile: Drop libmachuser/libhurduser manual copy, now fixed in glibc. * Makefile: Drop /servers manual creation, now done in hurd-udeb package. . [ Cyril Brulebois ] * Update translation-status for the release. . debian-installer (20201202) unstable; urgency=medium . [ Cyril Brulebois ] * Bump Linux kernel ABI to 5.9.0-4 * Drop fontconfig tweaks introduced in version 20170828 (See: #873462): - Full hinting support was removed upstream, in pango 1.44. - Forcing truetype:interpreter-version=35 through FREETYPE_PROPERTIES now leads to arguably worse rendering than with default settings. * With or without the aforementioned changes, the rendering looks much worse than it used to (until Debian Installer Bullseye Alpha 3), due to a behavioral change in pango. Since it affects default fonts, and not only in the installer's context, one might have hoped for a fix at some point but that doesn't seem to be happening. We might try to use different fonts to try and dodge this issue… Until then, here are some pointers to bugtracker entries: - https://bugs.debian.org/956612 - https://gitlab.gnome.org/GNOME/pango/-/issues/404 - harfbuzz/harfbuzz#1892 * Convert doc/devel/anna-install.txt to UTF-8. * Clean whitespaces in doc/i18n/ChangeLog, making it UTF-8. * Update translation-status for the release. . [ Vagrant Cascadian ] * Update Firefly-RK3288 image for new u-boot version. * [arm64] Add support for firefly-rk3399, pinebook-pro-rk3399, rockpro64-rk3399, rock64-rk3328 and rock-pi-4-rk3399 to u-boot images and netboot SD card images. * [arm64] Make all netboot sdcard images start at offset 32768, for compatibility with rockchip platforms. . [ Lubomir Rintel ] * Add OLPC XO-1.75 laptop support. Closes: #949306 . [ Aurelien Jarno ] * Drop build-dependency on libgcc1. It has been renamed and it is not needed since r62791. * Add libgcc-s1 to the fake packages list as it doesn't have an udeb just like libgcc1. Remove libc* and libnewt0.52 from that list. * Install kmod-udeb instead of libkmod2-udeb now that the library and the binaries are properly packaged in different udebs. * Remove the mklibs library reduction pass. Add a hack to copy libgcc_s.so.[124] from the host filesystem as it is not done anymore by mklibs. This needs to be replaced by a proper udeb. * Add explicit build-depends on fdisk on arm64, amd64 and i386 now that util-linux doesn't depend on it anymore. . [ Wookey, Steve McIntyre, Alper Nebi Yasak ] * Enable gtk build for arm64 . [ Domenico Andreoli ] * Add support for NanoPi NEO Air. Closes: #928863 . [ Holger Wansing] * d-i i18n guide: update for util-linux's eject overtaking. * Add Occitan as new language for the installer (thanks to Quentin PAGÈS). . [ Steve McIntyre ] * Tweaks for efi-image: + Improve sizing calculation to reduce wasted space + Include DTB files in the ESP for armhf and arm64 systems. Should make U-Boot based systems work better when booting via UEFI * Fix build failures related to #940056 "fakeroot does not fake statx()". Don't use "ls" to check if /dev/console is a character device, instead use "file". Thanks to JH Chatenet for helping to debug this. . [ Samuel Thibault ] * Copy over libmach/hurduser, until the fixed glibc is installed. * Fix monolithic hurd build by excluding more packages. . [ Jessica Clarke ] * kfreebsd: Update to use debian-ports-archive-keyring. * kfreebsd: Don't try to build build_cdrom_gtk on kfreebsd-i386. . [ Julien Cristau ] * Add grub2 to built-using (closes: #968998). . [ Ben Hutchings ] * Add wireless-regdb-udeb to Linux builds that include nic-wireless-modules . [ Alper Nebi Yasak ] * Include a /gtk/initrd.gz in graphical arm mini.iso builds * Include fb-modules in non-gtk arm64 cdrom builds as well * Build concatenateable images for arm64 netboot-gtk . [ John Paul Adrian Glaubitz ] * powerpc: Add cdrom-core-modules and isofs-modules to cdrom pkg-lists * ppc64: Add cdrom-core-modules and isofs-modules to cdrom pkg-lists
Text renders wider or narrower, as if letter-spacing is set, than it should with newer versions of Pango. My best understanding of this problem is that around version 1.43 Pango dropped support for subpixel antialiasing because it switched to Harbuzz for glyph postions instead of Freetype. For some reason it still rounds the glyph positions by default. There's no need for node-canvas to support subpixel antialiasing. The maintainers of the Linux font stack (Behdad and Matthias) have stated that they wont, and it's subjective, and node-canvas cannot make any assumptions about DPI anyways. Reading (warning: lots of drama to wade through): - https://gitlab.gnome.org/GNOME/pango/-/issues/404 - https://gitlab.gnome.org/GNOME/pango/-/issues/463 - harfbuzz/harfbuzz#1892 - harfbuzz/harfbuzz#2394
Text renders wider or narrower, as if letter-spacing is set, than it should with newer versions of Pango. My best understanding of this problem is that around version 1.43 Pango dropped support for subpixel antialiasing because it switched to Harbuzz for glyph postions instead of Freetype. For some reason it still rounds the glyph positions by default. There's no need for node-canvas to support subpixel antialiasing. The maintainers of the Linux font stack (Behdad and Matthias) have stated that they wont, and it's subjective, and node-canvas cannot make any assumptions about DPI anyways. Reading (warning: lots of drama to wade through): - https://gitlab.gnome.org/GNOME/pango/-/issues/404 - https://gitlab.gnome.org/GNOME/pango/-/issues/463 - harfbuzz/harfbuzz#1892 - harfbuzz/harfbuzz#2394
Text renders wider or narrower, as if letter-spacing is set, than it should with newer versions of Pango. My best understanding of this problem is that around version 1.43 Pango dropped support for font hinting because it switched to Harbuzz for glyph postions instead of Freetype. For some reason it still rounds the glyph positions by default. There's no need for node-canvas to support font hinting. The maintainers of the Linux font stack (Behdad and Matthias) have stated that they wont, and font hinting is subjective, and browsers have moved to subpixel positioning too. Reading (warning: lots of drama to wade through): - https://gitlab.gnome.org/GNOME/pango/-/issues/404 - https://gitlab.gnome.org/GNOME/pango/-/issues/463 - harfbuzz/harfbuzz#1892 - harfbuzz/harfbuzz#2394
Text renders wider or narrower, as if letter-spacing is set, than it should with newer versions of Pango. My best understanding of this problem is that around version 1.43 Pango dropped support for font hinting because it switched to Harbuzz for glyph postions instead of Freetype. For some reason it still rounds the glyph positions by default. There's no need for node-canvas to support font hinting. The maintainers of the Linux font stack (Behdad and Matthias) have stated that they wont, and font hinting is subjective, and browsers have moved to subpixel positioning too. Reading (warning: lots of drama to wade through): - https://gitlab.gnome.org/GNOME/pango/-/issues/404 - https://gitlab.gnome.org/GNOME/pango/-/issues/463 - harfbuzz/harfbuzz#1892 - harfbuzz/harfbuzz#2394
Text renders wider or narrower, as if letter-spacing is set, than it should with newer versions of Pango. My best understanding of this problem is that around version 1.43 Pango dropped support for font hinting because it switched to Harbuzz for glyph postions instead of Freetype. For some reason it still rounds the glyph positions by default. There's no need for node-canvas to support font hinting. The maintainers of the Linux font stack (Behdad and Matthias) have stated that they wont, and font hinting is subjective, and browsers have moved to subpixel positioning too. Reading (warning: lots of drama to wade through): - https://gitlab.gnome.org/GNOME/pango/-/issues/404 - https://gitlab.gnome.org/GNOME/pango/-/issues/463 - harfbuzz/harfbuzz#1892 - harfbuzz/harfbuzz#2394
Text renders wider or narrower, as if letter-spacing is set, than it should with newer versions of Pango. My best understanding of this problem is that around version 1.43 Pango dropped support for font hinting because it switched to Harbuzz for glyph postions instead of Freetype. For some reason it still rounds the glyph positions by default. There's no need for node-canvas to support font hinting. The maintainers of the Linux font stack (Behdad and Matthias) have stated that they wont, and font hinting is subjective, and browsers have moved to subpixel positioning too. Reading (warning: lots of drama to wade through): - https://gitlab.gnome.org/GNOME/pango/-/issues/404 - https://gitlab.gnome.org/GNOME/pango/-/issues/463 - harfbuzz/harfbuzz#1892 - harfbuzz/harfbuzz#2394
In pango 1.44, we've replaced cairo by harfbuzz for getting glyph extents. Some people complain that fonts are 'stretched' now (https://gitlab.gnome.org/GNOME/pango/issues/404).
Comparing 1.43 and 1.44, I find that i get this returned from cairo (note that the values here are rounded to multiples of 1024:
And this is what i get from harfbuzz:
the harfbuzz values are not rounded, that is ok. The issue here is that 3652 rounds to 4096, giving us an extra pixel of width for that glyph.
I haven't gotten to the bottom of why these values are different. I did notice that the scales of the font are similar enough to not be the reason: 15024 (with 1.43) vs 15019 (with 1.44).
The text was updated successfully, but these errors were encountered: