)]}'
{
  "commit": "bf42e04dc058a389c440fd8d66bc36d2e8b6006c",
  "tree": "a659f7f07a8f688ce05654bcc9f58bc4b3e0307d",
  "parents": [
    "77814c49ecb8d4fe893d377862f00033bde19e4d"
  ],
  "author": {
    "name": "Behdad Esfahbod",
    "email": "behdad@behdad.org",
    "time": "Mon Nov 23 02:41:40 2026 -0600"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Mon Nov 23 02:41:40 2026 -0600"
  },
  "message": "[gpu] Accept a single quadratic by how far the cubic leaves it (#6882)\n\nhb_gpu_cubic_approx_quadratic() tried the quadratic of the cubic\u0027s two\nend tangents and tested it at equal parameters: how far apart the two\nare at the same t.  A cubic runs along that quadratic at another pace,\nso most of that distance is along the curve and costs nothing: of the\ncubics of three fonts, 2.4% passed at the tolerance of 0.5, while a\nthird are within 0.5 of their quadratic as sets of points.\n\nWith q where the tangents meet, a \u003d q - c0, z \u003d c3 - q, and the\ncubic\u0027s control points at c1 \u003d c0 + l1 a and c2 \u003d c3 - l2 z, the cubic\nB is the quadratic Q at another parameter plus an offset along the\nparabola\u0027s axis:\n\n  B(t) \u003d Q(tau(t)) + rho(t) (a - z)\n  tau(t) \u003d 3 t (1-t)^2 l1/2 + 3 t^2 (1-t) (1 - l2/2) + t^3\n  rho(t) \u003d 3 t^2 (1-t)^2 (l1 + l2 - 4/3 + 3 e(t)^2)\n  e(t)   \u003d (1-t) (l1/2 - 1/3) + t (1/3 - l2/2)\n\nan identity of polynomials.  For l1 and l2 from 0 to 2, tau is a\nBezier function with control values from 0 to 1, so it takes [0,1]\nonto [0,1], and each curve is within max |rho| |a - z| of the other:\nat most 3/16 max |l1 + l2 - 4/3 + 3 e^2| |a - z|.  A single quadratic\nfits when the two handles add up to 4/3 of the way to where the\ntangents meet, however that is split; at equal parameters it took 2/3\neach.\n\nTest that bound instead, in closed form.  The recursive test and its\ndepth cap go, and so does the check that skipped it for a long third\ndifference, which bounded the distance at equal parameters.\n\nA cubic with a control point on its end point, whose tangent there is\ntaken toward the other control point, now comes out as one quadratic\nwith that tangent when it is small enough: 281 of the 862 such cubics\nin the three fonts.\n\nOf the 77,533 cubics, 24.1% become one quadratic, and quadratics per\ncubic go from 2.84 to 2.59.  15 cubics that passed the old test take\ntwo now.\n\nTesting: the identity checked exactly, in rational arithmetic on a\ngrid that covers its degree; the bound against a measured two-sided\ndistance on 18,000 cubics, from fonts and made to cover the range of\nhandles, zero-length handles, far tangent intersections and extreme\nscales: never below it.  Blobs of faces without cubics are\nbyte-identical (745 fonts, 889,000 glyphs); of 235,312 glyphs in\nCFF/CFF2 faces 87,461 change, for 1.6% fewer bytes in all.\nutil/hb-gpu-encode-all, instructions, five interleaved rounds against\nmain:\n\n  NotoSansSC-Regular.otf       -5.61%\n  SourceCodePro-Regular.otf    -1.62%\n  STIXTwoMath-Regular.otf      -1.30%\n  NotoSansCJK-VF.ttc           -2.29%\n  NotoSans[wght].ttf            0.00%  (TrueType: no cubics)\n\nmeson test: 301/301.  test-gpu (34 subtests) and the fuzzer seeds\nunder ASan and UBSan: pass.\n\nCo-authored-by: Claude Fable 5.2 \u003cnoreply@anthropic.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "3ca0cabfcfb8637c527d76caa72847c8232a866f",
      "old_mode": 33188,
      "old_path": "src/hb-gpu-cu2qu.hh",
      "new_id": "356e8ebaf09641e635dc95e3e96cf8d84f164210",
      "new_mode": 33188,
      "new_path": "src/hb-gpu-cu2qu.hh"
    },
    {
      "type": "modify",
      "old_id": "e407274cc9bb979c481c3f868c1349c2ee620f5d",
      "old_mode": 33188,
      "old_path": "test/api/test-gpu.cc",
      "new_id": "7e317d444c749b48c1cd5aab250f5bf7cfbb7177",
      "new_mode": 33188,
      "new_path": "test/api/test-gpu.cc"
    }
  ]
}
