Skip to content

Commit 9854632

Browse files
committed
Assume a DPI of 124
1 parent 8b18374 commit 9854632

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

widget.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ func drawImage(img *image.RGBA, path string, size uint, x uint, y uint) error {
8888

8989
func drawString(img *image.RGBA, ttf *truetype.Font, text string, fontsize float64, pt fixed.Point26_6) {
9090
c := freetype.NewContext()
91-
c.SetDPI(72)
91+
c.SetDPI(124)
9292
c.SetFont(ttf)
9393
c.SetSrc(image.NewUniform(color.RGBA{0, 0, 0, 0}))
9494
c.SetDst(img)
9595
c.SetClip(img.Bounds())
96-
c.SetHinting(font.HintingNone)
96+
c.SetHinting(font.HintingFull)
9797
c.SetFontSize(fontsize)
9898

9999
// find text entent

widget_clock.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ func (w *ClockWidget) Update(dev *streamdeck.Device) {
2020
hour := t.Format("15")
2121
min := t.Format("04")
2222
sec := t.Format("05")
23-
drawString(img, ttfBoldFont, hour, 22, freetype.Pt(-1, 20))
24-
drawString(img, ttfFont, min, 22, freetype.Pt(-1, 43))
25-
drawString(img, ttfThinFont, sec, 22, freetype.Pt(-1, 66))
23+
drawString(img, ttfBoldFont, hour, 13, freetype.Pt(-1, 20))
24+
drawString(img, ttfFont, min, 13, freetype.Pt(-1, 43))
25+
drawString(img, ttfThinFont, sec, 13, freetype.Pt(-1, 66))
2626

2727
err := dev.SetImage(w.key, img)
2828
if err != nil {

widget_top.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ func (w *TopWidget) Update(dev *streamdeck.Device) {
2626

2727
draw.Draw(img, image.Rect(12, 6, 60, 54), &image.Uniform{color.RGBA{255, 255, 255, 255}}, image.ZP, draw.Src)
2828
draw.Draw(img, image.Rect(13, 7, 59, 53), &image.Uniform{color.RGBA{0, 0, 0, 255}}, image.ZP, draw.Src)
29-
draw.Draw(img, image.Rect(14, 7+int(46*(1-cpuUsage[0]/100)), 58, 53), &image.Uniform{color.RGBA{10, 10, 240, 255}}, image.ZP, draw.Src)
29+
draw.Draw(img, image.Rect(14, 7+int(46*(1-cpuUsage[0]/100)), 58, 53), &image.Uniform{color.RGBA{215, 158, 147, 255}}, image.ZP, draw.Src)
3030

31-
drawString(img, ttfBoldFont, strconv.FormatInt(int64(cpuUsage[0]), 10), 20, freetype.Pt(-1, -1))
32-
drawString(img, ttfBoldFont, "% CPU", 12, freetype.Pt(-1, img.Bounds().Dx()-4))
31+
drawString(img, ttfFont, strconv.FormatInt(int64(cpuUsage[0]), 10), 12, freetype.Pt(-1, -1))
32+
drawString(img, ttfFont, "% CPU", 7, freetype.Pt(-1, img.Bounds().Dx()-4))
3333

3434
err = dev.SetImage(w.key, img)
3535
if err != nil {

0 commit comments

Comments
 (0)