本文整理汇总了Golang中code/google/com/p/draw2d/draw2d.GraphicContext.SetFontSize方法的典型用法代码示例。如果您正苦于以下问题:Golang GraphicContext.SetFontSize方法的具体用法?Golang GraphicContext.SetFontSize怎么用?Golang GraphicContext.SetFontSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类code/google/com/p/draw2d/draw2d.GraphicContext
的用法示例。
在下文中一共展示了GraphicContext.SetFontSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: draw
func (l *Label) draw(gc draw2d.GraphicContext) {
gc.SetStrokeColor(color.Black)
font := draw2d.GetFont(gc.GetFontData())
bounds := font.Bounds()
height := float64(bounds.YMax-bounds.YMin) * l.FontSize / float64(font.UnitsPerEm())
offset := l.Size.Y - (l.Size.Y-height)/2
safeRect(gc, Coord{0, 0}, l.Size)
gc.FillStroke()
gc.Translate(10, offset)
gc.SetFontSize(l.FontSize)
gc.FillString(l.Text)
}
示例2: drawUptimes
func drawUptimes(gc draw2d.GraphicContext) {
y, m, d := curTime.Add(Day * -6).Date()
sday := time.Date(y, m, d, 0, 0, 0, 0, time.Local)
eday := sday.Add(Day - time.Second)
gc.SetFontSize(40)
// draw frame
gc.SetStrokeColor(color.RGBA{0x00, 0x00, 0x00, 0xff})
rect(gc, BAR_START_X, BAR_START_X+BAR_WIDTH, BAR_START_Y, BAR_START_Y+2+float64(7*BAR_HEIGHT))
gc.Stroke()
u := 0
for i := 0; i < 7; i++ {
gc.MoveTo(FONT_START_X, FONT_START_Y+float64(i*BAR_HEIGHT))
gc.SetStrokeColor(color.RGBA{0x00, 0x00, 0x00, 0xff})
gc.FillString(sday.Weekday().String()[0:2])
upday := make([]w32uptime.Uptime, 0)
for e := u; e < len(uptimes); e++ {
if uptimes[e].Start.After(eday) {
u = e - 1
if u < 0 {
u = 0
}
break
}
if isUptimeInRange(sday, eday, uptimes[e]) {
upday = append(upday, uptimes[e])
}
}
gc.SetFillColor(color.RGBA{0xE0, 0xA6, 0x2C, 0xFF})
if len(upday) > 0 {
for e := 0; e < len(upday); e++ {
ps, pe := 0, BAR_WIDTH
if upday[e].Start.After(sday) {
ps = timeToBarwidth(upday[e].Start)
}
if upday[e].End.Before(eday) {
pe = timeToBarwidth(upday[e].End)
}
rect(gc, float64(BAR_START_X+ps), float64(BAR_START_X+pe), BAR_START_Y+1+float64(i*BAR_HEIGHT), BAR_START_Y+1+float64((i+1)*BAR_HEIGHT))
gc.Fill()
}
}
if i != 6 {
gc.SetStrokeColor(color.RGBA{0x00, 0x00, 0x00, 0xff})
gc.MoveTo(BAR_START_X, BAR_START_Y+float64((i+1)*BAR_HEIGHT))
gc.LineTo(BAR_START_X+BAR_WIDTH, BAR_START_Y+float64((i+1)*BAR_HEIGHT))
gc.Close()
gc.Stroke()
}
sday = sday.Add(Day)
eday = sday.Add(Day - time.Second)
}
// middle line
gc.SetStrokeColor(color.RGBA{0x00, 0x00, 0x00, 0xff})
gc.MoveTo(BAR_START_X+BAR_WIDTH/2, BAR_START_Y+1)
gc.LineTo(BAR_START_X+BAR_WIDTH/2, BAR_START_Y+1+float64(7*BAR_HEIGHT))
gc.Close()
gc.Stroke()
}
示例3: drawInfoarea
func drawInfoarea(gc draw2d.GraphicContext) {
gc.SetFontSize(20)
gc.SetFillColor(color.RGBA{0xFF, 0xFF, 0xFF, 0xFF})
gc.MoveTo(BAR_START_X, IA_START_Y)
gc.FillString(curTime.Add(Day*-7).Format(DATE_FORMAT) + " - " + curTime.Format(DATE_FORMAT))
}