Documentation
¶
Index ¶
- Constants
- type Capitalization
- type Face
- type Family
- type Font
- func (d *Font) Ascent() float64
- func (d *Font) BetterMatch(oldDesc *Font, newDesc *Font) bool
- func (d *Font) Capitalization() Capitalization
- func (d *Font) Copy() *Font
- func (d *Font) Descent() float64
- func (d *Font) Dispose()
- func (d *Font) Equals(other *Font) bool
- func (d *Font) Family() string
- func (d *Font) Height() float64
- func (d *Font) IndexForPosition(x float64, text string) int
- func (d *Font) Leading() float64
- func (d *Font) Measure(text string) geom.Size
- func (d *Font) Monospaced() bool
- func (d *Font) PangoFontDescription() unsafe.Pointer
- func (d *Font) PositionForIndex(index int, text string) float64
- func (d *Font) SetCapitalization(capitalization Capitalization)
- func (d *Font) SetFamily(family string)
- func (d *Font) SetSize(size float64)
- func (d *Font) SetSlant(slant Slant)
- func (d *Font) SetStretch(stretch Stretch)
- func (d *Font) SetWeight(weight Weight)
- func (d *Font) Size() float64
- func (d *Font) Slant() Slant
- func (d *Font) Stretch() Stretch
- func (d *Font) String() string
- func (d *Font) Weight() Weight
- type Slant
- type Stretch
- type Weight
Constants ¶
const ( // PangoScale is a constant used by the Pango font engine. PangoScale = float64(C.PANGO_SCALE) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capitalization ¶
type Capitalization C.PangoVariant
Capitalization is an enumeration of capitalization possibilities.
const ( CapitalizationNormal Capitalization = C.PANGO_VARIANT_NORMAL CapitalizationSmall Capitalization = C.PANGO_VARIANT_SMALL_CAPS )
Possible capitalizations.
func (Capitalization) String ¶
func (c Capitalization) String() string
String returns the name of the capitalization.
type Face ¶
type Face struct {
// contains filtered or unexported fields
}
Face represents a group of fonts with the same family, slant, weight, and width.
func (*Face) Font ¶
Font returns the font representing this face. No size will have been set for the returned font.
func (*Face) Synthesized ¶
Synthesized returns true if the font synthesized from another variant.
type Family ¶
type Family struct {
// contains filtered or unexported fields
}
Family represents a family of related font faces. The faces in a family share a common design, but differ in slant, weight, width, and other aspects.
func MonospacedFamilies ¶
func MonospacedFamilies() []*Family
MonospacedFamilies returns the installed font families that are monospaced.
func (*Family) Faces ¶
Faces returns the faces that make up the family. The faces share a common design, but differ in slant, weight, width, and other aspects.
func (*Family) Monospaced ¶
Monospaced returns true if the family has a fixed width.
type Font ¶
type Font struct {
// contains filtered or unexported fields
}
Font represents a font.
var ( // User is the font used by default for documents and other text under the user’s control // (that is, text whose font the user can normally change). User *Font // UserMonospaced is the font used by default for documents and other text under the user’s // control when that font is fixed-pitch. UserMonospaced *Font // System is the system font used for standard user-interface items such as window titles, // button labels, etc. System *Font // EmphasizedSystem is the system font used for emphasis in alerts. EmphasizedSystem *Font // SmallSystem is the standard small system font used for informative text in alerts, // column headings in lists, help tags, utility window titles, toolbar item labels, tool // palettes, tool tips, and small controls. SmallSystem *Font // SmallEmphasizedSystem is the small system font used for emphasis. SmallEmphasizedSystem *Font // Views is the font used as the default font of text in lists and tables. Views *Font // Label is the font used for labels. Label *Font // Menu is the font used for menus. Menu *Font // MenuCmdKey is the font used for menu item command key equivalents. MenuCmdKey *Font )
func (*Font) Ascent ¶
Ascent returns the amount of space used from the baseline to the top of the tallest character.
func (*Font) BetterMatch ¶
BetterMatch determines if the style attributes of newDesc are a closer match for this font than those of oldDesc are, or if oldDesc is nil, determines if newDesc is a match at all. Approximate matching is done for weight and style; other style attributes must match exactly. Style attributes are all attributes other than family and size-related attributes. Approximate matching for style considers SlantOblique and SlantItalic as matches, but not as good a match as when the slants are equal. Note that oldDesc must match this font or be nil.
func (*Font) Capitalization ¶
func (d *Font) Capitalization() Capitalization
Capitalization returns the font capitalization.
func (*Font) Equals ¶
Equals compares two fonts for equality. Two fonts are considered equal if the fonts they describe are provably identical. This means that their masks do not have to match, as long as other fields are all the same. Two fonts may result in identical fonts being loaded, but still compare false.
func (*Font) Height ¶
Height returns the overall height of the font, effectively Leading() + Ascent() + Descent().
func (*Font) IndexForPosition ¶
IndexForPosition returns the rune index within the string for the specified x-coordinate, where 0 is the start of the string.
func (*Font) Measure ¶
Measure the string rendered with this font. If you want to account for transformations in a graphics context, you must use the Measure method on the Graphics object instead.
func (*Font) Monospaced ¶
Monospaced returns true if this font has a fixed width.
func (*Font) PangoFontDescription ¶
PangoFontDescription returns the pointer to the underlying Pango font description.
func (*Font) PositionForIndex ¶
PositionForIndex returns the x-coordinate where the specified rune index starts. The returned coordinate assumes 0 is the start of the string.
func (*Font) SetCapitalization ¶
func (d *Font) SetCapitalization(capitalization Capitalization)
SetCapitalization sets the font capitalization.
func (*Font) SetStretch ¶
SetStretch sets the font stretch.
type Slant ¶
type Slant C.PangoStyle
Slant represents the angle that a font is skewed when drawn.
const ( SlantNormal Slant = C.PANGO_STYLE_NORMAL SlantOblique Slant = C.PANGO_STYLE_OBLIQUE SlantItalic Slant = C.PANGO_STYLE_ITALIC )
Possible font slant variants.
type Stretch ¶
type Stretch C.PangoStretch
Stretch is an enumeration of stretch possibilities.
const ( StretchUltraCondensed Stretch = C.PANGO_STRETCH_ULTRA_CONDENSED StretchExtraCondensed Stretch = C.PANGO_STRETCH_EXTRA_CONDENSED StretchCondensed Stretch = C.PANGO_STRETCH_CONDENSED StretchSemiCondensed Stretch = C.PANGO_STRETCH_SEMI_CONDENSED StretchNormal Stretch = C.PANGO_STRETCH_NORMAL StretchSemiExpanded Stretch = C.PANGO_STRETCH_SEMI_EXPANDED StretchExpanded Stretch = C.PANGO_STRETCH_EXPANDED StretchExtraExpanded Stretch = C.PANGO_STRETCH_EXTRA_EXPANDED StretchUltraExpanded Stretch = C.PANGO_STRETCH_ULTRA_EXPANDED )
Possible stretch values.
type Weight ¶
type Weight C.PangoWeight
Weight specifies the boldness of a font. It can range from 100 to 1000.
const ( WeightThin Weight = C.PANGO_WEIGHT_THIN WeightUltraLight Weight = C.PANGO_WEIGHT_ULTRALIGHT WeightLight Weight = C.PANGO_WEIGHT_LIGHT WeightSemiLight Weight = C.PANGO_WEIGHT_SEMILIGHT WeightBook Weight = C.PANGO_WEIGHT_BOOK WeightNormal Weight = C.PANGO_WEIGHT_NORMAL WeightMedium Weight = C.PANGO_WEIGHT_MEDIUM WeightSemiBold Weight = C.PANGO_WEIGHT_SEMIBOLD WeightBold Weight = C.PANGO_WEIGHT_BOLD WeightUltraBold Weight = C.PANGO_WEIGHT_ULTRABOLD WeightHeavy Weight = C.PANGO_WEIGHT_HEAVY WeightUltraHeavy Weight = C.PANGO_WEIGHT_ULTRAHEAVY )
Pre-defined weights.