summaryrefslogtreecommitdiffstats
path: root/thirdparty/harfbuzz/src/hb-subset-instancer-solver.hh
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/harfbuzz/src/hb-subset-instancer-solver.hh')
-rw-r--r--thirdparty/harfbuzz/src/hb-subset-instancer-solver.hh24
1 files changed, 23 insertions, 1 deletions
diff --git a/thirdparty/harfbuzz/src/hb-subset-instancer-solver.hh b/thirdparty/harfbuzz/src/hb-subset-instancer-solver.hh
index b1f8594937..563fccbb59 100644
--- a/thirdparty/harfbuzz/src/hb-subset-instancer-solver.hh
+++ b/thirdparty/harfbuzz/src/hb-subset-instancer-solver.hh
@@ -27,6 +27,21 @@
#include "hb.hh"
+/* pre-normalized distances */
+struct TripleDistances
+{
+ TripleDistances (): negative (1.f), positive (1.f) {}
+ TripleDistances (float neg_, float pos_): negative (neg_), positive (pos_) {}
+ TripleDistances (float min, float default_, float max)
+ {
+ negative = default_ - min;
+ positive = max - default_;
+ }
+
+ float negative;
+ float positive;
+};
+
struct Triple {
Triple () :
@@ -66,6 +81,7 @@ struct Triple {
return current;
}
+
float minimum;
float middle;
float maximum;
@@ -74,6 +90,12 @@ struct Triple {
using result_item_t = hb_pair_t<float, Triple>;
using result_t = hb_vector_t<result_item_t>;
+/* renormalize a normalized value v to the range of an axis,
+ * considering the prenormalized distances as well as the new axis limits.
+ * Ported from fonttools */
+HB_INTERNAL float renormalizeValue (float v, const Triple &triple,
+ const TripleDistances &triple_distances,
+ bool extrapolate = true);
/* Given a tuple (lower,peak,upper) "tent" and new axis limits
* (axisMin,axisDefault,axisMax), solves how to represent the tent
* under the new axis configuration. All values are in normalized
@@ -85,6 +107,6 @@ using result_t = hb_vector_t<result_item_t>;
* If tent value is Triple{}, that is a special deltaset that should
* be always-enabled (called "gain").
*/
-HB_INTERNAL result_t rebase_tent (Triple tent, Triple axisLimit);
+HB_INTERNAL result_t rebase_tent (Triple tent, Triple axisLimit, TripleDistances axis_triple_distances);
#endif /* HB_SUBSET_INSTANCER_SOLVER_HH */