Documentation ¶
Index ¶
- func GetFace(gc *draw2dimg.GraphicContext, fontData draw2d.FontData, size float64) font.Face
- func GetGlyphWidth(tf TypeFace, char rune) float64
- func GetTextHeight(tf TypeFace, text string) (float64, float64)
- func GetTextWidth(tf TypeFace, text string) float64
- func SetFont(gc *draw2dimg.GraphicContext, typeFace TypeFace)
- type FaceMetrics
- type GlyphBounds
- type GlyphMetrics
- type MyFontCache
- type TypeFace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGlyphWidth ¶
func GetTextWidth ¶
func SetFont ¶
func SetFont(gc *draw2dimg.GraphicContext, typeFace TypeFace)
Types ¶
type FaceMetrics ¶
type FaceMetrics struct { Ascent float64 Descent float64 Height float64 XHeight float64 CapHeight float64 CaretSlope image.Point }
func GetFaceMetrics ¶
func GetFaceMetrics(tf TypeFace) FaceMetrics
Metrics holds the metrics for a Face. A visual depiction is at https://developer.apple.com/library/mac/documentation/TextFonts/Conceptual/CocoaTextArchitecture/Art/glyph_metrics_2x.png
type GlyphBounds ¶
type GlyphBounds struct { BlX float64 BlY float64 TlX float64 TlY float64 TrX float64 TrY float64 BrX float64 BrY float64 }
func GetGlyphBounds ¶
func GetGlyphBounds(tf TypeFace, char rune) GlyphBounds
type GlyphMetrics ¶
type GlyphMetrics struct { Ascent float64 Descent float64 BearingLeft float64 BearingRight float64 Advance float64 }
func GetGlyphMetrics ¶
func GetGlyphMetrics(tf TypeFace, char rune) GlyphMetrics
GlyphBounds returns the bounding box of r's glyph, drawn at a dot equal to the origin, and that glyph's advance width.
It returns !ok if the face does not contain a glyph for r.
The glyph's ascent and descent are equal to -bounds.Min.Y and +bounds.Max.Y. The glyph's left-side and right-side bearings are equal to bounds.Min.X and advance-bounds.Max.X. A visual depiction of what these metrics are is at https://developer.apple.com/library/archive/documentation/TextFonts/Conceptual/CocoaTextArchitecture/Art/glyphterms_2x.png