Commit Graph

151 Commits

Author SHA1 Message Date
Nigel Tao
e849ac9382 freetype: fix MDRP/MIRP Set-RP0 bit and fix normalize rounding.
Also make phantom point delta-X adjustment.

Also make print-glyph-points require Freetype version >= 2.5, which is
the latest version, at the time of writing.

R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/18370043
2013-10-29 20:59:39 +11:00
Nigel Tao
ab80f5823d freetype/truetype: implement SHP and DELTAP opcodes.
R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/16500043
2013-10-25 20:07:33 +11:00
R?my Oudompheng
486e1683dd freetype/truetype: handle control value cut-in in MIRP.
The difference is quite large on glyph 509 (period character)
of Adobe Source Sans Pro Bold Italic.

R=golang-dev, nigeltao, bsiegert
CC=golang-dev
https://codereview.appspot.com/16820043

Committer: Nigel Tao <nigeltao@golang.org>
2013-10-25 11:01:57 +11:00
R?my Oudompheng
5ac614f802 freetype/truetype: implement MSIRP instruction.
R=golang-dev, nigeltao, bsiegert
CC=golang-dev
https://codereview.appspot.com/16630044

Committer: Nigel Tao <nigeltao@golang.org>
2013-10-25 11:00:02 +11:00
R?my Oudompheng
7bee3b6fe0 freetype/truetype: implement GC and MD instructions.
These instructions are found in Adobe Source Sans Pro fonts.

R=golang-dev, nigeltao, bsiegert
CC=golang-dev
https://codereview.appspot.com/16440043

Committer: Nigel Tao <nigeltao@golang.org>
2013-10-24 20:17:56 +11:00
Nigel Tao
ab106efa01 freetype/truetype: implement SPVTL, SFVTL, SHZ, SHPIX opcodes.
Fix MIRP opcodes, scaled CVT initialization and Hinter.move.

R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/14930050
2013-10-24 10:47:50 +11:00
R?my Oudompheng
e1f638ef1d freetype/truetype: fix IP rounding for negative numbers.
Found in Adobe Source Sans Pro.

R=golang-dev, bsiegert, nigeltao
CC=golang-dev
https://codereview.appspot.com/15360043

Committer: Nigel Tao <nigeltao@golang.org>
2013-10-22 17:13:52 +11:00
Nigel Tao
3d51db0e38 freetype: C: add R?my Oudompheng's gmail.com address.
I fail at copy/pasting from the main Go repo.

R=adg, remyoudompheng
CC=golang-dev
https://codereview.appspot.com/14960051
2013-10-22 17:13:00 +11:00
Nigel Tao
2c9a24fb31 freetype: A+C: R?my Oudompheng (individual CLA)
R=dsymonds, adg
CC=golang-dev
https://codereview.appspot.com/15050048
2013-10-22 15:48:40 +11:00
Nigel Tao
b821f16356 freetype/truetype: WCVTP, RCVT opcodes.
R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14802046
2013-10-19 10:04:03 +11:00
Nigel Tao
bb775957cb freetype/truetype: propagate the useMyMetrics flag to nested components.
Also increase the maximum recursion depth from 4 to 8, since some
x-deja-vu-sans-oblique glyphs are actually depth 4. It's an arbitrary
limit. The C Freetype code doesn't seem to limit recursion (below
whatever the font says it needs), but it seems safer to have a limit.

R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14494062
2013-10-17 10:21:20 +11:00
Nigel Tao
8373bbf0e6 freetype/truetype: implement compound glyph transforms.
R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14425064
2013-10-16 21:39:06 +11:00
Nigel Tao
c8094ec963 freetype/truetype: refactor glyph.go; match C Freetype's rounding on
one more test case.

R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14691043
2013-10-16 18:54:54 +11:00
Nigel Tao
95f62386c3 freetype/truetype: enable the Times New Roman tests.
R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14641043
2013-10-15 09:26:07 +11:00
Nigel Tao
30be3ed95b freetype/truetype: speed up the testScaling test function.
"go test" drops from 5.203s to 0.474s.

R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14566047
2013-10-13 15:43:34 +11:00
Nigel Tao
9e24a6204e freetype/truetype: implement Font.Index binary search.
R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14604044
2013-10-12 09:29:59 +11:00
Nigel Tao
0a778f7f02 freetype/truetype: parse UCS-4 encoded cmap tables.
R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14548046
2013-10-11 07:29:40 +11:00
Nigel Tao
ba07cbfbc8 freetype/truetype: set the four phantom points, and adjust the glyph
points accordingly.

Yes, it's a mess, but let's pass the tests first, and then refactor.

R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14419052
2013-10-10 07:43:32 +11:00
Nigel Tao
b76427be47 freetype: add script to create more hinting tests.
R=bsiegert, r
CC=golang-dev
https://codereview.appspot.com/14414044
2013-10-09 20:07:32 +11:00
Nigel Tao
b968fb0953 freeetype: move the test fonts from the luxi-fonts/ directory to
testdata/, in anticipation of having other test data.

R=dsymonds
CC=bsiegert, golang-dev
https://codereview.appspot.com/14361044
2013-10-04 17:03:59 +10:00
Nigel Tao
0ec7c0ecae freetype/truetype: fix IUP rounding for negative numbers.
We now match Freetype C exactly for hinting luxisr.ttf. Yay.

R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14336044
2013-10-04 08:30:53 +10:00
Nigel Tao
7e90529703 freetype/truetype: fix the SSW instruction to scale the single-width
value and the MDRP instruction's use of the single-width value.

R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14273043
2013-10-03 21:32:43 +10:00
Nigel Tao
7505dadf20 freetype/truetype: make a (sub-)glyph's points an explicit part of a
Hinter's state, instead of having a glyph shrink and restore its
points around hinting.

R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14203043
2013-10-02 20:37:11 +10:00
Nigel Tao
e88fe00bdb freetype/truetype: fix hinting of compound glyphs.
R=bsiegert
CC=golang-dev
https://codereview.appspot.com/14117043
2013-10-01 18:08:52 +10:00
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