提交 18fe7866 编写于 作者: N Nigel Tao

freetype: update log to s/Stderr/Println/.

R=r, nigeltao_gnome, adg
CC=golang-dev
http://codereview.appspot.com/2527041
上级 220b691d
...@@ -69,12 +69,12 @@ func main() { ...@@ -69,12 +69,12 @@ func main() {
// Read the font data. // Read the font data.
fontBytes, err := ioutil.ReadFile(*fontfile) fontBytes, err := ioutil.ReadFile(*fontfile)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
return return
} }
font, err := freetype.ParseFont(fontBytes) font, err := freetype.ParseFont(fontBytes)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
return return
} }
...@@ -106,7 +106,7 @@ func main() { ...@@ -106,7 +106,7 @@ func main() {
for _, s := range text { for _, s := range text {
_, err = c.DrawString(s, pt) _, err = c.DrawString(s, pt)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
return return
} }
pt.Y += c.PointToFix32(*size * *spacing) pt.Y += c.PointToFix32(*size * *spacing)
...@@ -115,19 +115,19 @@ func main() { ...@@ -115,19 +115,19 @@ func main() {
// Save that RGBA image to disk. // Save that RGBA image to disk.
f, err := os.Open("out.png", os.O_CREAT|os.O_WRONLY, 0600) f, err := os.Open("out.png", os.O_CREAT|os.O_WRONLY, 0600)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
os.Exit(1) os.Exit(1)
} }
defer f.Close() defer f.Close()
b := bufio.NewWriter(f) b := bufio.NewWriter(f)
err = png.Encode(b, rgba) err = png.Encode(b, rgba)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
os.Exit(1) os.Exit(1)
} }
err = b.Flush() err = b.Flush()
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
os.Exit(1) os.Exit(1)
} }
fmt.Println("Wrote out.png OK.") fmt.Println("Wrote out.png OK.")
......
...@@ -68,19 +68,19 @@ func main() { ...@@ -68,19 +68,19 @@ func main() {
// Save that RGBA image to disk. // Save that RGBA image to disk.
f, err := os.Open("out.png", os.O_CREAT|os.O_WRONLY, 0600) f, err := os.Open("out.png", os.O_CREAT|os.O_WRONLY, 0600)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
os.Exit(1) os.Exit(1)
} }
defer f.Close() defer f.Close()
b := bufio.NewWriter(f) b := bufio.NewWriter(f)
err = png.Encode(b, rgba) err = png.Encode(b, rgba)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
os.Exit(1) os.Exit(1)
} }
err = b.Flush() err = b.Flush()
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
os.Exit(1) os.Exit(1)
} }
fmt.Println("Wrote out.png OK.") fmt.Println("Wrote out.png OK.")
......
...@@ -155,19 +155,19 @@ func main() { ...@@ -155,19 +155,19 @@ func main() {
// Save that RGBA image to disk. // Save that RGBA image to disk.
f, err := os.Open("out.png", os.O_CREAT|os.O_WRONLY, 0600) f, err := os.Open("out.png", os.O_CREAT|os.O_WRONLY, 0600)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
os.Exit(1) os.Exit(1)
} }
defer f.Close() defer f.Close()
b := bufio.NewWriter(f) b := bufio.NewWriter(f)
err = png.Encode(b, rgba) err = png.Encode(b, rgba)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
os.Exit(1) os.Exit(1)
} }
err = b.Flush() err = b.Flush()
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
os.Exit(1) os.Exit(1)
} }
fmt.Println("Wrote out.png OK.") fmt.Println("Wrote out.png OK.")
......
...@@ -80,19 +80,19 @@ func main() { ...@@ -80,19 +80,19 @@ func main() {
// Save that RGBA image to disk. // Save that RGBA image to disk.
f, err := os.Open("out.png", os.O_CREAT|os.O_WRONLY, 0600) f, err := os.Open("out.png", os.O_CREAT|os.O_WRONLY, 0600)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
os.Exit(1) os.Exit(1)
} }
defer f.Close() defer f.Close()
b := bufio.NewWriter(f) b := bufio.NewWriter(f)
err = png.Encode(b, m) err = png.Encode(b, m)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
os.Exit(1) os.Exit(1)
} }
err = b.Flush() err = b.Flush()
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
os.Exit(1) os.Exit(1)
} }
fmt.Println("Wrote out.png OK.") fmt.Println("Wrote out.png OK.")
......
...@@ -43,12 +43,12 @@ func main() { ...@@ -43,12 +43,12 @@ func main() {
fmt.Printf("Loading fontfile %q\n", *fontfile) fmt.Printf("Loading fontfile %q\n", *fontfile)
b, err := ioutil.ReadFile(*fontfile) b, err := ioutil.ReadFile(*fontfile)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
return return
} }
font, err := truetype.Parse(b) font, err := truetype.Parse(b)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
return return
} }
printBounds(font.Bounds()) printBounds(font.Bounds())
...@@ -61,7 +61,7 @@ func main() { ...@@ -61,7 +61,7 @@ func main() {
g := truetype.NewGlyphBuf() g := truetype.NewGlyphBuf()
err = g.Load(font, i0) err = g.Load(font, i0)
if err != nil { if err != nil {
log.Stderr(err) log.Println(err)
return return
} }
fmt.Printf("'%c' glyph\n", c0) fmt.Printf("'%c' glyph\n", c0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册