Commit Graph

25 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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