tinygo-org / tinyfont

Text library for TinyGo displays
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
49 stars 12 forks source link

Add boundingbox #29

Closed sago35 closed 3 years ago

sago35 commented 3 years ago

28

Added a BoundingBox to check the drawing size. It can be used in the following way.

    for str, font := range strings {
        y += int16(font.YAdvance) + 10
        _, w := tinyfont.LineWidth(font, str)
        display.FillRectangle(x, y-int16(font.YAdvance), int16(w), int16(font.YAdvance), red)
        display.DrawRectangle(x, y+int16(font.BBox[3]), int16(w), int16(font.BBox[1]), green) // !!! HERE !!!
        tinyfont.WriteLine(display, font, x, y, str, white)

    }
rsjethani commented 3 years ago

@sago35 thank you! the changes look good

sago35 commented 3 years ago

. /cmd/tinyfontgen has been updated. BBox output is now supported.

Now ready for review.

sago35 commented 3 years ago

@deadprogram or someone else Please review.

sago35 commented 3 years ago

Until this PR is merged, CI will continue to fail with go.mod errors.

deadprogram commented 3 years ago

Thanks for the fix @sago35 now merging.