howardjones / network-weathermap

Network Weathermap draws diagrams from data
http://www.network-weathermap.com/
MIT License
425 stars 95 forks source link

Anti-aliasing in v0.98 needs explanation #216

Open athompso opened 5 years ago

athompso commented 5 years ago

From the 0.98 changelog: Weathermap will use anti-aliasing if your GD supports it (php-bundled GD doesn't) (thanks shd)

I can see the changes to Weathermap.class to add transparent backgrounds to everything, which supposedly turns on GD's TTF anti-aliasing. I also see the boolean login added in commit 73450f711405a23aecb8768c94eee841749a5cc6.

What I can't make any sense of is the "php-bundled GD doesn't" comment. It seems to directly contradict the PHP changelog for 7.2.0: 7.2.0 | imageantialias() is now generally available. Formerly it was only available if PHP was compiled with the bundled version of the GD library.

In general, anyone running a vaguely-modern version of PHP will get anti-aliasing, and was probably getting it to begin with.

Recommend either removing the confusing parenthetical caveat from the changelog, or expanding on it a bit so non-PHP-developers can understand whether they're getting anti-aliasing or not.

howardjones commented 5 years ago

There's plenty of PHP 7.1 and lower in the world still! I just checked CentOS 7, and it will currently install PHP 5.4 if you ask yum for PHP (+ years of redhat backported security patches, but still php 5.4).

The relationship between php, GD and various distros is not as simple as you would like. I haven't checked recently if Debian still use the actual gd package rather than PHP's own bundled gd. But if that's the case, then there is still a distinction, because the functionality is (AFAIK) still different.

I'll check into the current situation on a variety of OS. I'm far more concerned with answering "I enabled antialiasing and I'm not getting it" over and over, than removing a few words from the manual. Agreed that expanding it might be useful though.

It's not TTF antialiasing, it's line-drawing anti-aliasing, incidentally. freetype draws with antialiasing anyway.

Personally, I think it looks ugly, anyway :-)

howardjones commented 5 years ago

Yep, Debian still use libgd, not bundled: https://packages.debian.org/stretch/php7.0-gd

This is what I'm talking about:

To enable GD-support configure PHP --with-gd[=DIR] , where DIR is the GD base install directory. To use the recommended bundled version of the GD library, use the configure option --with-gd .

https://www.php.net/manual/en/image.installation.php

athompso commented 5 years ago

Yep... my point was that since the assertion in the changes file is the logical opposite of what the PHP docs say, it leads to confusion. It certainly let to confusion by me - I'm using an older PHP (7.0), with the built-in GD, and antialiasing is working for me. I went down a rabbit hole this morning because of the caveat in the changelog, without thinking of zooming in enough to tell if it was antialiased or not...

BTW, I agree about ugly - small, rotated text is nearly illegible one of our maps [https://observium.merlin.mb.ca/weathermap/infrastructure.html].

howardjones commented 5 years ago

Again, imageantialias() is nothing to do with text, it affects line drawing - so links and nodes.

Freetype does its own antialiasing when rendering fonts. I'm pretty sure it always does it. It's also not great, especially at angles, at inter-character and inter-line spacing. That's been a problem for quite some time (if it still does it, since 2007 - I haven't checked in a while), and why I stopped trying to add cool text features. ("cool" like multi-line text). It partly depends on the font you use, but not completely. That's when I decided SVG would be a better place to spend some time, if I ever got it :-)

I will have a look at improving the manual. I think probably by expanding what check.php says about it, and referring to that, since check.php can actually look at your php installation, even if you don't know how it got there.