There are currently 2 instantiations: fixed and floating math.
There will eventually be 6: 2 math types times 3 operators (OpOver,
OpSrc and Mask).
Change-Id: I16db8f3693abe30027ea2f822909980403a6142f
Reviewed-on: https://go-review.googlesource.com/30735
Reviewed-by: David Crawshaw <crawshaw@golang.org>
The spec says that these images are invalid. Add a test with an invalid
tiff generated by go-fuzz.
Fixesgolang/go#10549
Change-Id: I3fd3ae5e607202b41735a2d930f55cb7997f7a9b
Reviewed-on: https://go-review.googlesource.com/9377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
There are no code changes, just a re-ordering so that these files are
consistent with others in this package: OpOver, OpSrc, Mask.
Change-Id: Ib1d46a8e912dae0c760af655e919b77023688189
Reviewed-on: https://go-review.googlesource.com/30111
Reviewed-by: David Crawshaw <crawshaw@golang.org>
These tests are copied from the github.com/google/font-go prototype.
Change-Id: I4523193bd3453974633cbef0576c1203eb013a7d
Reviewed-on: https://go-review.googlesource.com/29697
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Some "TODO: the general case" lines remain.
Change-Id: If66e484a00d5ea3fce9db37d4ee493739648daa3
Reviewed-on: https://go-review.googlesource.com/29495
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This lets programs that underscore import this package build on Go 1.5.
Change-Id: Icd977b16eb44389f8ee4640c2ab57e4b6791b1f4
Reviewed-on: https://go-review.googlesource.com/24954
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
A face's glyph height (the height of the glyph image) isn't necessarily
the inter-line spacing: f.Ascent + f.Descent isn't always f.Height.
Similarly, a face's glyph image's left side isn't always dot.X.
Change-Id: I86594c52b8d31bf652ac34a695e9270ac635a5bc
Reviewed-on: https://go-review.googlesource.com/24481
Reviewed-by: David Crawshaw <crawshaw@golang.org>
It can be useful to measure some text without having to set up a Drawer.
Change-Id: I18b7b1fecc32ca69b7644d598ed21462e7c41edd
Reviewed-on: https://go-review.googlesource.com/21785
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Also remove the dependency on the image/draw package. That package will
give the right answer for arbitrary source images, including those of
type plan9Image, but doing the conversion directly avoids bouncing uint8
or color.Alpha values through the general-purpose draw.Image,
image.Image and color.Color interfaces.
It is possible to optimize this even further, but this will do for now.
benchmark old ns/op new ns/op delta
BenchmarkParseSubfont-8 2298492 492443 -78.58%
Change-Id: Iea9436bffa097a1ba0052dbabf21516bce8b61e0
Reviewed-on: https://go-review.googlesource.com/21693
Reviewed-by: Nigel Tao <nigeltao@golang.org>
image.Alpha is fast-pathed in draw.Draw, plan9Image is not.
Change-Id: I5ed8fc4d310bb5c6ec2cffdd0ba4295dae2274cf
Reviewed-on: https://go-review.googlesource.com/21453
Reviewed-by: Nigel Tao <nigeltao@golang.org>
The standard image and image/color packages have NYCbCrA support, as of Go 1.6.
Change-Id: I3ed2a502b3b9fe720968ac21901115e20a11456a
Reviewed-on: https://go-review.googlesource.com/21066
Reviewed-by: Rob Pike <r@golang.org>
The key feature is that its data is entirely self-contained and does not
require loading from separate files.
Change-Id: I4ef72b52cde93597be89dcfd55659f418c6cab23
Reviewed-on: https://go-review.googlesource.com/14486
Reviewed-by: Rob Pike <r@golang.org>
Also add canonical import paths for the newly merged packages.
Change-Id: I96fe3a964ba08e718fc9163c980ef7ea9da551fe
Reviewed-on: https://go-review.googlesource.com/14148
Reviewed-by: David Symonds <dsymonds@golang.org>
The testdata/fixed font files come from the Plan 9 Port, and were all
marked as public domain. The total size of the new testdata is 112K.
Change-Id: I8cf5de4e5abd1aec7e6550d330271f2acdc12402
Reviewed-on: https://go-review.googlesource.com/13888
Reviewed-by: Rob Pike <r@golang.org>
This is consistent with Face.GlyphBounds and Face.GlyphAdvance.
Change-Id: I9da6b4f2fdb8f093fc9567c717e8fbbecc624e30
Reviewed-on: https://go-review.googlesource.com/14090
Reviewed-by: David Symonds <dsymonds@golang.org>
These will be used by other vector font packages, such as the truetype
package, to select specific faces.
Change-Id: I3db8c97335089c2076811e8f85d9a8868fc900bd
Reviewed-on: https://go-review.googlesource.com/13714
Reviewed-by: Rob Pike <r@golang.org>
Also delete font.MultiFace. We can resurrect a font.MultiFace type if we
need it in the future, but for now, it's simpler if it lives in the
plan9font package.
Change-Id: I1493b47696c323424e7d91cb7fac15505bfdd023
Reviewed-on: https://go-review.googlesource.com/13520
Reviewed-by: Rob Pike <r@golang.org>
The P function is especially common in e.g. Freetype code that works
with both the integer-pixel (X,Y) coordinates used by the stdlib image
package and sub-pixel (X,Y) coordinates used by its raster package.
Change-Id: I68be8ca71ceb24f40277ecc39a0896323f6671f5
Reviewed-on: https://go-review.googlesource.com/13652
Reviewed-by: Rob Pike <r@golang.org>
This package provides named colors as defined in the SVG 1.1 spec.
Named colors are parsed from the SVG 1.1 spec web page at
http://www.w3.org/TR/SVG/types.html and written using go generate
fixesgolang/go#11734
Change-Id: Ia75a166b3714a36a07be64c7d331231b5b2d0cf2
Reviewed-on: https://go-review.googlesource.com/13181
Reviewed-by: Nigel Tao <nigeltao@golang.org>
These mirror the image.Point methods in the standard library.
Change-Id: I7309af308a8182e325af20b47341f72703cbc95a
Reviewed-on: https://go-review.googlesource.com/13603
Reviewed-by: David Crawshaw <crawshaw@golang.org>