Commit Graph

188 Commits

Author SHA1 Message Date
Hamcha 3115318f25
Refactor to use emoji package 2018-11-16 11:46:10 +01:00
Hamcha cbc74ad845
Everything should be working decently now! 2018-11-16 10:58:44 +01:00
Hamcha 33cbf9f25f
Fix tree generation breaking subtrees 2018-11-15 18:37:49 +01:00
Hamcha b32820410d
Mini refactor though everything is still broken 2018-11-15 18:20:46 +01:00
Hamcha 591c93aefb
More WIP emoji work 2018-11-15 17:57:41 +01:00
Hamcha 752f9e4be4
Start work on emoji (mostly to be scrapped tho) 2018-11-14 18:08:36 +01:00
Hamcha 1d07a50459
Change import paths 2018-11-14 10:38:19 +01:00
Nigel Tao e2365dfdc4 Fix a comment typo. 2017-06-09 10:35:04 +10:00
Nigel Tao bcfeb16b74 Allow multiple kern subtables.
We still only use the first subtable, but we no longer fail if there's
more than one subtable.

Updates fogleman/gg#7
2017-04-29 10:42:25 +10:00
Nigel Tao b12e981082 Support Unicode Full Repertoire cmap tables.
For example, "Apple Color Emoji.ttc" has such a cmap. After this commit,
we can render its glyph for "U+0001F1E6 REGIONAL INDICATOR SYMBOL LETTER
A", which is clearly outside the Unicode BMP.

Note that this only lets us render black-and-white glyphs for out-of-BMP
runes. Rendering color glyphs (i.e. emoji) remains TODO.

Updates #45
2017-04-20 11:23:31 +10:00
Nigel Tao 255de57f4e Merge pull request #47 from mattn/ttc-v2
Support TTC v2
2017-04-08 18:09:51 +10:00
Yasuhiro Matsumoto d8e54afd1a Support TTC v2
Close #11
2017-04-07 21:01:03 +09:00
Nigel Tao d9be45aaf7 Don't crash when a glyph has no contours. 2016-12-08 17:47:10 +11:00
Nigel Tao 38b4c392ad Add the genbasicfont program. 2016-06-26 16:51:47 +10:00
Nigel Tao a31d0146da Loosen the SLOOP (Set LOOP) opcode precondition.
This goes against spec, but matches the C Freetype implementation and
works around a bug in DejaVuSansMono.ttf's hinted '2' glyph.
2016-05-19 16:15:10 +10:00
Nigel Tao c67e4d98d2 Use an "example" build tag instead of "ignore".
The golang-dev discussion is at
https://groups.google.com/d/topic/golang-dev/qKpxZiNABcY/discussion
2016-04-10 15:05:36 +10:00
Nigel Tao f9531a3606 Add a face.Metrics method, and parse hhea ascent and descent.
A recent change added a Metrics method to the font.Face interface.
2016-03-24 11:05:48 +11:00
Nigel Tao 9ce4eec92a Add an example/capjoin program. 2016-02-21 22:25:27 +11: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