pbnjay / pixfont

A simple, lightweight Pixel Font package for Go that works with the standard image/draw package.
MIT License
105 stars 9 forks source link

Support for different font size with default charmap and data #6

Closed dmowcomber closed 5 years ago

dmowcomber commented 5 years ago

I would like be able to create a new font struct with the default map and data but change the size. I can't do that without redefining eightMap and eightData.

It would be nice to have another construct function like:

func New(w, h uint8) *PixFont {
    return &PixFont{w, h, eightMap, eightData, w}
}

Alternatively this could be done with a new SetSize function:

func (p *PixFont) SetSize(w, h uint8) {
    p.charWidth = w
    p.charHeight = h
    p.varCharWidth = w
}
dmowcomber commented 5 years ago

nevermind I just realized the map and data are dependent on the size.