/usr/lib/python3/dist-packages/fontMath/mathFunctions.py is in python3-fontmath 0.4.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | from __future__ import division
import math
from fontTools.misc.py23 import round3 as _roundNumber
import sys
__all__ = [
"add",
"addPt",
"sub",
"subPt",
"mul",
"mulPt",
"div",
"divPt",
"factorAngle",
"_roundNumber",
]
def add(v1, v2):
return v1 + v2
def addPt(pt1, pt2):
return pt1[0] + pt2[0], pt1[1] + pt2[1]
def sub(v1, v2):
return v1 - v2
def subPt(pt1, pt2):
return pt1[0] - pt2[0], pt1[1] - pt2[1]
def mul(v, f):
return v * f
def mulPt(pt1, f):
(f1, f2) = f
return pt1[0] * f1, pt1[1] * f2
def div(v, f):
return v / f
def divPt(pt, f):
(f1, f2) = f
return pt[0] / f1, pt[1] / f2
def factorAngle(angle, f, func):
(f1, f2) = f
rangle = math.radians(angle)
x = math.cos(rangle)
y = math.sin(rangle)
return math.degrees(
math.atan2(
func(y, f2), func(x, f1)
)
)
if __name__ == "__main__":
import sys
import doctest
sys.exit(doctest.testmod().failed)
|