Bug 225072 - print/freetype2: Update to 2.9
Summary: print/freetype2: Update to 2.9
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-gnome (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2018-01-11 13:52 UTC by lightside
Modified: 2018-04-03 08:51 UTC (History)
6 users (show)

See Also:
bugzilla: maintainer-feedback? (gnome)


Attachments
Proposed patch (since 452905 revision) (4.65 KB, patch)
2018-01-11 13:52 UTC, lightside
lightside: maintainer-approval? (gnome)
Details | Diff
Proposed patch (since 466253 revision) (1.36 KB, patch)
2018-04-02 22:16 UTC, lightside
no flags Details | Diff
Comparison of some images (791.64 KB, application/x-bzip)
2018-04-02 22:18 UTC, lightside
no flags Details
Proposed patch (since 466253 revision) (1.36 KB, patch)
2018-04-02 22:23 UTC, lightside
no flags Details | Diff
Proposed patch (since 466253 revision) (2.38 KB, patch)
2018-04-02 22:45 UTC, lightside
no flags Details | Diff
Proposed patch (since 466253 revision) (2.32 KB, patch)
2018-04-02 23:29 UTC, lightside
lightside: maintainer-approval? (gnome)
Details | Diff
Comparison of some images (855.12 KB, application/x-bzip)
2018-04-03 02:51 UTC, lightside
no flags Details
Comparison of some images (877.10 KB, application/x-bzip)
2018-04-03 03:26 UTC, lightside
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description lightside 2018-01-11 13:52:48 UTC
Created attachment 189612 [details]
Proposed patch (since 452905 revision)

Patch to update print/freetype2 port from 2.8 to 2.9 version.

Look following links for changes:
https://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/CHANGES?h=VER-2-9
https://github.com/cpp-mirrors/freetype2/compare/VER-2-8...VER-2-8-1
https://github.com/cpp-mirrors/freetype2/compare/VER-2-8-1...VER-2-9
https://github.com/cpp-mirrors/freetype2/compare/VER-2-8...VER-2-9
ABI:
https://abi-laboratory.pro/tracker/timeline/freetype/

- Regenerate files/extra-patch-fix_size_metrics.diff
- Add upstream patch for src/psaux/psintrp.c file
- Adapt pkg-plist

The build was tested on FreeBSD 10.3 amd64.
Comment 1 lightside 2018-01-11 13:54:38 UTC
Need to note, that 2.8.1 version introduced changes for LCD filtering.
There is following commit, which notes that "This change breakes current Skia (and Firefox).":
https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=ab2599ea3f09ba8da4f50b877021d23241d22609

I tested www/seamonkey (v2.49.1) and www/firefox (v56.0.2) ports, which, looks like, have fixes for this:
https://bugzilla.mozilla.org/show_bug.cgi?id=1393467

CC (just in case): gecko@
Comment 2 lightside 2018-01-11 13:56:49 UTC
There is following important changes for 2.8.1 version in docs/CHANGES file:
-8<--
II. IMPORTANT CHANGES

- By  default,  FreeType  now offers  high  quality  LCD-optimized
  output without  resorting to ClearType techniques  of resolution
  tripling and  filtering.  In  this method, called  Harmony, each
  color channel  is generated separately after  shifting the glyph
  outline, capitalizing  on the fact  that the color grids  on LCD
  panels  are shifted  by  a third  of a  pixel.   This output  is
  indistinguishable from ClearType with a light 3-tap filter.
-->8-

As I understood, the (so-called) Harmony method for "high quality LCD-optimized output" may be enabled, if not define FT_CONFIG_OPTION_SUBPIXEL_RENDERING, which relates to (disabled) LCD_FILTERING port's option:
https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=410f3799b6a193e20b34c574e6f0f2be2428b1eb

Possible to remove LCD_FILTERING port's option from OPTIONS_DEFAULT variable to enable "Harmony LCD rendering" by default. I guess, maintainer may decide about this, if needed.
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-04-02 19:39:19 UTC
A commit references this bug:

Author: bapt
Date: Mon Apr  2 19:38:39 UTC 2018
New revision: 466253
URL: https://svnweb.freebsd.org/changeset/ports/466253

Log:
  Incorporate a patch from uptream

  Remove the LCD filtering option, now freetype2 offers by default a LCD optimized
  output, no need to keep the old LCD filtering option (keeping it off may confuse
  users) and let freetype2 use the new "Harmony LCD rendering"

  Thanks jbeich for pointing me at the PR I missed.

  PR:		225072
  Submitted by:	lightside <lightside@gmx.com>

Changes:
  head/print/freetype2/Makefile
  head/print/freetype2/files/correct-flex-features.patch
Comment 4 lightside 2018-04-02 22:16:23 UTC
Created attachment 192124 [details]
Proposed patch (since 466253 revision)

To Baptiste Daroussin:
Please return LCD_FILTERING option.

There is still FT_CONFIG_OPTION_SUBPIXEL_RENDERING define available:
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/include/freetype/config/ftoption.h?h=VER-2-9#n107
-8<--
  /*************************************************************************/
  /*                                                                       */
  /* Uncomment the line below if you want to activate LCD rendering        */
  /* technology similar to ClearType in this build of the library.  This   */
  /* technology triples the resolution in the direction color subpixels.   */
  /* To mitigate color fringes inherent to this technology, you also need  */
  /* to explicitly set up LCD filtering.                                   */
  /*                                                                       */
  /* Note that this feature is covered by several Microsoft patents        */
  /* and should not be activated in any default build of the library.      */
  /* When this macro is not defined, FreeType offers alternative LCD       */
  /* rendering technology that produces excellent output without LCD       */
  /* filtering.                                                            */
  /*                                                                       */
/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-->8-
Comment 5 lightside 2018-04-02 22:18:19 UTC
Created attachment 192125 [details]
Comparison of some images

(In reply to comment #4)
There are differences between Harmony LCD filtering and what provided by FT_CONFIG_OPTION_SUBPIXEL_RENDERING define, if you compare them with using some image comparison program (e.g compare from graphics/ImageMagick).

For example, I attached some archive with images for enabled and disabled LCD_FILTERING option. The result of compare program is in comparison.png (the red color are differences).

CC: bapt@
Comment 6 lightside 2018-04-02 22:23:50 UTC
Created attachment 192126 [details]
Proposed patch (since 466253 revision)

Sorted OPTIONS_DEFAULT.
Comment 7 lightside 2018-04-02 22:45:12 UTC
Created attachment 192127 [details]
Proposed patch (since 466253 revision)

- Regenerate files/extra-patch-fix_size_metrics.diff
Comment 8 lightside 2018-04-02 23:29:22 UTC
Created attachment 192131 [details]
Proposed patch (since 466253 revision)

Cosmetic fixes.
Comment 9 lightside 2018-04-02 23:58:09 UTC
(In reply to comment #3)
Personally, I didn't propose to remove LCD_FILTERING option (attachment #189612 [details]).
I just mentioned about how to enable "Harmony LCD rendering" in comment #2 and notified maintainer about defaults, which were changed by freetype2's developer(s) (mainly, for their devel/ftoption.h file, because include/freetype/config/ftoption.h already has FT_CONFIG_OPTION_SUBPIXEL_RENDERING disabled):
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/devel/ftoption.h?id=410f3799b6a193e20b34c574e6f0f2be2428b1eb
Comment 10 Walter Schwarzenfeld freebsd_triage 2018-04-03 00:14:30 UTC
see port r466253.
Comment 11 lightside 2018-04-03 00:29:50 UTC
(In reply to comment #9)
For reference:

There is a possibility to enable FT_CONFIG_OPTION_SUBPIXEL_RENDERING on Gentoo Linux:
https://gitweb.gentoo.org/repo/gentoo.git/tree/media-libs/freetype/freetype-2.9.ebuild?id=2fa1a1fa049071b0ea98d1ced640bcc4c0e2c864#n82
-8<--
	if ! use bindist; then
		# See http://freetype.org/patents.html
		# ClearType is covered by several Microsoft patents in the US
		enable_option FT_CONFIG_OPTION_SUBPIXEL_RENDERING
	fi
-->8-

There is --with subpixel_rendering option to enable FT_CONFIG_OPTION_SUBPIXEL_RENDERING on Fedora Linux:
https://src.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype.spec?id=749d27d63c337172edfbd05e9282d3f7179aabc3#n1
-8<--
# Patented subpixel rendering disabled by default.
# Pass '--with subpixel_rendering' on rpmbuild command-line to enable.
%{!?_with_subpixel_rendering: %{!?_without_subpixel_rendering: %define _without_subpixel_rendering --without-subpixel_rendering}}
-->8-

https://src.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype.spec?id=749d27d63c337172edfbd05e9282d3f7179aabc3#n82
-8<--
%if %{?_with_subpixel_rendering:1}%{!?_with_subpixel_rendering:0}
%patch0  -p1 -b .enable-spr
%endif
-->8-

https://src.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype-2.3.0-enable-spr.patch?id=749d27d63c337172edfbd05e9282d3f7179aabc3#n7
-8<--
-/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-->8-

But 0002-Enable-subpixel-rendering.patch was removed on Arch Linux:
https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/freetype2&id=d1784850b00281e7ad1c0f7e980ea46fb4fec01d
https://git.archlinux.org/svntogit/packages.git/tree/trunk/0002-Enable-subpixel-rendering.patch?h=packages/freetype2&id=c419271e92acf355fc52824eb93e69b5c9f29d40
Comment 12 lightside 2018-04-03 00:33:12 UTC
(In reply to w.schwarzenfeld from comment #10)
> see port r466253.
Yes, this was mentioned in comment #3.
There is proposed patch in attachment #192131 [details] to change/revert this. Related people was notified through CC.
Comment 13 lightside 2018-04-03 00:35:56 UTC
CC: kwm@
Comment 14 lightside 2018-04-03 02:06:33 UTC
(In reply to comment #5)
I created some screenshots to compare (around 13 January 2018):
browser_freetype2_2.8_lcd_filtering_off.png - with LCD_FILTERING=off for freetype2 v2.8
browser_freetype2_2.8_lcd_filtering_on.png - with LCD_FILTERING=on for freetype2 v2.8
browser_freetype2_2.9_lcd_filtering_off_(harmony).png - with LCD_FILTERING=off for freetype2 v2.9
browser_freetype2_2.9_lcd_filtering_on.png - with LCD_FILTERING=on for freetype2 v2.9

For following comparisons:
- Differences between grey colour rendering (LCD_FILTERING=off) and subpixel rendering (LCD_FILTERING=on) for freetype2 v2.8:
% compare browser_freetype2_2.8_lcd_filtering_off.png browser_freetype2_2.8_lcd_filtering_on.png comparison/2.8_off-2.8_on.png

- Almost identical images between freetype2 v2.8 and v2.9, when subpixel rendering was enabled (LCD_FILTERING=on):
% compare browser_freetype2_2.8_lcd_filtering_on.png browser_freetype2_2.9_lcd_filtering_on.png comparison/2.8_on-2.9_on.png

- Differences between "harmony LCD rendering" (LCD_FILTERING=off) and subpixel rendering (LCD_FILTERING=on) for freetype2 v2.9:
% compare browser_freetype2_2.9_lcd_filtering_off_\(harmony\).png browser_freetype2_2.9_lcd_filtering_on.png comparison/2.9_off-2.9_on.png

Other port's options were:
DEBUG=off, DOCS=on, LONG_PCF_NAMES=on, PNG=on, TABLE_VALIDATION=off, V38=off, V40=off, FIX_SIZE_METRICS=on, TT_SIZE_METRICS=off.

The link to archive with images (1.7 MB, for 2 months):
https://files.fm/f/c6szmhdm
-8<--
% sha256 images_comparison.tar.bz2 
SHA256 (images_comparison.tar.bz2) = bde6dea787a1dfd52e8eb2db0c23d82cae74e294e9d513c55a05fef489c6a8e8
-->8-
Comment 15 lightside 2018-04-03 02:51:54 UTC
Created attachment 192156 [details]
Comparison of some images

(In reply to comment #5)
Attached new archive with images for comparison between LCD_RENDERING=on (LCD_FILTERING=off) and LCD_FILTERING=on (LCD_RENDERING=off) for freetype2 v2.9 (based on changes from attachment #192131 [details]):
-8<--
% compare browser_freetype2_2.9_lcd_filtering_off.png browser_freetype2_2.9_lcd_filtering_on.png comparison.png
% pkg info firefox | grep ^Version
Version        : 59.0.2_1,1
-->8-
Comment 16 lightside 2018-04-03 03:26:01 UTC
Created attachment 192157 [details]
Comparison of some images
Comment 17 commit-hook freebsd_committer freebsd_triage 2018-04-03 08:12:31 UTC
A commit references this bug:

Author: bapt
Date: Tue Apr  3 08:11:52 UTC 2018
New revision: 466285
URL: https://svnweb.freebsd.org/changeset/ports/466285

Log:
  Readd LCD_FILTERING option and introduce LCD_RENDERING

  Select LCD_RENDERING as the default (same as before the introduction
  of the option)

  PR:		225072
  Submitted by:	lightside <lightside@gmx.com>

Changes:
  head/print/freetype2/Makefile
Comment 18 lightside 2018-04-03 08:48:50 UTC
To Baptiste Daroussin:
Thanks for commit.

I think, this PR can be closed.