Commit Graph

127 Commits

Author SHA1 Message Date
Nigel Tao
3490800cec freetype/truetype: fix rounding for negative numbers to match the C
Freetype implementation.

The spec is the "Order of rounding operations" part of
https://developer.apple.com/fonts/TTRefMan/RM02/Chap2.html#rounding
but it wasn't exactly clear to me what "the negative round value
closest to zero" was: if the phase is 1/4, was that value -1/4 or
-3/4? Anyway, the Go code now follows the C code, and code trumps
documentation.

R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14092044
2013-09-29 18:30:55 +10:00
Nigel Tao
c661e372c6 freetype/truetype: implement IUP opcode.
R=bsiegert
CC=golang-dev
https://codereview.appspot.com/13965043
2013-09-29 12:09:09 +10:00
Nigel Tao
75fff80b59 freetype/truetype: implement IP, MIAP, MIRP opcodes.
R=bsiegert
CC=golang-dev
https://codereview.appspot.com/13855043
2013-09-24 22:06:47 +10:00
Nigel Tao
a3c53fdc3f freetype/truetype: implement ALIGNRP, MDAP and MDRP opcodes.
We can now hint the .notdef glyph from luxisr.ttf. Yay.

R=bsiegert
CC=golang-dev
https://codereview.appspot.com/12829048
2013-08-31 16:08:40 +10:00
Nigel Tao
a8a5cfeb78 freetype: respect the ROUND_XY_TO_GRID compound glyph flag.
Also add a test that freetype-go derives the same glyph points as
the C freetype implementation.

R=bsiegert
CC=golang-dev
https://codereview.appspot.com/12670046
2013-08-13 21:08:54 +10:00
Nigel Tao
43c4b0b00d freetype/truetype: add explicit graphics state.
These new opcodes aren't unit-tested per se, but they will be
exercised by an end-to-end hinting test of the Luxi fonts.

R=bsiegert
CC=golang-dev
https://codereview.appspot.com/12100043
2013-08-02 19:13:26 +10:00
Nigel Tao
e3b4bc4c1f freetype/truetype: function call opcodes.
R=bsiegert
CC=golang-dev
https://codereview.appspot.com/11983043
2013-07-30 19:20:31 +10:00
Nigel Tao
28cc5fbc5d freetype: move the scaling from FUnits to pixels from package freetype
to package truetype.

R=bsiegert
CC=golang-dev
http://codereview.appspot.com/6427062
2012-07-25 22:10:25 +10:00
Nigel Tao
f2517f3940 freetype/truetype: odd/even opcodes.
Also re-arrange some of the switch cases to be in opcode order.

R=bsiegert
CC=golang-dev
http://codereview.appspot.com/6352097
2012-07-12 20:49:12 +10:00
Nigel Tao
20ce6ab4df freetype/truetype: variable sized bytecode interpreter stack/store.
R=bsiegert
CC=golang-dev
http://codereview.appspot.com/6343091
2012-07-11 21:49:03 +10:00
Nigel Tao
2bf22ccf6b freetype/truetype: vector set/gets, store ops, roll/max/min ops.
R=bsiegert
CC=golang-dev
http://codereview.appspot.com/6354080
2012-07-09 23:18:25 +10:00
Nigel Tao
9e927de79b freetype/truetype: rounding opcodes.
R=bsiegert
CC=golang-dev
http://codereview.appspot.com/6348079
2012-07-06 17:34:39 +10:00
Nigel Tao
e843d5cf7c freetype/truetype: jump opcodes.
R=gri, bsiegert
CC=golang-dev
http://codereview.appspot.com/6344079
2012-07-05 20:29:35 +10:00
Nigel Tao
523d04e0a7 freetype/truetype: if/else opcodes.
R=gri
CC=golang-dev
http://codereview.appspot.com/6354067
2012-07-04 21:28:44 +10:00
Nigel Tao
8ed9e9345e freetype/truetype: first cut of a bytecode interpreter.
R=gri, bsiegert
CC=golang-dev
http://codereview.appspot.com/6347057
2012-07-03 20:46:16 +10:00
Nigel Tao
6baa5f0a46 freetype: optimize []byte to uint16/uint32 conversions.
Thanks to Jeff R. Allen <jra@nella.org> for the conversation that
led to this change.

benchmark              old ns/op    new ns/op    delta
BenchmarkDrawString     21168440     20143860   -4.84%

The number of mallocs per iteration is unchanged.

R=rsc, r
CC=golang-dev, jra
http://codereview.appspot.com/6304077
2012-06-16 12:19:07 +10:00
Nigel Tao
e5aa5b6a82 freetype: A+C: Jeff R. Allen (individual CLA)
R=adg, rsc
CC=golang-dev
http://codereview.appspot.com/6306078
2012-06-14 11:41:58 +10:00
Nigel Tao
e1ef029a43 freetype: make freetype clean wrt "go vet".
R=dsymonds
CC=golang-dev
http://codereview.appspot.com/6202052
2012-05-07 22:52:01 +10:00
Nigel Tao
25c2d648d0 freetype: update an old comment for Go 1.
R=bradfitz
CC=golang-dev
http://codereview.appspot.com/6202051
2012-05-07 21:07:08 +10:00
Nigel Tao
a16d1037a1 freetype: re-organize the freetype/truetype package into smaller files.
No code changes, just a copy/paste.

R=bradfitz
CC=golang-dev
http://codereview.appspot.com/6201052
2012-05-07 12:04:52 +10:00
Nigel Tao
eaa4846c62 freetype: support TrueType Collection files (.TTC files, as opposed to
.TTF files)

R=bradfitz
CC=golang-dev
http://codereview.appspot.com/6194050
2012-05-07 11:42:35 +10:00
Nigel Tao
9a8fb30c20 freetype: remove arbitrary 1<<24 limit on ttf file size.
I'm not sure why I put that limit in in the first place. I can't find
that limit in either the C Freetype code or the TTF spec.

R=bradfitz
CC=golang-dev
http://codereview.appspot.com/6201043
2012-05-07 09:37:34 +10:00
Nigel Tao
f1ba16952f freetype: update .hgignore.
R=bradfitz
CC=golang-dev
http://codereview.appspot.com/6199043
2012-05-04 16:17:10 +10:00
Nigel Tao
d32ba0b88b freetype: fix overflow when converting from a uint16 glyph index to a
file offset.

R=bradfitz
CC=golang-dev
http://codereview.appspot.com/6198043
2012-05-04 15:42:29 +10:00
Nigel Tao
1dee26bbb2 freetype: delete Makefiles.
R=rsc, dave
CC=golang-dev
http://codereview.appspot.com/5629046
2012-02-04 09:32:01 +11:00
Nigel Tao
97fe2fb9c1 freetype: import path gofixes.
Also update freetype/truetype for s/int/rune/.

R=rsc, bradfitz
CC=golang-dev
http://codereview.appspot.com/5505067
2011-12-23 10:55:36 +11:00
Nigel Tao
97ddbbf4d0 freetype: gofix errors.
R=rsc, r
CC=golang-dev
http://codereview.appspot.com/5339048
2011-11-08 10:38:49 +11:00
Nigel Tao
7b867fea2e freetype: image/color gofix.
R=r, rsc
CC=golang-dev
http://codereview.appspot.com/5166052
2011-10-06 13:55:02 +11:00
Nigel Tao
4188558878 freetype: update for image.NewXxx change.
R=rsc
CC=golang-dev
http://codereview.appspot.com/4996046
2011-09-14 22:02:41 +10:00
Andrew Gerrand
9385f060bc freetype-go: add release tag
R=nigeltao
CC=golang-dev
http://codereview.appspot.com/4762044
2011-07-18 16:05:49 +10:00
Andrew Gerrand
bf6623fb62 freetype-go: add adg to CONTRIBUTORS
R=nigeltao
CC=golang-dev
http://codereview.appspot.com/4765041
2011-07-18 16:05:24 +10:00
Nigel Tao
006c241eaa freetype: update for image.Pix changes (again).
R=r
CC=golang-dev
http://codereview.appspot.com/4702041
2011-07-12 16:41:03 +10:00
Nigel Tao
43d4d89685 freetype: update for image.Pix changes.
R=r
CC=golang-dev
http://codereview.appspot.com/4675071
2011-07-10 15:05:40 +10:00
Nigel Tao
03e93b9a66 freetype: update for image/draw changes.
R=r
CC=golang-dev
http://codereview.appspot.com/4620044
2011-06-16 12:25:21 +10:00
Nigel Tao
fdfcd83e81 freetype: rename exp/draw to image/draw.
R=r
CC=golang-dev
http://codereview.appspot.com/4517137
2011-06-05 14:47:45 +10:00
Nigel Tao
21635f71f4 freetype: update for os.Open changes.
R=adg, r2
CC=golang-dev
http://codereview.appspot.com/4386048
2011-04-11 10:48:00 +10:00
Nigel Tao
380b6363b2 freetype: s/float/float64/.
R=adg, r2
CC=golang-dev
http://codereview.appspot.com/4040045
2011-01-21 12:27:50 +11:00
Nigel Tao
18fe7866b3 freetype: update log to s/Stderr/Println/.
R=r, nigeltao_gnome, adg
CC=golang-dev
http://codereview.appspot.com/2527041
2010-10-15 14:02:11 +11:00
Nigel Tao
220b691d5c freetype: add NewAlpha{Src,Over}Painter constructor function for
consistency with existing NewFooPainter functions.

Unbreak build from ColorImage change in the core image package.

R=adg
CC=golang-dev
http://codereview.appspot.com/2450041
2010-10-12 16:55:01 +11:00
Nigel Tao
5792b75123 freetype: implement stroke for quadratic segments.
Fix bug where the String representation of a Fix32 representing minus
one quarter was "0:064" instead of "-0:064".

R=r, rsc, rog, nigeltao_gnome
CC=golang-dev
http://codereview.appspot.com/2275043
2010-10-03 13:53:04 +11:00
Nigel Tao
ad78f67dc2 freetype: Fix panic when drawing a span to the right of the
bounding rect.

This does for Alpha{Over,Src}Painter what revision 7329234544
did for RGBAPainter.

R=r
CC=golang-dev
http://codereview.appspot.com/2210041
2010-09-15 16:05:32 +10:00
Nigel Tao
eda48ef1c3 freetype: make the point an argument to DrawString, not part of the
context state. Also rename DrawText to DrawString.

R=r
CC=golang-dev
http://codereview.appspot.com/2208041
2010-09-15 14:35:22 +10:00
Nigel Tao
06369b10f7 freetype: add a clip rectangle.
R=r
CC=golang-dev
http://codereview.appspot.com/2171045
2010-09-13 18:20:47 +10:00
Nigel Tao
570e8c24b9 freetype: Split AlphaPainter into two separate types depending on the
Porter-Duff composition operator used. This saves a malloc when passing
an AlphaSrcPainter as a value of Painter interface type.

R=r
CC=golang-dev
http://codereview.appspot.com/2149044
2010-09-10 12:06:50 +10:00
Nigel Tao
84097fa410 freetype: cache glyphs during DrawText.
A freetype.Context now has dst and src image setters and the notion of
a current point, instead of having to pass a painter and pt to DrawText.

R=r, rsc
CC=golang-dev
http://codereview.appspot.com/2169041
2010-09-09 19:22:48 +10:00
Nigel Tao
c92eed8b0c freetype: fix doc comment typo.
R=r
CC=golang-dev
http://codereview.appspot.com/2116046
2010-09-08 20:21:29 +10:00
Nigel Tao
b8ed0a9c12 freetype-go: change freetype.DrawText's point to be at the baseline
instead of at 1em above the baseline.

R=r
CC=golang-dev
http://codereview.appspot.com/2042041
2010-08-27 15:49:35 +10:00
Nigel Tao
29c473cb3e freetype-go: Fix panic when drawing a span to the right of the
bounding rect.

This bug was introduced when an image.RGBA's representation went from
slice of slices to one linear buffer.

R=r
CC=golang-dev
http://codereview.appspot.com/2020044
2010-08-27 10:51:14 +10:00
Nigel Tao
6a75ac002d freetype-go: update examples for draw.Rect being renamed to image.Rect.
R=r
CC=golang-dev
http://codereview.appspot.com/1961046
2010-08-27 10:47:48 +10:00
Nigel Tao
acecb39ad9 freetype-go: fix Makefiles.
R=rsc
CC=golang-dev
http://codereview.appspot.com/1989044
2010-08-26 09:47:25 +10:00