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>
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>
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
Fixesgolang/go#28684
Change-Id: I2749c638c5f3ed15e4db0448bc7a5e2c12c056e5
Reviewed-on: https://go-review.googlesource.com/c/148576
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
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#ToHTMLFixesgolang/go#28683
Change-Id: Ibc5488d5cc66fe3a5f2bbe2fe23628dd08276037
Reviewed-on: https://go-review.googlesource.com/c/148573
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
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>
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>
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>
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>
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>
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>
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.
Fixesgolang/go#28379
Change-Id: I2293e498e72f95e5fe08c2b375ea7b020d06cde3
Reviewed-on: https://go-review.googlesource.com/c/144080
Reviewed-by: Nigel Tao <nigeltao@golang.org>
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.
Fixesgolang/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>
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.
Fixesgolang/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>
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>
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/...
Fixesgolang/go#25618.
Change-Id: I465fac26afdca52878518e4c01d46cf9d12930b9
Reviewed-on: https://go-review.googlesource.com/115675
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The proposed fix updates the x axis offset variable in case the tile
surpasses the limits of the destination image.
Fixesgolang/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>
When DstMask is not nil, this shortcut causes stack overflow because
Copy function in turn will call Scale with same dr and sr.
Fixesgolang/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>
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>
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>
The test code now produces bit-identical results across platforms.
Fixesgolang/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>
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>
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>
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>
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>
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>
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>
Recent commits (probably 792d36e1 "support TrueType compound glyphs" and
1995ed1a "support TrueType glyph transformations") let us decode all the
glyphs in the Adobe TrueType fonts, but I forgot to update the test
coverage in those commits.
Change-Id: I7b135005cd67082f84aee16d296debdedcc9488e
Reviewed-on: https://go-review.googlesource.com/38281
Reviewed-by: David Crawshaw <crawshaw@golang.org>