jamesgk
555ff7c43f
Accept error tolerances as lists or tuples
...
This way you can designate different tolerances for different fonts,
which may be useful for example with fonts of different weights.
2015-12-10 12:19:15 -08:00
jamesgk
f7c251e9a2
Rename "report" parameter to "stats"
...
This also makes the stats parameter optional in the other public rf
module functions.
2015-12-08 14:21:44 -08:00
jamesgk
56f36a1b2a
[API] Take in list of fonts, no **kwarg syntax
...
This is hopefully the last non-backwards-compatible API change. We
take a list of fonts in rf.fonts_to_quadratic so that we can spell out
its keyword arguments explicitly. Also, only one max error argument is
accepted.
2015-12-08 14:19:57 -08:00
jamesgk
b568c934d0
Remove max_n parameter
...
This is probably not useful as a parameter, so instead we hardcode the
value into the main module.
2015-12-08 12:44:29 -08:00
jamesgk
856ffe1fca
Make only a few functions public
...
This way we hopefully don't have to worry about changing things behind
the scenes.
2015-12-08 12:42:42 -08:00
James Godfrey-Kittle
b6ae3f4b58
Merge pull request #17 from anthrotype/return-error
...
Return (spline, error) tuple from approximation functions
2015-12-08 11:58:59 -08:00
Cosimo Lupo
e6b47d61c9
cu2qu.rf: only get fist item returned from curve_to_quadratic, ignore approx error
...
curve_to_quadratic and curves_to_quadratic now return a (spline, error) tuple.
2015-12-07 15:09:26 +00:00
Cosimo Lupo
4dffdb7dd7
cu2qu.__init__: return (spline[s], error[s]) tuple from curve[s]_to_quadratic; raise exception if no approximation is found; ensure returned spline is a list of tuples
2015-12-07 15:09:26 +00:00
Behdad Esfahbod
1ab0631ba4
Merge pull request #16 from googlei18n/py23
...
Use __future__ imports to ease Python2/3 compat
2015-12-04 22:44:53 -08:00
jamesgk
a79fb041a2
Use __future__ imports to ease Python2/3 compat
2015-12-04 13:07:32 -08:00
Behdad Esfahbod
aba3051aac
[benchmark] Print time in micro-seconds
2015-12-03 18:13:27 -08:00
Behdad Esfahbod
1665774752
Merge pull request #15 from googlei18n/optimize
...
Remove Point class and only use built-ins
2015-12-03 17:53:13 -08:00
jamesgk
72ebeb1085
Add license to benchmark script
2015-12-01 17:28:19 -08:00
jamesgk
3d4a7872ab
Add a benchmarking suite for curve/s_to_quadratic
2015-12-01 17:13:14 -08:00
jamesgk
a787cd2daf
Pass tuples to curves_to_quadratic in rf module
2015-12-01 17:12:30 -08:00
jamesgk
561bed0ea0
Remove Point class and only use built-ins
...
Using built-in types (mostly tuples) seems to cut the running time
overall by about one half. Spelling out linear interpolation in the
bezier_at functions actually cuts the running time by another 10%,
but I'm not sure if it's worth it given that this code looks a bit
nicer.
2015-12-01 13:22:24 -08:00
Behdad Esfahbod
bb79a8bf62
Merge pull request #14 from googlei18n/api
...
Move geometry module to __init__
2015-12-01 13:03:08 -08:00
jamesgk
97ce534d7b
Move geometry.py to __init__.py
2015-12-01 12:30:31 -08:00
jamesgk
ebf1573564
Remove __init__.py (will be replace by geometry.py)
2015-12-01 11:04:48 -08:00
Behdad Esfahbod
fdd84fad88
Merge pull request #12 from googlei18n/error-em
...
Specify tolerance in em through `max_err_em`
2015-11-24 15:38:22 -06:00
jamesgk
bf6b2d9f7e
Specify tolerance in em through max_err_em
...
This way, the `max_err` parameter is consistent with the other
functions (being in font units).
2015-11-24 12:52:03 -08:00
James Godfrey-Kittle
f82e320395
Merge pull request #5 from googlei18n/error-em
...
Specify max error in em instead of font units
2015-11-20 14:40:07 -08:00
jamesgk
4f107a9119
Merge branch 'master' into error-em
2015-11-20 14:39:10 -08:00
Behdad Esfahbod
a5e23c01f6
Merge pull request #4 from googlei18n/stats-arg
...
Take in dictionary of conversion statistics
2015-11-20 14:19:47 -08:00
jamesgk
85821f081d
Update readme with max_error param changes
2015-11-20 12:08:28 -08:00
jamesgk
79ea6b4973
Swap order of "max_err" and "max_n" parameters
...
I like this new order better, since max_err seems to be the more
important parameter, and it corresponds more closely with the actual
font object params (which can be lists) than max_n (which is always
a single value).
2015-11-20 12:06:18 -08:00
jamesgk
e94071a2d8
Specify max error in em instead of font units
...
This should be more compatible between fonts with different UPM. In
fact, it should work within a single call with such fonts.
The default max error is now 0.0025 em, which is about 5 units for a
2048 UPM font.
2015-11-20 12:04:48 -08:00
jamesgk
5ef46a5bb3
Update readme with API changes
2015-11-19 17:17:56 -08:00
jamesgk
042a392d35
Take in dictionary of conversion stats
...
This allows stats to be accumulated between function calls.
2015-11-19 17:11:06 -08:00
jamesgk
8bbdb47cf5
Rename "robofab" module to "rf"
...
Apparently naming this robofab conflicts with the global robofab
module.
2015-11-19 16:59:49 -08:00
jamesgk
68d5213dd1
Update comments -- conversion is always compatible
2015-11-19 16:45:05 -08:00
jamesgk
45364ed045
Move RoboFab-specific code to a "robofab" module
2015-11-19 16:40:52 -08:00
James Godfrey-Kittle
815c435fc9
Merge pull request #3 from anthrotype/round-int
...
don't truncate floats but round them before casting them to ints
2015-11-16 11:11:55 -08:00
Cosimo Lupo
e8db3a18bb
don't truncate floats but round them before casting them to ints
2015-11-14 18:04:22 +00:00
jamesgk
ebcd99b1df
Rearrange some code
...
Hopefully this should make the code supporting the public API more
clear.
2015-11-12 16:36:23 -08:00
jamesgk
3855de8887
Move non-RoboFab code into a separate module
2015-11-12 16:22:15 -08:00
jamesgk
3e7c9a39d3
Move cu2qu into a package
2015-11-12 16:18:58 -08:00
jamesgk
ff3d0bae3b
More consistent naming
2015-11-06 11:15:12 -08:00
jamesgk
c551ce3ecf
Simplify API, always convert compatibly
2015-11-05 15:54:04 -08:00
jamesgk
34e5702c52
Update module references in readme
2015-11-05 15:45:38 -08:00
jamesgk
d51c924893
Rename to cu2qu
...
We want a simpler, less dry name. The only thing this is missing is an
implication of interpolation-compatibility.
2015-11-05 15:43:14 -08:00
jamesgk
d0797e4f4b
Add contributing and readme files
2015-10-05 18:14:26 -07:00
jamesgk
add9cf1d4d
Add license.
2015-10-05 18:14:16 -07:00
jamesgk
10b1e9f500
More descriptive variable names.
2015-10-05 17:36:36 -07:00
jamesgk
2712c74b37
Add comments, fix comment formatting.
2015-10-05 16:01:11 -07:00
jamesgk
2c33e23bf3
Make "python setup.py install" actually work.
...
convert_curves is just a module (file), not a package (directory).
2015-10-05 15:58:58 -07:00
jamesgk
b1c4f96001
Don't allow this to be run as a script
2015-10-01 17:59:40 -07:00
jamesgk
c6c61105d8
Clean up stuff
...
There should be no changed functionality here. Just cleaning:
- Consistent variable naming style
- Consistent quote types for strings
- No lines over 80 characters
- At least some comment for every function
- Get rid of excessive error catching
2015-10-01 17:41:19 -07:00
jamesgk
a411cd2138
Handle segment.as_quadratic like replace_segments
...
Have a non-collection function for this, then a method of
SegmentCollection which uses that function.
2015-10-01 17:40:19 -07:00
jamesgk
72fef95dfd
Return a report of conversion
2015-10-01 17:14:58 -07:00