mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-30 01:54:21 +01:00
[instancer-solver] port optimization and more tests from fonttools
This commit is contained in:
1 parent
350423df8d
commit
73ce3015bb
2 files changed
+21
-3
No files matched your search
@@ -253,9 +253,8 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
|
||||
* axisDef axisMax
|
||||
*/
|
||||
float newUpper = peak + (1 - gain) * (upper - peak);
|
||||
// I feel like the first condition is always true because
|
||||
// outGain >= gain.
|
||||
if (axisMax <= newUpper && newUpper <= axisDef + (axisMax - axisDef) * 2)
|
||||
assert (axisMax <= newUpper); // Because outGain >= gain
|
||||
if (newUpper <= axisDef + (axisMax - axisDef) * 2)
|
||||
{
|
||||
upper = newUpper;
|
||||
if (!negative && axisDef + (axisMax - axisDef) * MAX_F2DOT14 < upper)
|
||||
|
||||
@@ -392,5 +392,24 @@ main (int argc, char **argv)
|
||||
assert (out[4].first == -1.f);
|
||||
assert (out[4].second == Triple (-1.f, -1.f, -2/(float) (1 << 14)));
|
||||
}
|
||||
|
||||
{
|
||||
Triple tent (0.f, 1.f, 1.f);
|
||||
Triple axis_range (-1.f, -0.5f, 1.f);
|
||||
result_t out = rebase_tent (tent, axis_range, default_axis_distances);
|
||||
assert (out.length == 1);
|
||||
assert (out[0].first == 1.f);
|
||||
assert (out[0].second == Triple (1.f/3, 1.f, 1.f));
|
||||
}
|
||||
|
||||
{
|
||||
Triple tent (0.f, 1.f, 1.f);
|
||||
Triple axis_range (-1.f, -0.5f, 1.f);
|
||||
TripleDistances axis_distances{2.f, 1.f};
|
||||
result_t out = rebase_tent (tent, axis_range, axis_distances);
|
||||
assert (out.length == 1);
|
||||
assert (out[0].first == 1.f);
|
||||
assert (out[0].second == Triple (0.5f, 1.f, 1.f));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user