Commit Graph

10 Commits

Author SHA1 Message Date
Nigel Tao
9f8d0d4587 font/plan9font: look for subfont ".0" suffixes.
Change-Id: Id8aadd846311fd621b47912d7b426d6a2d17a594
Reviewed-on: https://go-review.googlesource.com/25560
Reviewed-by: Rob Pike <r@golang.org>
2016-08-07 01:57:26 +00:00
Nigel Tao
22f1b5f81b font/plan9font: optimize the conversion to image.Alpha.
Also remove the dependency on the image/draw package. That package will
give the right answer for arbitrary source images, including those of
type plan9Image, but doing the conversion directly avoids bouncing uint8
or color.Alpha values through the general-purpose draw.Image,
image.Image and color.Color interfaces.

It is possible to optimize this even further, but this will do for now.

benchmark                   old ns/op     new ns/op     delta
BenchmarkParseSubfont-8     2298492       492443        -78.58%

Change-Id: Iea9436bffa097a1ba0052dbabf21516bce8b61e0
Reviewed-on: https://go-review.googlesource.com/21693
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-04-10 01:11:56 +00:00
Ethan Burns
7a320489ae plan9font: use image.Alpha for subface images.
image.Alpha is fast-pathed in draw.Draw, plan9Image is not.

Change-Id: I5ed8fc4d310bb5c6ec2cffdd0ba4295dae2274cf
Reviewed-on: https://go-review.googlesource.com/21453
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-04-07 03:46:29 +00:00
Nigel Tao
f1e9747265 font: add Metrics.Descent.
Change-Id: Id38e7e54264e0e77a28afd8e10cf574610b47336
Reviewed-on: https://go-review.googlesource.com/21019
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-23 23:23:04 +00:00
Ethan Burns
7b1c29e1d6 font: add Face.Metrics.
Fixes golang/go#14885

Change-Id: I3aa2d323c97c76cc78d981d4bf6ea9e95c9bf9d2
Reviewed-on: https://go-review.googlesource.com/21035
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-03-23 23:05:57 +00:00
Nigel Tao
b3d8467d91 font: fix up some old x/exp/shiny references.
Also add canonical import paths for the newly merged packages.

Change-Id: I96fe3a964ba08e718fc9163c980ef7ea9da551fe
Reviewed-on: https://go-review.googlesource.com/14148
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-09-01 05:21:00 +00:00
Nigel Tao
5ae59125bf shiny/font: have Face.Glyph return an advance width, not a new dot.
This is consistent with Face.GlyphBounds and Face.GlyphAdvance.

Change-Id: I9da6b4f2fdb8f093fc9567c717e8fbbecc624e30
Reviewed-on: https://go-review.googlesource.com/14090
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-08-31 01:31:05 +00:00
Nigel Tao
627898392a shiny/font: add per-glyph metrics.
Change-Id: Ie5c7e29b4eb7bd87b8e99de941f2f94b042e268f
Reviewed-on: https://go-review.googlesource.com/13827
Reviewed-by: Rob Pike <r@golang.org>
2015-08-24 05:53:06 +00:00
Nigel Tao
e87ffe258c shiny/font/plan9font: implement ParseFont.
Also delete font.MultiFace. We can resurrect a font.MultiFace type if we
need it in the future, but for now, it's simpler if it lives in the
plan9font package.

Change-Id: I1493b47696c323424e7d91cb7fac15505bfdd023
Reviewed-on: https://go-review.googlesource.com/13520
Reviewed-by: Rob Pike <r@golang.org>
2015-08-19 04:10:22 +00:00
Nigel Tao
eecb4e626f shiny/font: new package for drawing text on an image.
Package font defines an interface for font faces.

Other packages provide font face implementations. For example, a
truetype package (not part of this CL) would provide one based on .ttf
font files.

This CL also introduces the golang.org/x/exp/shiny/font/plan9font
package, a concrete implementation of the font.Face interface for the
Plan 9 bitmap font format.

Change-Id: Iead8914caaa58c7562b18a86b45002ae47486903
Reviewed-on: https://go-review.googlesource.com/13463
Reviewed-by: Rob Pike <r@golang.org>
2015-08-11 05:46:15 +00:00