Involved Source Filesface.goglyph.gohint.goopcodes.go Package truetype provides a parser for the TTF and TTC file formats.
Those formats are documented at http://developer.apple.com/fonts/TTRefMan/
and http://www.microsoft.com/typography/otspec/
Some of a font's methods provide lengths or co-ordinates, e.g. bounds, font
metrics and control points. All these methods take a scale parameter, which
is the number of pixels in 1 em, expressed as a 26.6 fixed point value. For
example, if 1 em is 10 pixels then scale is fixed.I(10), which is equal to
fixed.Int26_6(10 << 6).
To measure a TrueType font in ideal FUnit space, use scale equal to
font.FUnitsPerEm().
Package-Level Type Names (total 10)
/* sort by: | */
A Font represents a Truetype font. Bounds returns the union of a Font's glyphs' bounds. FUnitsPerEm returns the number of FUnits in a Font's em-square's side. HMetric returns the horizontal metrics for the glyph with the given index. Index returns a Font's index for the given rune. Kern returns the horizontal adjustment for the given glyph pair. A positive
kern means to move the glyphs further apart. Name returns the Font's name value for the given NameID. It returns "" if
there was an error, or if that name was not found. VMetric returns the vertical metrics for the glyph with the given index.
func Parse(ttf []byte) (font *Font, err error)
func NewFace(f *Font, opts *Options) font.Face
func (*GlyphBuf).Load(f *Font, scale fixed.Int26_6, i Index, h font.Hinting) error
A FormatError reports that the input is not a valid TrueType font.( FormatError) Error() string
FormatError : error
A GlyphBuf holds a glyph's contours. A GlyphBuf can be re-used to load a
series of glyphs from a Font. AdvanceWidth is the glyph's advance width. Bounds is the glyph's bounding box. Ends is the point indexes of the end point of each contour. The length
of Ends is the number of contours in the glyph. The i'th contour
consists of points Points[Ends[i-1]:Ends[i]], where Ends[-1] is
interpreted to mean zero. Points contains all Points from all contours of the glyph. If hinting
was used to load a glyph then Unhinted contains those Points before they
were hinted, and InFontUnits contains those Points before they were
hinted and scaled. Points contains all Points from all contours of the glyph. If hinting
was used to load a glyph then Unhinted contains those Points before they
were hinted, and InFontUnits contains those Points before they were
hinted and scaled. Points contains all Points from all contours of the glyph. If hinting
was used to load a glyph then Unhinted contains those Points before they
were hinted, and InFontUnits contains those Points before they were
hinted and scaled. Load loads a glyph's contours from a Font, overwriting any previously loaded
contours for this GlyphBuf. scale is the number of 26.6 fixed point units in
1 em, i is the glyph index, and h is the hinting policy.
Options are optional arguments to NewFace. DPI is the dots-per-inch resolution.
A zero value means to use 72 DPI. GlyphCacheEntries is the number of entries in the glyph mask image
cache.
If non-zero, it must be a power of 2.
A zero value means to use 512 entries. Hinting is how to quantize the glyph nodes.
A zero value means to use no hinting. Size is the font size in points, as in "a 10 point font size".
A zero value means to use a 12 point font size. SubPixelsX is the number of sub-pixel locations a glyph's dot is
quantized to, in the horizontal direction. For example, a value of 8
means that the dot is quantized to 1/8th of a pixel. This quantization
only affects the glyph mask image, not its bounding box or advance
width. A higher value gives a more faithful glyph image, but reduces the
effectiveness of the glyph cache.
If non-zero, it must be a power of 2, and be between 1 and 64 inclusive.
A zero value means to use 4 sub-pixel locations. SubPixelsY is the number of sub-pixel locations a glyph's dot is
quantized to, in the vertical direction. For example, a value of 8
means that the dot is quantized to 1/8th of a pixel. This quantization
only affects the glyph mask image, not its bounding box or advance
width. A higher value gives a more faithful glyph image, but reduces the
effectiveness of the glyph cache.
If non-zero, it must be a power of 2, and be between 1 and 64 inclusive.
A zero value means to use 1 sub-pixel location.
func NewFace(f *Font, opts *Options) font.Face
A Point is a co-ordinate pair plus whether it is 'on' a contour or an 'off'
control point. The Flags' LSB means whether or not this Point is 'on' the contour.
Other bits are reserved for internal use.Xfixed.Int26_6Yfixed.Int26_6
An UnsupportedError reports that the input uses a valid but unimplemented
TrueType feature.( UnsupportedError) Error() string
UnsupportedError : error
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.