Commit Graph

44 Commits

Author SHA1 Message Date
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 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 10cb3b4280 freetype/truetype: calculate advance widths correctly.
The logic is a little clunky, but as before, let's get it right first,
then get it clean once we have a full battery of tests.

R=bsiegert
CC=golang-codereviews
https://codereview.appspot.com/50910043
2014-01-14 09:58:07 +11:00
Nigel Tao 897255e610 freetype/truetype: fix bounding box calculation.
R=bsiegert
CC=golang-codereviews, remyoudompheng
https://codereview.appspot.com/39440045
2013-12-21 10:03:04 +11:00
Nigel Tao 9fd1f2aca9 freetype/truetype: add testdata for advance widths and bounding boxes.
R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/40690045
2013-12-16 13:47:21 +11:00
Nigel Tao f3eade8b5f freetype/truetype: fix MD0/MD1 opcodes and f26dot6 multiplication
rounding.

Pass all the hinting tests. Hooray! Removing the hintingBrokenAt field
will be a follow-up CL.

R=bsiegert, remyoudompheng, jeremyjackins
CC=golang-dev
https://codereview.appspot.com/36880043
2013-12-05 09:09:03 +11:00
Nigel Tao 4c33bd09f5 freetype/truetype: implement SCFS, FLIPPT, FLIPRGON, FLIPRGOFF opcodes.
R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/36300043
2013-12-04 10:04:19 +11:00
Nigel Tao 25cb1e119f freetype/truetype: fix SHC opcode.
R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/36220043
2013-12-03 10:57:02 +11:00
Nigel Tao 11bef13aa5 freetype/truetype: track phantom points across compound glyphs.
The very subtle pp1x versus phantomPoints[0].X distinction is pretty
ugly code, but let's get all the tests passing first, so that we can
refactor with confidence.

R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/35850043
2013-12-03 08:21:05 +11:00
Nigel Tao 5cb0a99dcd freetype/truetype: fix Super45 rounding.
R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/34790045
2013-11-30 15:19:12 +11:00
Nigel Tao 1f97ea5d8e freetype/truetype: apply the pp1x adjustment to the unhinted points
*before* hinting.

R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/35070044
2013-11-29 22:12:55 +11:00
Nigel Tao 114d43ecfe freetype/truetype: load vertical metrics from the OS/2 table.
R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/34700043
2013-11-29 10:33:11 +11:00
Nigel Tao 1c0c5a1f9a freetype/truetype: upgrade testdata to C Freetype 2.5.1.
R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/33650044
2013-11-28 14:02:28 +11:00
Nigel Tao 02a88bab17 freetype/truetype: fix SHC, MIRP opcodes.
R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/33750043
2013-11-27 20:09:54 +11:00
Nigel Tao 5a5d117404 freetype/truetype: normalize and set dual vector for SPVFS and SFVFS
opcodes. Calculate dot product with 32-bit math to match C Freetype's
rounding.

R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/32740043
2013-11-27 17:48:57 +11:00
Nigel Tao cce54f9bf8 freetype/truetype: fix order of 1st phantom point adjustment and
2nd / 4th phantom point rounding.

R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/32040043
2013-11-26 20:06:51 +11:00
Nigel Tao cef9ca89c7 freetype/truetype: implement ISECT, SHC, WCVTF, DELTAC and SDPVTL
opcodes.

R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/29510043
2013-11-21 08:51:09 +11:00
Nigel Tao f6106a9f8b freetype/truetype: adjust ends slice when hinting a compound glyph.
Successfully hint all of DejaVu Sans Oblique, barring 4 exceptions
that are errors in the upstream C Freetype project. See
http://lists.nongnu.org/archive/html/freetype/2013-11/msg00004.html
for details.

R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/21580044
2013-11-07 08:53:15 +11:00
Nigel Tao cdaff3c716 freetype/truetype: run compound glyph hinting instructions.
Also add API for vertical metrics.

R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/21330043
2013-11-05 09:58:40 +11:00
Nigel Tao 1f81822fe1 freetype/truetype: recalculate 'phantom point 1' after rounding.
R=bsiegert
CC=golang-dev, remyoudompheng
https://codereview.appspot.com/19090043
2013-10-30 07:50:48 +11:00
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
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
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 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 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 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