Skip to content

Conversation

@Mrazator
Copy link
Member

@Mrazator Mrazator commented Feb 10, 2025

Allow custom text metrics providers, useful for overriding the width calculation algorithm when canvas API is not available / desired.

Later whole textMeasurements module might get treated as a separate chunk or be separated into a standalone package.

@vercel
Copy link

vercel bot commented Feb 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
excalidraw ✅ Ready (Inspect) Visit Preview Feb 10, 2025 7:41pm
excalidraw-package-example ✅ Ready (Inspect) Visit Preview Feb 10, 2025 7:41pm
excalidraw-package-example-with-nextjs ✅ Ready (Inspect) Visit Preview Feb 10, 2025 7:41pm
1 Skipped Deployment
Name Status Preview Updated (UTC)
docs ⬜️ Ignored (Inspect) Feb 10, 2025 7:41pm

@github-actions
Copy link

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 66.89% (🎯 60%) 68801 / 102843
🟢 Statements 66.89% (🎯 60%) 68801 / 102843
🟢 Functions 63.72% (🎯 63%) 1964 / 3082
🟢 Branches 79.78% (🎯 70%) 8315 / 10422
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/excalidraw/index.tsx 81.6% 88.88% 75% 81.6% 95-99, 158-207
packages/excalidraw/actions/actionBoundText.tsx 97.87% 84.61% 100% 97.87% 110-111, 133, 135-136, 245, 247
packages/excalidraw/actions/actionTextAutoResize.ts 50% 100% 50% 50% 24-47
packages/excalidraw/components/App.tsx 70.11% 76.49% 71.5% 70.11% 511-512, 624-633, 733-734, 752-753, 774-834, 837-843, 856-859, 862-938, 941-960, 963-968, 976-986, 988-989, 994-995, 999-1001, 1015, 1022-1287, 1346-1350, 1354-1358, 1379-1380, 1397-1442, 1468, 1478, 1485-1488, 1497-1501, 1531-1537, 1551, 1622-1632, 1637-1652, 1656-1703, 1799-1804, 1833-1838, 1841-1871, 1879-1904, 1917-2008, 2011-2019, 2022-2081, 2084-2125, 2128-2133, 2168-2169, 2192-2193, 2225-2226, 2230-2231, 2251-2259, 2264-2277, 2283-2284, 2288, 2293-2301, 2303-2311, 2323, 2358-2359, 2372-2373, 2395-2396, 2403, 2424-2426, 2486-2488, 2491-2496, 2501-2502, 2542-2550, 2555-2564, 2608-2610, 2713-2714, 2718, 2721-2722, 2730-2733, 2742-2755, 2761-2764, 2767, 2769-2770, 2777-2778, 2784-2785, 2788-2789, 2800, 2802-2806, 2809-2810, 2813-2814, 2825-2833, 2838-2839, 2890-2891, 2905-2911, 2917-2925, 2929-2937, 2941-2942, 2945-2978, 2981-2993, 3004-3005, 3016-3017, 3034-3038, 3042-3045, 3052-3054, 3072-3079, 3082, 3084-3089, 3093-3095, 3141-3142, 3149-3151, 3153-3176, 3202, 3208, 3236-3238, 3277-3280, 3283-3284, 3301-3303, 3325-3326, 3332-3336, 3342-3423, 3477, 3481, 3516-3517, 3576, 3586-3604, 3607-3613, 3616-3617, 3623-3639, 3679-3704, 3787-3788, 3811-3825, 3833-3839, 3853-3854, 3860-3873, 3930-3931, 4003-4013, 4049, 4198-4199, 4201-4208, 4242-4246, 4248-4249, 4251-4254, 4275-4276, 4283-4284, 4306-4316, 4326-4328, 4330, 4418-4421, 4443-4451, 4455-4457, 4467-4468, 4470-4490, 4497-4520, 4523-4529, 4546-4549, 4564-4571, 4668-4672, 4676, 4684-4685, 4690-4694, 4727-4728, 4731-4732, 4744-4748, 4753-4754, 4760-4770, 4775-4802, 4807-4818, 4918-4919, 5003, 5028, 5054-5056, 5127-5128, 5146-5147, 5338-5339, 5342-5343, 5356-5357, 5404, 5465-5469, 5522-5529, 5531-5532, 5537-5603, 5647, 5704, 5731, 5738-5739, 5752-5755, 5786-5789, 5842-5845, 5848-5852, 5854-5861, 5878-5887, 5890-5891, 6009-6010, 6013, 6015-6020, 6026-6028, 6030, 6039, 6041, 6063-6068, 6070-6073, 6077-6078, 6087-6103, 6105, 6107-6110, 6114-6210, 6214-6215, 6230-6231, 6270-6277, 6304-6305, 6324-6325, 6353, 6355-6385, 6392-6393, 6415-6416, 6435, 6437-6480, 6485-6486, 6488-6489, 6505-6506, 6512-6513, 6517-6520, 6523-6524, 6538-6564, 6572-6573, 6577-6580, 6582-6586, 6604-6608, 6655-6660, 6662-6664, 6680, 6682-6695, 6720-6723, 6778, 6795-6796, 6798-6821, 6836-6837, 6951-6979, 7035-7036, 7099-7100, 7116-7117, 7136-7137, 7231, 7237-7238, 7261-7280, 7289-7298, 7312, 7461-7499, 7503-7553, 7568, 7577, 7611-7617, 7644-7646, 7818-7821, 7843-7873, 7886, 7888-7896, 7910, 7912-7920, 7927-7930, 7938-7943, 7952-7953, 7971-7988, 8035-8036, 8039-8041, 8044-8045, 8068-8069, 8075-8076, 8103-8104, 8187-8188, 8239-8252, 8256-8342, 8421-8424, 8450-8451, 8460-8462, 8518, 8541-8547, 8558-8569, 8597-8603, 8636, 8678, 8684, 8699-8706, 8709-8716, 8776, 8789, 8878-8879, 8900-8902, 8905, 8919-8943, 9052-9066, 9089-9113, 9122-9161, 9174-9175, 9185-9192, 9210-9217, 9271-9276, 9285-9309, 9311-9312, 9386-9387, 9394, 9396-9432, 9461, 9522, 9562-9564, 9589-9594, 9596-9597, 9602-9604, 9607-9627, 9641-9642, 9648-9657, 9662, 9666-9670, 9679-9683, 9686-9691, 9695-9702, 9731, 9733-9737, 9739-9749, 9765-9767, 9778-9786, 9790-9834, 9837-9908, 9916, 9934-9941, 9943-9965, 9980-10002, 10021-10023, 10075-10076, 10190-10194, 10196-10212, 10214-10218, 10230-10231, 10241-10257, 10276-10295, 10297-10298, 10325-10326, 10330-10331, 10341, 10343-10346, 10348-10349, 10389, 10430-10431, 10441, 10483, 10501-10509, 10520-10525, 10535-10536, 10538-10609, 10632-10633, 10665-10668, 10763-10770, 10796-10797, 10847-10918, 10966-10967, 10976-10979, 10984-10985, 11006-11008, 11010-11014, 11052
packages/excalidraw/components/SearchMenu.tsx 91.02% 76.84% 75% 91.02% 114-115, 123-134, 187, 195-200, 238-239, 241-247, 255-258, 262-265, 279-280, 282-284, 352-353, 360-361, 373, 486, 619-630, 666-668
packages/excalidraw/data/restore.ts 91.44% 83.33% 78.57% 91.44% 99-102, 127, 192, 246-248, 321, 437, 467-477, 522-523, 532-540, 548-549, 555-556, 564-573, 582-591, 609-614
packages/excalidraw/data/transform.ts 91.27% 82.03% 100% 91.27% 282-285, 316-321, 358-361, 391-396, 438-440, 455-457, 499-500, 586-593, 603-609, 613-615, 618-624, 730-731, 737-738, 742-743, 749-752, 781-782, 784-787
packages/excalidraw/element/dragElements.ts 74.12% 62.85% 100% 74.12% 41, 43-44, 48-56, 72-77, 203-227, 233-237, 242-262, 267-271
packages/excalidraw/element/newElement.ts 92.47% 91.22% 86.36% 92.47% 143-148, 151-158, 178-192, 210, 382, 384-387, 404-405, 537, 543-544, 559-576
packages/excalidraw/element/resizeElements.ts 94.23% 80.16% 100% 94.23% 213, 227-233, 270-271, 322-323, 344-349, 352-353, 355-356, 359-361, 536-539, 558-567, 676, 772-778, 849-850, 938-944, 1109-1110, 1160, 1164, 1233, 1235-1236, 1240-1241, 1244-1245, 1281-1282, 1311, 1313, 1323, 1327, 1332-1335, 1445, 1458, 1460, 1467-1469, 1484-1485, 1497-1498, 1501-1502
packages/excalidraw/element/textElement.ts 94.43% 93.44% 94.44% 94.43% 54, 168-169, 209, 282-283, 298-299, 338-345, 509-521
packages/excalidraw/element/textMeasurements.ts 93.75% 96.96% 85.71% 93.75% 111-112, 144-145, 197-198, 208-215
packages/excalidraw/element/textWrapping.ts 96.65% 94.73% 92.5% 96.65% 25-26, 121-124, 232-234, 310-317, 565-566
packages/excalidraw/element/textWysiwyg.tsx 85.2% 78% 76.47% 85.2% 67-68, 70-71, 128-129, 326-356, 361-367, 382-384, 394-400, 402-404, 408, 515-519, 527-528, 538-539, 549-554, 589-590, 614, 627-632, 640-647, 655, 659, 662-663, 669-678, 711-714
packages/excalidraw/fonts/Fonts.ts 84.52% 82.53% 90.9% 84.52% 58-64, 70-71, 101-108, 113-135, 242-259, 271-276, 279-281, 299-303, 446, 453-454, 467
packages/excalidraw/renderer/renderElement.ts 81.58% 75.97% 100% 81.58% 91-93, 190-191, 195-196, 222-223, 258-259, 374, 420-421, 434-465, 476-479, 493, 516-517, 519-520, 573-574, 652, 654-667, 709-710, 736-738, 766-776, 785-786, 821-829, 835-836, 840-903, 928-929, 959-981, 997-999, 1021, 1024, 1051-1052
packages/excalidraw/renderer/staticSvgScene.ts 54.7% 53.03% 100% 54.7% 48-49, 66-67, 96-107, 136-139, 150-152, 174-273, 276-368, 370-407, 421-427, 430-431, 443-444, 461, 463-464, 470-476, 505-521, 601-603, 618, 620, 630, 632, 659-661, 675-676, 686, 688-690, 706-716, 718-719, 727-742
Generated in workflow #4281 for commit d365eb4 by the Vitest Coverage Report Action

@Mrazator Mrazator requested a review from dwelle February 10, 2025 19:44
@Mrazator Mrazator merged commit e3060df into master Feb 11, 2025
12 checks passed
@Mrazator Mrazator deleted the mrazator/custom-text-metrics-provider branch February 11, 2025 13:23
@sentry
Copy link

sentry bot commented Feb 14, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ TypeError: Object.hasOwn is not a function. (In 'Object.hasOwn(e,"fixedPoint")', 'Object.hasOwn' is undefined) measureText(packages/excalidraw/element/textMea... View Issue
  • ‼️ TypeError: null is not an object (evaluating 'r.font=n') CanvasTextMetricsProvider.getLineWidth(packages... View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants