Commit graph

171 commits

Author SHA1 Message Date
flopp
5145ef04c4 added range checks to cmap parsing 2016-02-19 18:41:00 +01:00
Nigel Tao
aeca2bb589 Merge pull request #29 from fogleman/master
Fix Capper & Joiner bugs introduced by 856a70c.
2016-02-19 12:40:59 +11:00
Michael Fogleman
94aa75bbd9 A+C: add Michael Fogleman <fogleman@gmail.com> 2016-02-18 18:24:11 -05:00
Michael Fogleman
aed127b02f Fix Capper & Joiner bugs introduced by 856a70c
Some constants were not updated properly when switching
from raster.Point to fixed.26_6
2016-02-18 10:39:21 -05:00
Nigel Tao
2b7eb15daa Merge pull request #22 from ksimka/patch-1
Fix max alpha value: 1<<32-1, not 1<<16-1.

This was missed in 8a442816.
2016-01-29 13:25:26 +11:00
Nigel Tao
724061d635 A+C: add Maksim Kochkin <maxxarts@gmail.com>. 2016-01-29 13:20:07 +11:00
Maksim Kochkin
23cf3c9a64 Change alpha max value from 1<<32-1 to 1<<16-1
Looks like since 8a4428169d you forget to change this in MonochromePainter
2015-11-29 16:00:23 +03:00
Nigel Tao
f29eb116de A+C: fix Steven Edwards' name and e-mail address.
See the discussion on https://github.com/golang/freetype/pull/19
2015-09-24 11:38:38 +10:00
Nigel Tao
640edd0946 Fix some style nits. 2015-09-21 17:13:27 +10:00
Stephen Edwards
995030b974 Add Font.Name method. 2015-09-21 16:46:35 +10:00
Nigel Tao
fb514f71f0 A+C: add Stephen Edwards <cureadvocate@gmail.com>. 2015-09-21 16:40:42 +10:00
Nigel Tao
41fa49aa5b Update x/exp/shiny/font to x/image/font. 2015-09-01 15:49:46 +10:00
Nigel Tao
494079eb2b Cache the glyph index lookup.
benchmark                 old ns/op     new ns/op     delta
BenchmarkDrawString-8     8618239       8149527       -5.44%
2015-08-31 14:14:50 +10:00
Nigel Tao
03bdcc0fe1 Have face.Glyph return an advance width, not the new dot.
This tracks an upstream change in the x/exp/shiny/font package.
2015-08-31 11:34:42 +10:00
Nigel Tao
8a4428169d Make raster.Painter's max alpha 1<<16-1, not 1<<32-1.
This is more consistent with the standard library's image/color package.

The benchmarks didn't seem to change significantly.
2015-08-30 23:48:43 +10:00
Nigel Tao
3ba1c0f728 Rename Point and End slices to Points and Ends.
The slice Foos is plural; it refers to multiple elements. The element Foos[i]
is the i'th Foo.
2015-08-30 22:27:18 +10:00
Nigel Tao
3cc748686b Use fixed.Rectangle26_6 instead of truetype.Bounds.
The previous "the endpoints are inclusive" comment seems confusing. It's true
that the bounding box's max X equals the right-most coordinate, which suggests
<= instead of <, but that node's coordinate is itself exclusive. Consider the
solid 1-pixel square: (0, 0), (64, 0), (64, 64), (0, 64) in fixed.Point26_6
coordinates. The right-most coordinate is 64, and the bounding box's max X
equals 64, but rasterizing that square only affects sub-pixels up to but not
including 64.

Instead, it seems accurate to follow the fixed.Rectangle26_6 description, in
that the max values are exclusive.
2015-08-30 22:06:37 +10:00
Nigel Tao
7a598da6de Delete the truetype.NewGlyphBuf function.
The zero value of a GlyphBuf is already perfectly usable.
2015-08-30 21:35:58 +10:00
Nigel Tao
fe26067669 Cache glyph mask images.
benchmark                 old ns/op     new ns/op     delta
BenchmarkDrawString-4     88103151      14188817      -83.90%
2015-08-27 22:16:16 +10:00
Nigel Tao
62e59645ee Quantize sub-pixel glyph rendering.
This is in anticipation of caching glyph images. Quantization means that cache
hits are more likely.

Also make NewFace take an *Options instead of an Options.
2015-08-25 22:34:31 +10:00
Nigel Tao
a021a5f23e Rename Kerning to Kern. 2015-08-24 16:17:16 +10:00
Nigel Tao
db77c6a161 Delete some unnecessary fixed.Int26_6 conversions. 2015-08-24 15:57:20 +10:00
Nigel Tao
24265d1c91 Implement GlyphBounds and GlyphAdvance. 2015-08-24 15:51:50 +10:00
Nigel Tao
9c46b87503 Make face.Glyph not allocate a new mask each time.
benchmark                 old ns/op     new ns/op     delta
BenchmarkDrawString-4     96914389      88683659      -8.49%

benchmark                 old allocs     new allocs     delta
BenchmarkDrawString-4     32287          0              -100.00%

benchmark                 old bytes     new bytes     delta
BenchmarkDrawString-4     1929619       156           -99.99%
2015-08-23 21:11:02 +10:00
Nigel Tao
2d84b72ff6 Add a DrawString benchmark. 2015-08-23 20:45:19 +10:00
Nigel Tao
d8618774be Fix some comment typos.
These comments weren't updated when we went from 24.8 to 26.6.
2015-08-22 14:48:07 +10:00
Nigel Tao
6deea24143 Add a truetype.Face type.
Its implementation is mostly a copy/paste of the freetype.Context type.
Follow-up commits will make it more efficient.

Also add an example that uses a truetype.Face and the
golang.org/x/exp/shiny/font package to draw text.
2015-08-22 14:46:12 +10:00
Nigel Tao
7166253831 Fix rounding up for 26.6 fixed point, not 24.8. 2015-08-21 14:00:51 +10:00
Nigel Tao
071d96ed47 Update BenchmarkDrawString testdata dir. 2015-08-20 16:09:11 +10:00
Nigel Tao
f42630ca7a Use the common golang.org/x/exp/shiny/font.Hinting type. 2015-08-20 16:07:51 +10:00
Nigel Tao
7e2154db58 Delete the f26dot6 type in favor of fixed.Int26_6. 2015-08-18 16:47:46 +10:00
Nigel Tao
43fc220ebd Make f26dot6 methods prefix, not infix.
This is in anticipation of removing the f26dot6 type entirely. Instead,
we will use the fixed.Int26_6 type from golang.org/x/image/math/fixed.
2015-08-18 16:36:59 +10:00
Nigel Tao
e8121e3c7d Don't use backtick quotes in the comments. 2015-08-18 16:33:14 +10:00
Nigel Tao
2a5cbfd47e Use the fixed.Int26_6 type in package truetype. 2015-08-18 16:30:37 +10:00
Nigel Tao
a9554eda48 Fix example/freetype for the s/Fix32/fixed.Int26_6/ change. 2015-08-18 16:08:44 +10:00
Nigel Tao
856a70c395 Use the fixed.Int26_6 and fixed.Point26_6 types. 2015-08-17 10:26:09 +10:00
Nigel Tao
d91c1d6844 Remove Point methods other than Add, Sub, Mul.
This is in anticipation of removing the Point type entirely. Instead, we will
use the fixed.Point26_6 type from golang.org/x/image/math/fixed.
2015-08-13 21:17:25 +10:00
Nigel Tao
84ba7fbd7a Add "+build ignore" tags to the examples. 2015-08-12 14:41:46 +10:00
Nigel Tao
5193f9f147 Add canonical import paths. 2015-08-12 14:34:19 +10:00
Nigel Tao
d1c460896e Fix testdata paths after moving files up one level. 2015-08-12 14:32:40 +10:00
Nigel Tao
bf25f8ce0e Move files up one level. 2015-08-12 14:30:01 +10:00
Nigel Tao
2f0c939b0a Delete hg related detritus.
We use git and github now, not hg and code.google.com.
2015-08-11 14:38:11 +10:00
Nigel Tao
160e1d6137 freetype: fix drawContour when the first point is off the curve.
Fixes issue 16.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews, philipz
https://codereview.appspot.com/209280043
2015-03-09 11:32:30 +11:00
Nigel Tao
78edcde0f3 freetype/raster: fix some style nits.
This code dates from before Go 1.0.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://codereview.appspot.com/206860043
2015-02-24 10:52:08 +11:00
Nigel Tao
cf94cb9b43 freetype/truetype: update the golden tests for Ubuntu 14.04's version
of standard fonts like Deja Vu Sans Oblique.

LGTM=bsiegert
R=bsiegert
CC=golang-codereviews
https://codereview.appspot.com/164660043
2014-11-07 09:38:15 +11:00
Nigel Tao
c3ec330230 freetype/truetype: fix some typos in hint.go.
Fixes issue 12.
Fixes issue 13.

LGTM=bsiegert
R=bsiegert
CC=golang-codereviews
https://codereview.appspot.com/164650043
2014-11-07 09:37:26 +11:00
Nigel Tao
e009753234 freetype/truetype: support symbol fonts such as Webdings.
LGTM=bsiegert
R=bsiegert
CC=golang-codereviews
https://codereview.appspot.com/60380043
2014-02-06 10:38:58 +11:00
Nigel Tao
49fa4a4de0 freetype: add a Hinting enum in the top-level freetype package, and
hide the Hinter implementation in the freetype/truetype package.

LGTM=bsiegert
R=bsiegert
CC=golang-codereviews
https://codereview.appspot.com/58940043
2014-02-01 14:12:48 +11:00
Nigel Tao
51c4a7ede4 freetype/truetype: merge the deltap and deltac code.
LGTM=bsiegert
R=bsiegert
CC=golang-codereviews
https://codereview.appspot.com/54730043
2014-01-30 13:07:29 +11:00
Nigel Tao
c3fc397167 freetype/truetype: refactor dispatch for high opcodes.
Also delete "q means that that opcode is not yet implemented", as all
valid opcodes are now implemented.

R=bsiegert
CC=golang-codereviews
https://codereview.appspot.com/53050044
2014-01-21 09:31:51 +11:00