need to be very specific about points vs. pixels.
This commit is contained in:
parent
8bc8b1087c
commit
80d6be9849
6 changed files with 60 additions and 25 deletions
|
|
@ -9,6 +9,18 @@ import (
|
|||
"github.com/golang/freetype/truetype"
|
||||
)
|
||||
|
||||
// PixelsToPoints returns the points for a given number of pixels at a DPI.
|
||||
func PixelsToPoints(dpi, pixels float64) (points float64) {
|
||||
points = (pixels * 72.0) / dpi
|
||||
return
|
||||
}
|
||||
|
||||
// PointsToPixels returns the pixels for a given number of points at a DPI.
|
||||
func PointsToPixels(dpi, points float64) (pixels float64) {
|
||||
pixels = (points * dpi) / 72.0
|
||||
return
|
||||
}
|
||||
|
||||
func abs(i int) int {
|
||||
if i < 0 {
|
||||
return -i
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue