I have taken the opportunity of the import path change to make some
breaking API changes. (The original Go code dates from 2010, before
things like the append built-in function existed). I was hoping to
have made all of those changes by the time that Google Code Hosting
became read-only on August 24, but that was not the case. Nonetheless,
in the long term, the code.google.com page should probably redirect to
the github.com page, and since I couldn't flip that switch after GCH
went read-only, the switch was flipped earlier this week.
Unfortunately, this seems to have broken "go get
code.google.com/p/freetype-go/freetype". I thought that GCH would
still serve svn or hg in read-only mode, but I was mistaken.
This has broken projects like github.com/gonum/plot and
github.com/llgcode/draw2d that depended on
code.google.com/p/freetype-go, in that they are now not "go get"table.
I'm happy to answer questions from any such projects about how they
can unbreak their builds. In the short term, they could vendor the old
code.google.com/p/freetype-go code, or they should be able to change
their import paths, possibly also importing some extra packages under
the golang.org/x tree:
After that, most changes should be mechanical, such as:
- truetype.Font.Kerning becomes truetype.Font.Kern.
- truetype.NoHinting becomes font.HintingNone.
- Some values (like a font scale and an advance width) changes from
int32 to fixed.Int26_6, a common type for sub-pixel measurements. (The
golang.org/x font packages can't depend on
- Similarly, raster.Point becomes fixed.Point26_6.
The golang.org/x/exp/shiny/font package lets programmers use a variety
of font files (such as the Plan 9 font files), not just the truetype
implementation of the freetype project. It might move in the future
out from golang.org/x/exp/..., maybe to golang.org/x/image/..., but
that's where it lives for now.
The long term solution is to favor golang.org/x/exp/shiny/font and its
font.Drawer type over github.com/golang/freetype and its
freetype.Context type (which is deprecated). A font.Drawer can draw
text from a variety of formats, via the font.Face interface, an
implementation of which is a recent addition to the
github.com/golang/freetype/truetype package. One long standing feature
request that was finally implemented is that a font.Drawer can measure
a string without drawing its glyphs. The font.drawer example  shows
how to horizontally center the "Jabberwocky" title on the output image
with a truetype.Face. You can compare that to the (deprecated)
freetype.Context example , which has similar output, without a
horizontally centered title string.
The new packages are not feature-complete, optimized, or API frozen,
by any means. There certainly needs more API to be able to line-break
a paragraph of text. I wasn't intending to talk much about the new API
until it was further along, but the Google Code Hosting read-onliness
made me break "go get", which has prompted me to announce it earlier.
I'm happy to hear your feedback.
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
For more options, visit https://groups.google.com/d/optout.