gofmt on package

This commit is contained in:
legoff.laurent 2010-12-06 17:18:06 +00:00
parent f837e5edf3
commit 873e6bfa2b
3 changed files with 31 additions and 32 deletions

View file

@ -20,7 +20,7 @@ func NewDashConverter(dash []float, dashOffset float, converter VertexConverter)
func (dasher *DashVertexConverter) NextCommand(cmd VertexCommand) {
dasher.command = cmd
if(dasher.command == VertexStopCommand) {
if dasher.command == VertexStopCommand {
dasher.next.NextCommand(VertexStopCommand)
}
}

View file

@ -244,10 +244,10 @@ func (gc *GraphicContext) FillString(text string) (cursor float){
x0, fontSize := 0.0, gc.current.fontSize
gc.current.tr.VectorTransform(&x0, &fontSize)
font := GetFont(gc.current.fontData)
if(font == nil) {
if font == nil {
font = GetFont(gc.defaultFontData)
}
if(font == nil) {
if font == nil {
return 0
}
gc.freetype.SetFont(font)
@ -265,7 +265,6 @@ func (gc *GraphicContext) FillString(text string) (cursor float){
}
func (gc *GraphicContext) paint(rasterizer *raster.Rasterizer, color image.Color) {
painter := raster.NewRGBAPainter(gc.PaintedImage)
painter.SetColor(color)

View file

@ -40,26 +40,28 @@ type FontData struct {
}
func GetFont(fontData FontData) (*truetype.Font) {
func GetFont(fontData FontData) *truetype.Font {
fontFileName := fontData.Name
switch fontData.Family {
case FontFamilySans: fontFileName += "s"
case FontFamilySerif: fontFileName += "r"
case FontFamilyMono: fontFileName += "m"
case FontFamilySans:
fontFileName += "s"
case FontFamilySerif:
fontFileName += "r"
case FontFamilyMono:
fontFileName += "m"
}
if(fontData.Style & FontStyleBold != 0) {
if fontData.Style&FontStyleBold != 0 {
fontFileName += "b"
} else {
fontFileName += "r"
}
if(fontData.Style & FontStyleItalic != 0) {
if fontData.Style&FontStyleItalic != 0 {
fontFileName += "i"
}
fontFileName += ".ttf"
font := fonts[fontFileName]
if(font != nil) {
if font != nil {
return font
}
fonts[fontFileName] = loadFont(fontFileName)
@ -74,7 +76,7 @@ func SetFontFolder(folder string) {
fontFolder = folder
}
func loadFont(fontFileName string) (*truetype.Font) {
func loadFont(fontFileName string) *truetype.Font {
fontBytes, err := ioutil.ReadFile(path.Join(fontFolder, fontFileName))
if err != nil {
log.Println(err)
@ -87,5 +89,3 @@ func loadFont(fontFileName string) (*truetype.Font) {
}
return font
}