Commit Graph

280 Commits (master)

Author SHA1 Message Date
gutmet a594737139 fix paths from git.gutmet.org to git.fireandbrimst.one/aw 2023-09-21 21:38:15 +02:00
Alexander Weinhold c2f707aba7 change paths 2018-12-06 17:03:52 +01:00
Nigel Tao cd38e8056d font/sfnt: make PostTable.ItalicAngle a float64
Previously, it was a float32, which obviously has 32 bits of state. Not
all of that 32 bit state space is meaningful, since NaN has multiple bit
representations. The underlying file format field (of type "Fixed" or
16.16 fixed point) is also 32 bits of state
(https://docs.microsoft.com/en-us/typography/opentype/spec/post).
Therefore, converting from 32 bit fixed point to 32 bit floating point
can be lossy. Instead, use 64 bit floating point. 53 significand bits
can losslessly represent all possible 16.16 fixed point values.

Using float64 is also arguably more Go-like, as the default type for the
ideal constant 0.5 is float64, not float32.

Change-Id: I5abe7979a020af2ac4784d6c2723ab8e39e38e34
Reviewed-on: https://go-review.googlesource.com/c/149837
Reviewed-by: Denys Smirnov <denis.smirnov.91@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-11-16 02:48:01 +00:00
Denys Smirnov dd492a22e4 font/sfnt: support fonts with "true" apple version tag
OpenType specification mentions that fonts might contain Apple
version tag that is equal to "true" (see note in [1]). Currently,
the library returns a parsing error for those fonts.

CL adds Apple this version tag to the validation code and allows
fonts to omit OS/2 table, as mentioned in the TrueType spec [2].

[1] https://docs.microsoft.com/en-us/typography/opentype/spec/otff#organization-of-an-opentype-font

[2] https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6OS2.html

Change-Id: I13406fe97b091f24aaabf9b477df9c8fc8df883c
Reviewed-on: https://go-review.googlesource.com/c/146078
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-11-16 02:46:09 +00:00
Denys Smirnov d9c2484c48 font/sfnt: parse and expose PostScript information
Currently the library only parses the version in PostScript table.
However use cases such as PDF document processing requires this
information to be exposed.

CL parses a minimal set of the fields from the PostScript table
and exposes it via new PostTable method.

Change-Id: Ia86eecea9f5aaf557c7e4737f2474966aa30cff2
Reviewed-on: https://go-review.googlesource.com/c/145797
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-11-15 06:11:51 +00:00
Nigel Tao 46e4eb730a vector: use asm opcode mnemonics
There's no change in the binary output, just less mystery in the asm.

These mnemonics were introduced in Go 1.10:
https://golang.org/doc/go1.10#asm and https://golang.org/cl/75490

Current stable release (as of 2018-11-10) is Go 1.11, and
https://golang.org/doc/devel/release.html#policy says that Go 1.9 and
below are therefore no longer supported.

Change-Id: I1f9a63521bc8d5e8f8d395605f62bf7fb6a63bc5
Reviewed-on: https://go-review.googlesource.com/c/148997
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-11-15 02:24:11 +00:00
Dmitri Shuralyov 249dc8530c draw: re-enable the image.Rectangle DstMask fast path
This change reverts the remaining part of CL 9463,
the image.Rectangle DstMask fast path, since Go 1.5
has been released.

	$ go test -bench=. -count=5 -timeout=1h > before.txt
	$ # apply change
	$ go test -bench=. -count=5 -timeout=1h > after.txt
	$ benchstat before.txt after.txt
	name                    old time/op    new time/op    delta
	SimpleScaleCopy-8         23.4µs ± 3%    21.8µs ± 4%   -7.14%  (p=0.016 n=5+5)
	SimpleTransformCopy-8     22.6µs ± 6%    21.4µs ± 1%   -5.07%  (p=0.008 n=5+5)
	SimpleTransformScale-8     904µs ± 0%     900µs ± 0%     ~     (p=0.056 n=5+5)
	ScaleNNLargeDown-8         641µs ± 1%     643µs ± 1%     ~     (p=0.548 n=5+5)
	ScaleABLargeDown-8        1.50ms ± 1%    1.50ms ± 1%     ~     (p=0.413 n=5+4)
	ScaleBLLargeDown-8         192ms ± 5%     196ms ± 4%     ~     (p=0.095 n=5+5)
	ScaleCRLargeDown-8         355ms ± 4%     350ms ± 2%     ~     (p=0.690 n=5+5)
	ScaleNNDown-8              134µs ± 2%     126µs ± 1%   -5.68%  (p=0.008 n=5+5)
	ScaleABDown-8              261µs ± 3%     256µs ± 1%   -1.92%  (p=0.016 n=5+5)
	ScaleBLDown-8             2.42ms ± 3%    2.44ms ± 8%     ~     (p=0.841 n=5+5)
	ScaleCRDown-8             4.36ms ± 1%    4.85ms ± 4%  +11.22%  (p=0.008 n=5+5)
	ScaleNNUp-8               6.27ms ± 2%    6.72ms ± 3%   +7.20%  (p=0.008 n=5+5)
	ScaleABUp-8               12.8ms ± 1%    13.8ms ± 2%   +7.26%  (p=0.008 n=5+5)
	ScaleBLUp-8               17.5ms ± 7%    17.4ms ± 2%     ~     (p=1.000 n=5+5)
	ScaleCRUp-8               23.2ms ± 2%    23.1ms ± 4%     ~     (p=0.690 n=5+5)
	ScaleNNSrcRGBA-8           419µs ± 1%     421µs ± 3%     ~     (p=0.690 n=5+5)
	ScaleNNSrcUnif-8          3.35µs ± 3%    3.35µs ± 2%     ~     (p=1.000 n=5+5)
	ScaleNNOverRGBA-8          470µs ± 1%     479µs ± 5%     ~     (p=0.548 n=5+5)
	ScaleNNOverUnif-8          102µs ± 2%     102µs ± 1%     ~     (p=0.222 n=5+5)
	TformNNSrcRGBA-8           215µs ± 1%     213µs ± 1%     ~     (p=0.222 n=5+5)
	TformNNSrcUnif-8          84.2µs ± 1%    86.6µs ± 2%   +2.82%  (p=0.016 n=5+5)
	TformNNOverRGBA-8          351µs ± 5%     359µs ± 0%     ~     (p=0.151 n=5+5)
	TformNNOverUnif-8          101µs ± 1%     104µs ± 1%   +3.47%  (p=0.008 n=5+5)
	ScaleABSrcGray-8           399µs ± 2%     400µs ± 2%     ~     (p=0.690 n=5+5)
	ScaleABSrcNRGBA-8          795µs ± 1%     809µs ± 4%     ~     (p=0.095 n=5+5)
	ScaleABSrcRGBA-8           807µs ± 1%     807µs ± 2%     ~     (p=1.000 n=5+5)
	ScaleABSrcYCbCr-8         1.50ms ± 1%    1.48ms ± 0%   -0.76%  (p=0.032 n=5+5)
	ScaleABOverGray-8          396µs ± 0%     395µs ± 1%     ~     (p=0.421 n=5+5)
	ScaleABOverNRGBA-8         886µs ± 1%     885µs ± 1%     ~     (p=0.556 n=4+5)
	ScaleABOverRGBA-8          893µs ± 1%     895µs ± 1%     ~     (p=0.310 n=5+5)
	ScaleABOverYCbCr-8        1.49ms ± 1%    1.49ms ± 1%     ~     (p=0.548 n=5+5)
	TformABSrcGray-8           359µs ± 1%     364µs ± 3%     ~     (p=0.421 n=5+5)
	TformABSrcNRGBA-8          618µs ± 1%     660µs ± 3%   +6.81%  (p=0.008 n=5+5)
	TformABSrcRGBA-8           614µs ± 1%     638µs ± 5%   +3.94%  (p=0.008 n=5+5)
	TformABSrcYCbCr-8          903µs ± 1%     913µs ± 2%     ~     (p=0.056 n=5+5)
	TformABOverGray-8          362µs ± 3%     358µs ± 1%     ~     (p=0.421 n=5+5)
	TformABOverNRGBA-8         691µs ± 1%     690µs ± 1%     ~     (p=0.841 n=5+5)
	TformABOverRGBA-8          671µs ± 1%     673µs ± 1%     ~     (p=0.690 n=5+5)
	TformABOverYCbCr-8         904µs ± 1%     906µs ± 0%     ~     (p=0.190 n=5+4)
	ScaleCRSrcGray-8          9.24ms ± 1%    9.16ms ± 1%     ~     (p=0.222 n=5+5)
	ScaleCRSrcNRGBA-8         21.9ms ± 2%    21.7ms ± 1%     ~     (p=0.222 n=5+5)
	ScaleCRSrcRGBA-8          22.5ms ± 8%    21.8ms ± 1%     ~     (p=1.000 n=5+5)
	ScaleCRSrcYCbCr-8         43.6ms ± 1%    43.9ms ± 1%     ~     (p=0.222 n=5+5)
	ScaleCROverGray-8         9.24ms ± 0%    9.35ms ± 6%     ~     (p=0.690 n=5+5)
	ScaleCROverNRGBA-8        21.9ms ± 1%    21.8ms ± 1%     ~     (p=0.548 n=5+5)
	ScaleCROverRGBA-8         21.8ms ± 0%    22.0ms ± 1%   +0.94%  (p=0.008 n=5+5)
	ScaleCROverYCbCr-8        43.5ms ± 1%    44.1ms ± 1%   +1.53%  (p=0.008 n=5+5)
	TformCRSrcGray-8          3.16ms ± 4%    3.06ms ± 1%     ~     (p=0.056 n=5+5)
	TformCRSrcNRGBA-8         4.21ms ± 1%    4.20ms ± 1%     ~     (p=0.841 n=5+5)
	TformCRSrcRGBA-8          4.29ms ± 1%    4.29ms ± 1%     ~     (p=0.841 n=5+5)
	TformCRSrcYCbCr-8         5.55ms ± 1%    5.58ms ± 0%   +0.67%  (p=0.032 n=5+4)
	TformCROverGray-8         3.08ms ± 1%    3.07ms ± 2%     ~     (p=0.421 n=5+5)
	TformCROverNRGBA-8        4.40ms ± 1%    4.39ms ± 0%     ~     (p=0.841 n=5+5)
	TformCROverRGBA-8         4.50ms ± 5%    4.44ms ± 0%     ~     (p=0.730 n=5+4)
	TformCROverYCbCr-8        5.57ms ± 0%    5.61ms ± 1%     ~     (p=0.095 n=5+5)

Change-Id: I981861c28e103b68275a82e051d2999a8e714502
Reviewed-on: https://go-review.googlesource.com/c/148575
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-09 23:22:46 +00:00
Dmitri Shuralyov aa35264064 font/sfnt: rename ExampleRasterizeGlyph to Example_rasterizeGlyph
This change renames the example to follow correct naming convention,
as documented at https://godoc.org/testing#hdr-Examples. As a result,
it shows up in godoc.

This issue was caught and reported by vet:

	$ go vet golang.org/x/image/font/sfnt
	# golang.org/x/image/font/sfnt_test
	font/sfnt/example_test.go:19: ExampleRasterizeGlyph refers to unknown identifier: RasterizeGlyph

Fixes golang/go#28684

Change-Id: I2749c638c5f3ed15e4db0448bc7a5e2c12c056e5
Reviewed-on: https://go-review.googlesource.com/c/148576
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-09 00:22:02 +00:00
Dmitri Shuralyov 22fd5b5408 draw: fix Transformer documentation formatting
Each span of unindented non-blank lines is converted into a
single paragraph. This isn't desired here. Indent the matrix,
so that it's converted into a <pre> block. That also prevents
the previous line from being interpreted as a heading.

Reference: https://godoc.org/go/doc#ToHTML

Fixes golang/go#28683

Change-Id: Ibc5488d5cc66fe3a5f2bbe2fe23628dd08276037
Reviewed-on: https://go-review.googlesource.com/c/148573
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-08 22:41:23 +00:00
Dmitri Shuralyov a3f9a0009f draw: remove Go 1.8 support
This change removes support for Go 1.8 and older, as they're no longer
supported per release policy¹.

This brings back a simpler file layout that was here prior to CL 36730,
but keeps using type aliases for the exported names from the standard
library's image/draw package.

Don't keep the comment motivating type alias use, since that feature is
no longer new, and commonly understood by now.

¹ https://tip.golang.org/doc/devel/release.html#policy

Change-Id: I5fab71162cf6daa5985a048ed06011efacddf886
Reviewed-on: https://go-review.googlesource.com/c/148567
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-08 21:44:26 +00:00
Dmitri Shuralyov 36ab2409c1 webp: remove Go 1.8 support
This is a revert of CL 24945 and CL 24954, since we no longer need to
support Go 1.5.

No need to explicitly specify which Go version is required. Instead,
rely on the implicit requirement based on the release support policy¹.
This is simpler and consistent with how it was before CL 24954.

¹ https://tip.golang.org/doc/devel/release.html#policy

Change-Id: I3cfef1bef120f702d5859dad10a76803544cc869
Reviewed-on: https://go-review.googlesource.com/c/148569
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-08 21:37:21 +00:00
Dmitri Shuralyov 4b0b9b997d vector: remove Go 1.8 support
This change reverts CL 32132. We no longer have to worry about
Go 1.5 support. This results in slightly simpler build constraints.

Change-Id: I021936646a6e9a82462a885b256894027fb58aeb
Reviewed-on: https://go-review.googlesource.com/c/148568
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-11-08 20:57:45 +00:00
Dmitri Shuralyov 6f5d68baf1 webp/nycbcra: delete deprecated package
This package has been deprecated since Go 1.6, which is long ago.
There's a warning printed whenever this package is imported, which
helped people migrate away from it by now. Delete it since it's
unused and unsupported.

Change-Id: If84b631ebff6530cdb955af34fa7b84d50130166
Reviewed-on: https://go-review.googlesource.com/c/148570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-08 20:55:02 +00:00
Dmitri Shuralyov 55919307b5 colornames: update SVG 1.1 spec URL
The Scalable Vector Graphics (SVG) 1.1 specification URL has changed.
The old URL, https://www.w3.org/TR/SVG/, now hosts the SVG 2 spec.
SVG 1.1 spec has moved to https://www.w3.org/TR/SVG11/.

This change makes this package go generate successfully with no diff.

Change-Id: Ifa788b1bb47748610b3adc0ac96692c00bcb3158
Reviewed-on: https://go-review.googlesource.com/c/148566
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-08 20:49:13 +00:00
Denys Smirnov fe2fa19765 font/sfnt: support post table version 1.0
Currently, the library produces a parsing error when the font
contains a PostScript table of version 1.0.

CL adds this version to the validation code and implements a glyph
name lookup for it.

Change-Id: Id4999d8b252e5c2d8e897f637ba31270336cfe9a
Reviewed-on: https://go-review.googlesource.com/c/146080
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-11-07 04:00:41 +00:00
Denys Smirnov 63626fb251 font/sfnt: fix hmtx table size validation
The library assumes the hmtx size to be equal to 2*nGlyph + 2*nHm,
which is a simplification of 4*nHm + 2*(nGlyph-nHm) as described
in the spec. However, fonts seen in the wild sometimes omit the
second term (left side bearings), making validation to fail.

CL fixes the validation code by allowing to omit the second term.

Fixes golang/go#28379

Change-Id: I2293e498e72f95e5fe08c2b375ea7b020d06cde3
Reviewed-on: https://go-review.googlesource.com/c/144080
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-11-02 02:16:09 +00:00
Igor Zhilianin 69cc3646b9 all: fix typos
Change-Id: I2140a1a74d1319d9b8746efad539bfaae6038a2d
GitHub-Last-Rev: b00b49e87ed3adb72d11c81e4cff98671d411b52
GitHub-Pull-Request: golang/image#1
Reviewed-on: https://go-review.googlesource.com/c/145740
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-30 00:21:51 +00:00
Denys Smirnov 2a2258ff36 font/sfnt: support parsing legacy fonts with OS2 table version <= 1
Library assumes that OS/2 header size is at least 96 bytes,
which is not the case for fonts with OS/2 table version <= 1.

This CL adds a version test and handles the legacy header.

Fixes golang/go#28339

Change-Id: I79bd8f8bbf262c1caaf4e66888446159b5e4fb43
Reviewed-on: https://go-review.googlesource.com/c/144079
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2018-10-25 23:34:08 +00:00
Nigel Tao 9b1e201e7c bmp: update comment about decoding 32 bpp images
Change-Id: I90f6d36d5257c31dc2e41943e5a1eaa7755da6d2
Reviewed-on: https://go-review.googlesource.com/c/144317
Reviewed-by: David Symonds <dsymonds@golang.org>
Run-TryBot: David Symonds <dsymonds@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-23 23:21:08 +00:00
David Heuschmann a9455cf03d image/bmp: support v4 and v5 info header versions
Decode BITMAPV4INFOHEADER and BITMAPV5INFOHEADER in addition to
BITMAPINFOHEADER and check if any of their features are used. If this is
not the case, the bmp can be decoded as if it had the BITMAPINFOHEADER.
Otherwise an ErrUnsupported is returned.

The colormap.bmp and yellow_rose-small-v5.bmp files were generated using
imagemagick using the following conversions:

convert video-001.bmp -depth 8 -palette colormap.bmp
convert yellow_rose-small.bmp -format BMP5 yellow_rose-small-v5.bmp

The corresponding png files were created using imagemagick convert
without any arguments.

Fixes golang/go#27767

Change-Id: I5c0138b231c68132d39a29c71b61faa546921511
Reviewed-on: https://go-review.googlesource.com/c/141799
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-23 22:58:01 +00:00
Elias Naur 991ec62608 image/font: expose caret slope
Change-Id: I775224dd3fc7e5b6c2fc5c4a7d3db83bb36d047d
Reviewed-on: https://go-review.googlesource.com/136255
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-09-26 01:56:37 +00:00
Elias Naur e1a1ede689 font,font/sfnt: expose font x-Height and capHeight
Change-Id: I6e3e6e51c7e270e16413c23990f6df5e22cbfeb6
Reviewed-on: https://go-review.googlesource.com/135555
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-09-20 23:51:50 +00:00
Nigel Tao c73c2afc3b bmp: remove unused testing.T arg
Change-Id: I53954db3e83d3a5bb155fec24c7da0dc31b8ea2d
Reviewed-on: https://go-review.googlesource.com/122418
Reviewed-by: David Symonds <dsymonds@golang.org>
2018-07-08 00:43:52 +00:00
Derek Buitenhuis e7c2a4f042 bmp: Add support for writing bitmaps with alpha channels
This also fixes the writer test to actually compare the decoded images,
so as to make sure it is decoded properly.

Implements golang/go#25945.

Change-Id: I606887baa11b7664018313cf7d5800b2dc7622cf
Reviewed-on: https://go-review.googlesource.com/120095
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-06 05:04:57 +00:00
Elias Naur cc896f830c font/sfnt,font/opentype: correct font height computation
According to https://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html
the line spacing of a font is computed as

line space = ascent - descent + linegap

Use that formula to compute the Height field of a Font's Metrics.

Change-Id: I1c44eca9f662e0aae68716cd8859670fe0b394d7
Reviewed-on: https://go-review.googlesource.com/120815
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2018-06-28 06:20:38 +00:00
Paul Jolly af66defab9 README: fix go get instructions
Currently the instructions tell the user to:

go get -u golang.org/x/image

However, this is not valid because golang.org/x/image contains no Go
files.

Instead it should read:

go get -u golang.org/x/image/...

Fixes golang/go#25618.

Change-Id: I465fac26afdca52878518e4c01d46cf9d12930b9
Reviewed-on: https://go-review.googlesource.com/115675
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-01 11:54:56 +00:00
monkeybutter f315e44030 tiff: fixes problem with decoding tiled uint16 tiff files.
The proposed fix updates the x axis offset variable in case the tile
surpasses the limits of the destination image.

Fixes golang/go#24657

Change-Id: I6bc52274a05dc41b058f6a6f1d0a304f1b20152d
Reviewed-on: https://go-review.googlesource.com/104295
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-03 16:11:27 +00:00
Andrew Bonventre f3a9b89b59 CONTRIBUTING.md: remove note about not accepting Pull Requests
Updates golang/go#24185

Change-Id: I9a3a920ec803ee612775aebfeaedb162d2266aa8
Reviewed-on: https://go-review.googlesource.com/100683
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-14 18:02:48 +00:00
Jiulong Wang 12117c17ca draw: fix crash caused by Scale by Copy shortcut
When DstMask is not nil, this shortcut causes stack overflow because
Copy function in turn will call Scale with same dr and sr.

Fixes golang/go#23107

Change-Id: I8ccadbd9b7f16363ac17b6114308527d6fa9456e
Reviewed-on: https://go-review.googlesource.com/83537
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-12-14 22:51:56 +00:00
Sebastien Binet e5db4c4663 font/opentype: implement font.Face interface
This CL adds the type Face that implements the font.Face interface.
This CL also adds tests using gofont/goregular as an input font, using
github.com/golang/freetype/truetype as reference values.

Updates golang/go#22451.

Change-Id: I2a6945309331b251ec2ddec95b6e809ad10aa116
Reviewed-on: https://go-review.googlesource.com/73870
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2017-12-08 23:31:33 +00:00
Elias Naur f7e31b4ea2 font/sfnt: add Metrics to Font
Change-Id: I4bfcf264e5ee7e4f3ddf89e289d730f230095401
Reviewed-on: https://go-review.googlesource.com/67330
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2017-10-13 01:36:00 +00:00
Kevin Burke 334384d9e1 README: add more description
Move the README to README.md so Gerrit can render it; currently
Gerrit only renders files named exactly "README.md" (for example at
https://go.googlesource.com/go).

Add more links to the README explaining how to file issues,
how to submit code changes, where to download the code to and
how to get it. Hopefully this should help people who go to
https://go.googlesource.com/image or https://github.com/golang/image
figure out how to get started with development.

Change-Id: I390d4bd84c9fd7d0bd3f3f56f63ea8482d03a725
Reviewed-on: https://go-review.googlesource.com/49830
Reviewed-by: Kevin Burke <kev@inburke.com>
2017-09-27 05:35:55 +00:00
Michael Munday e20db36d77 vector: prevent fused multiply-add being used in floatingLineTo
The test code now produces bit-identical results across platforms.

Fixes golang/go#21460.

Change-Id: I58b72dacf3c7930e2804b4e37bd3ccd9ef3dc2f0
Reviewed-on: https://go-review.googlesource.com/61024
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2017-09-07 23:27:51 +00:00
Nigel Tao d1087bc575 vector: benchmark the floating point code path.
Specifically, this commit adds Benchmark.*1024.* functions, and then
gofmt's some other Benchmark functions.

There are existing floating point benchmarks in acc_test.go, but they
have narrower scope. The benchmarks in vector_test.go are closer to
end-to-end benchmarks for the package.

Change-Id: I5b4770bcefa9aa3ed4d4823f78993df7b80c7d87
Reviewed-on: https://go-review.googlesource.com/62130
Reviewed-by: David Symonds <dsymonds@golang.org>
2017-09-07 00:02:32 +00:00
Nigel Tao 426cfd8eeb font/sfnt: implement hflex and hflex1.
Change-Id: I288a014a5b6c54e54ffa69b76a8b12fa7fdbc708
Reviewed-on: https://go-review.googlesource.com/43474
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-05-23 02:19:15 +00:00
Nigel Tao d835a09709 font/sfnt: add ErrColoredGlyph.
Also add tests for the Noto proprietary fonts. Prior to this commit,
NotoColorEmoji.ttf was unsupported. It's still not well supported, but
the error message returned is now more informative.

Change-Id: I61a3301d7f2458a4b838eb1de7a73d6472e3486f
Reviewed-on: https://go-review.googlesource.com/43694
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-05-23 02:17:49 +00:00
Nigel Tao f483456c9f font/sfnt: don't reject multiple kern subtables.
A future commit will actually use subtables past the first one, but for
now, ignore them instead of failing on their presence.

Also add tests for the DejaVu proprietary fonts. Prior to this commit,
DejaVuSans-ExtraLight.ttf was unsupported.

Change-Id: Ic78a59c5ab30e4091efa2a04b89b12cb786157db
Reviewed-on: https://go-review.googlesource.com/42192
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-05-04 00:22:41 +00:00
Nigel Tao d442804300 tiff/lzw: sync with the stdlib compress/lzw.
As noted at the top of reader.go, this package is a fork of the standard
library's LZW package, due to an "off by one" in the TIFF format. Grep
for "NOTE" in the Go code for more details.

This commit picks up an upstream change:
https://go-review.googlesource.com/14410 "tidy up some flush calls"

Picking up the more recent change:
https://go-review.googlesource.com/42032 "fix hi code overflow"
will be a follow-up commit, separate from this straightforward commit,
since it has a non-trivial interaction with that off by one.

Change-Id: Iaf795d11590b3e3e0891e3ea3f04b696de4243c9
Reviewed-on: https://go-review.googlesource.com/42191
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-30 11:58:49 +00:00
Nigel Tao 3210c0296b font/sfnt: support .dfont files.
Change-Id: Id7aa18c48c65586c688cee230ce87f4d88dae9b5
Reviewed-on: https://go-review.googlesource.com/40893
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-04-21 22:58:11 +00:00
kim yongbin a74d51e6d3 tiff: remove InternalError which is not used anywhere.
Change-Id: I92fd800bafd380797651e158c9385dcf3d3578da
Reviewed-on: https://go-review.googlesource.com/40892
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-16 14:51:06 +00:00
Nigel Tao 7c3fafc74f font/sfnt: explicitly close glyph contours.
Change-Id: I4a59167cfe5d84f0ef6732711cca9b46a52b445c
Reviewed-on: https://go-review.googlesource.com/39930
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-04-10 07:42:48 +00:00
Nigel Tao 1de9a5bb2a font/sfnt: implement Font.Bounds.
Change-Id: I24ab4cfa74a791ebb8223b38e5d6624c74caa9f8
Reviewed-on: https://go-review.googlesource.com/39670
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-04-10 07:35:26 +00:00
Nigel Tao 84a6511894 font/sfnt: use charmap EncodeRune API.
Change-Id: I91d850d1816b43748580f6f8a8f19151472750d0
Reviewed-on: https://go-review.googlesource.com/39070
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-05 22:33:02 +00:00
Nigel Tao 10ed294205 font/sfnt: implement Font.GlyphAdvance.
Change-Id: I3e15c6e634d858a87e73221bd9d5a9e3979d674a
Reviewed-on: https://go-review.googlesource.com/39250
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-04-05 22:26:46 +00:00
Nigel Tao ce0faa1867 font/sfnt: flip the Y axis for LoadGlyph's Segments.
The underlying font format's Y axis increases up. The Go standard
graphics libraries' Y axis increases down. This change makes the Go API
consistent with the other Go libraries.

Also change Segment.Args from [6]fixed.Int26_6 to [3]fixed.Point26_6 to
emphasize that the Args are consistent with other fixed.Point26_6 use.

Change-Id: Idd7b89eb4d86890dea477ac2ef96ff8f6b1dee8d
Reviewed-on: https://go-review.googlesource.com/39072
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-03-31 23:39:16 +00:00
Nigel Tao f36ba34967 font/sfnt: implement Font Dict Select.
Change-Id: I8c463b41421a35455701847520367add4727cbe3
Reviewed-on: https://go-review.googlesource.com/38871
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-03-30 23:40:04 +00:00
Nigel Tao 59d151bf14 font/sfnt: implement implicit vstem before hintmask.
Change-Id: I811bcf94b518dabcfbebd085ad3c6a47c17ef38e
Reviewed-on: https://go-review.googlesource.com/38288
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-03-30 01:47:42 +00:00
Nigel Tao ecc1a9abb6 font/sfnt: fix argStack size check for moveto ops.
The *moveto ops don't take multiple args or arg pairs. For example, in
http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5177.Type2.pdf
page 16, the rmoveto args are listed as:
dx1 dy1
which is not the same as rlineto's args, which can be repeated:
{dxa dya}+

Change-Id: I5d13f686e604955909eb0b7e52f20ce5f0522c5d
Reviewed-on: https://go-review.googlesource.com/38289
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-03-30 01:44:25 +00:00
Nigel Tao f03a046406 font/gofont: new Smallcaps; update other Go Fonts.
Bigelow & Holmes have prepared new versions of the Go Fonts. The version
numbers have changed from 2.004 to 2.008. ChangeLog:

* New! 2 new fonts, bringing the total to 12: Go Smallcaps and Go
  Smallcaps Italic.
* New! U+FFFD REPLACEMENT CHARACTER glyph added.
* U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE ring tweaked.
* U+00F0 LATIN SMALL LETTER ETH glyph lightened.
* Superfluous U+0005 <control> glyph removed.
* Split integral, chart draw, block, shade and related glyphs now span
  the full height and have fewer seams when tiled.
* Raised most capital letter diacritics and some lowercase diacritics.
* Mono character widths fixed to be uniform.
* Underline position adjusted.
* SFNT glyph order and cmap table optimized.
* SFNT glyph names (post table) regularized, consistent with the AGLFN.
* ttfautohint upgraded to the latest version, from 1.5 to 1.6.

Change-Id: I0985f07d58b984010199dd723ccdf5892ee59c78
Reviewed-on: https://go-review.googlesource.com/38870
Reviewed-by: Rob Pike <r@golang.org>
2017-03-30 00:58:26 +00:00
Nigel Tao c0851fbc5b font/sfnt: support PostScript compound glyphs (subroutines).
Change-Id: I8aa10150aa004b1bc1128bf0b3d5c14b74ee089c
Reviewed-on: https://go-review.googlesource.com/38280
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-03-22 22:20:00 +00:00