diff --git a/frontend/playwright/data/render-wasm/get-file-text-paragraph-new-lines.json b/frontend/playwright/data/render-wasm/get-file-text-paragraph-new-lines.json new file mode 100644 index 0000000000..983416208f --- /dev/null +++ b/frontend/playwright/data/render-wasm/get-file-text-paragraph-new-lines.json @@ -0,0 +1,135 @@ +{ + "~:features": { + "~#set": [ + "fdata/path-data", + "plugins/runtime", + "design-tokens/v1", + "variants/v1", + "layout/grid", + "styles/v2", + "fdata/objects-map", + "render-wasm/v1", + "components/v2", + "fdata/shape-data-type" + ] + }, + "~:team-id": "~u6bd7c17d-4f59-815e-8006-5c1f6882469a", + "~:permissions": { + "~:type": "~:membership", + "~:is-owner": true, + "~:is-admin": true, + "~:can-edit": true, + "~:can-read": true, + "~:is-logged": true + }, + "~:has-media-trimmed": false, + "~:comment-thread-seqn": 0, + "~:name": "text_alignement", + "~:revn": 9, + "~:modified-at": "~m1763117599970", + "~:vern": 0, + "~:id": "~ua5f238bd-dd8a-8164-8007-1bc3481eaf05", + "~:is-shared": false, + "~:migrations": { + "~#ordered-set": [ + "legacy-2", + "legacy-3", + "legacy-5", + "legacy-6", + "legacy-7", + "legacy-8", + "legacy-9", + "legacy-10", + "legacy-11", + "legacy-12", + "legacy-13", + "legacy-14", + "legacy-16", + "legacy-17", + "legacy-18", + "legacy-19", + "legacy-25", + "legacy-26", + "legacy-27", + "legacy-28", + "legacy-29", + "legacy-31", + "legacy-32", + "legacy-33", + "legacy-34", + "legacy-36", + "legacy-37", + "legacy-38", + "legacy-39", + "legacy-40", + "legacy-41", + "legacy-42", + "legacy-43", + "legacy-44", + "legacy-45", + "legacy-46", + "legacy-47", + "legacy-48", + "legacy-49", + "legacy-50", + "legacy-51", + "legacy-52", + "legacy-53", + "legacy-54", + "legacy-55", + "legacy-56", + "legacy-57", + "legacy-59", + "legacy-62", + "legacy-65", + "legacy-66", + "legacy-67", + "0001-remove-tokens-from-groups", + "0002-normalize-bool-content-v2", + "0002-clean-shape-interactions", + "0003-fix-root-shape", + "0003-convert-path-content-v2", + "0005-deprecate-image-type", + "0006-fix-old-texts-fills", + "0008-fix-library-colors-v4", + "0009-clean-library-colors", + "0009-add-partial-text-touched-flags", + "0010-fix-swap-slots-pointing-non-existent-shapes", + "0011-fix-invalid-text-touched-flags", + "0012-fix-position-data", + "0013-fix-component-path", + "0013-clear-invalid-strokes-and-fills", + "0014-fix-tokens-lib-duplicate-ids", + "0014-clear-components-nil-objects", + "0015-fix-text-attrs-blank-strings", + "0015-clean-shadow-color", + "0016-copy-fills-from-position-data-to-text-node" + ] + }, + "~:version": 67, + "~:project-id": "~u6bd7c17d-4f59-815e-8006-5c1f68846e43", + "~:created-at": "~m1763117415546", + "~:backend": "legacy-db", + "~:data": { + "~:pages": [ + "~ua5f238bd-dd8a-8164-8007-1bc3481eaf06" + ], + "~:pages-index": { + "~ua5f238bd-dd8a-8164-8007-1bc3481eaf06": { + "~:objects": { + "~#penpot/objects-map/v2": { + "~u00000000-0000-0000-0000-000000000000": "[\"~#shape\",[\"^ \",\"~:y\",0,\"~:hide-fill-on-export\",false,\"~:transform\",[\"~#matrix\",[\"^ \",\"~:a\",1.0,\"~:b\",0.0,\"~:c\",0.0,\"~:d\",1.0,\"~:e\",0.0,\"~:f\",0.0]],\"~:rotation\",0,\"~:name\",\"Root Frame\",\"~:width\",0.01,\"~:type\",\"~:frame\",\"~:points\",[[\"~#point\",[\"^ \",\"~:x\",0.0,\"~:y\",0.0]],[\"^:\",[\"^ \",\"~:x\",0.01,\"~:y\",0.0]],[\"^:\",[\"^ \",\"~:x\",0.01,\"~:y\",0.01]],[\"^:\",[\"^ \",\"~:x\",0.0,\"~:y\",0.01]]],\"~:r2\",0,\"~:proportion-lock\",false,\"~:transform-inverse\",[\"^3\",[\"^ \",\"~:a\",1.0,\"~:b\",0.0,\"~:c\",0.0,\"~:d\",1.0,\"~:e\",0.0,\"~:f\",0.0]],\"~:r3\",0,\"~:r1\",0,\"~:id\",\"~u00000000-0000-0000-0000-000000000000\",\"~:parent-id\",\"~u00000000-0000-0000-0000-000000000000\",\"~:frame-id\",\"~u00000000-0000-0000-0000-000000000000\",\"~:strokes\",[],\"~:x\",0,\"~:proportion\",1.0,\"~:r4\",0,\"~:selrect\",[\"~#rect\",[\"^ \",\"~:x\",0,\"~:y\",0,\"^6\",0.01,\"~:height\",0.01,\"~:x1\",0,\"~:y1\",0,\"~:x2\",0.01,\"~:y2\",0.01]],\"~:fills\",[[\"^ \",\"~:fill-color\",\"#FFFFFF\",\"~:fill-opacity\",1]],\"~:flip-x\",null,\"^H\",0.01,\"~:flip-y\",null,\"~:shapes\",[\"~ufc65d0b3-73cf-80fc-8007-1bc349043f87\"]]]", + "~ufc65d0b3-73cf-80fc-8007-1bc349043f87": "[\"~#shape\",[\"^ \",\"~:y\",260.00001668930054,\"~:transform\",[\"~#matrix\",[\"^ \",\"~:a\",1.0,\"~:b\",0.0,\"~:c\",0.0,\"~:d\",1.0,\"~:e\",0.0,\"~:f\",0.0]],\"~:rotation\",0,\"~:grow-type\",\"~:fixed\",\"~:content\",[\"^ \",\"~:type\",\"root\",\"~:key\",\"1k89gssab3m\",\"~:children\",[[\"^ \",\"^7\",\"paragraph-set\",\"^9\",[[\"^ \",\"~:line-height\",\"2\",\"~:font-style\",\"normal\",\"^9\",[[\"^ \",\"^:\",\"\",\"^;\",\"normal\",\"~:typography-ref-id\",null,\"~:text-transform\",\"none\",\"~:font-id\",\"sourcesanspro\",\"^8\",\"zqfvtdekli\",\"~:font-size\",\"14\",\"~:font-weight\",\"400\",\"~:typography-ref-file\",null,\"~:font-variant-id\",\"regular\",\"~:text-decoration\",\"none\",\"~:letter-spacing\",\"0\",\"~:fills\",[[\"^ \",\"~:fill-color\",\"#1d0101\",\"~:fill-opacity\",1]],\"~:font-family\",\"sourcesanspro\",\"~:text\",\"Lorem ipsum dolor sit amet consectetur adipiscing elit, per eleifend conubia luctus interdum sapien.commodohendreritjustopharetra potenticum elementum condimentum habitasse.Consequat nisl sociosqu nostra arcurus condimentum enim neque facilisi sodales inceptos , imperdiet pretium tristique interdum vestibulum eget ut\"]],\"^<\",null,\"^=\",\"none\",\"~:text-align\",\"left\",\"^>\",\"sourcesanspro\",\"^8\",\"5apin09k38\",\"^?\",\"0\",\"^@\",\"400\",\"^A\",null,\"~:text-direction\",\"ltr\",\"^7\",\"paragraph\",\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\"],[\"^ \",\"^:\",\"2\",\"^;\",\"normal\",\"^9\",[[\"^ \",\"^:\",\"\",\"^;\",\"normal\",\"^<\",null,\"^=\",\"none\",\"^>\",\"sourcesanspro\",\"^8\",\"13a7hhsqmab\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\",\"^I\",\"\"]],\"^<\",null,\"^=\",\"none\",\"^J\",\"left\",\"^>\",\"sourcesanspro\",\"^8\",\"e1n6n\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^K\",\"ltr\",\"^7\",\"paragraph\",\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\"],[\"^ \",\"^:\",\"2\",\"^;\",\"normal\",\"^9\",[[\"^ \",\"^:\",\"\",\"^;\",\"normal\",\"^<\",null,\"^=\",\"none\",\"^>\",\"sourcesanspro\",\"^8\",\"2fdeoe5iw07\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\",\"^I\",\"laoreet sagittis pulvinar sociosqu quisque parturient risus.turpis ligulau augue ridiculus lobortis ac maecenas sagittis massa\"]],\"^<\",null,\"^=\",\"none\",\"^J\",\"left\",\"^>\",\"sourcesanspro\",\"^8\",\"1k9uv\",\"^?\",\"0\",\"^@\",\"400\",\"^A\",null,\"^K\",\"ltr\",\"^7\",\"paragraph\",\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\"],[\"^ \",\"^:\",\"2\",\"^;\",\"normal\",\"^9\",[[\"^ \",\"^:\",\"\",\"^;\",\"normal\",\"^<\",null,\"^=\",\"none\",\"^>\",\"sourcesanspro\",\"^8\",\"105vpxjzxao\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\",\"^I\",\"\"]],\"^<\",null,\"^=\",\"none\",\"^J\",\"left\",\"^>\",\"sourcesanspro\",\"^8\",\"1adjfc0i3ry\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^K\",\"ltr\",\"^7\",\"paragraph\",\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\"],[\"^ \",\"^:\",\"2\",\"^;\",\"normal\",\"^9\",[[\"^ \",\"^:\",\"2\",\"^;\",\"normal\",\"^<\",null,\"^=\",\"none\",\"^>\",\"sourcesanspro\",\"^8\",\"mxyudy3pu4\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\",\"^I\",\"\"]],\"^<\",null,\"^=\",\"none\",\"^J\",\"left\",\"^>\",\"sourcesanspro\",\"^8\",\"10tspwjnuk0\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^K\",\"ltr\",\"^7\",\"paragraph\",\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\"],[\"^ \",\"^:\",\"2\",\"^;\",\"normal\",\"^9\",[[\"^ \",\"^:\",\"\",\"^;\",\"normal\",\"^<\",null,\"^=\",\"none\",\"^>\",\"sourcesanspro\",\"^8\",\"15e6xcrogq5\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\",\"^I\",\"\"]],\"^<\",null,\"^=\",\"none\",\"^J\",\"left\",\"^>\",\"sourcesanspro\",\"^8\",\"23edul3hc43\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^K\",\"ltr\",\"^7\",\"paragraph\",\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\"],[\"^ \",\"^:\",\"2\",\"^;\",\"normal\",\"^9\",[[\"^ \",\"^:\",\"\",\"^;\",\"normal\",\"^<\",null,\"^=\",\"none\",\"^>\",\"sourcesanspro\",\"^8\",\"16iupg1bpnp\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\",\"^I\",\"Lorem ipsum dolor sit amet consectetur adipiscing elit, per eleifend conubia luctus interdum sapien.commodohendreritjustopharetra potenticum elementum condimentum habitasse.Consequat nisl sociosqu nostra arcurus condimentum enim neque facilisi sodales inceptos , imperdiet pretium tristique interdum vestibulum eget ut, laoreet sagittis pulvinar sociosqu quisque parturient risus.turpis ligulau augue ridiculus lobortis ac maecenas sagittis massa\"]],\"^<\",null,\"^=\",\"none\",\"^J\",\"left\",\"^>\",\"sourcesanspro\",\"^8\",\"9cvyn1nnuk\",\"^?\",\"0\",\"^@\",\"400\",\"^A\",null,\"^K\",\"ltr\",\"^7\",\"paragraph\",\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\"],[\"^ \",\"^:\",\"2\",\"^;\",\"normal\",\"^9\",[[\"^ \",\"^:\",\"\",\"^;\",\"normal\",\"^<\",null,\"^=\",\"none\",\"^>\",\"sourcesanspro\",\"^8\",\"1tinlfanoub\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\",\"^I\",\"\"]],\"^<\",null,\"^=\",\"none\",\"^J\",\"left\",\"^>\",\"sourcesanspro\",\"^8\",\"1b7ik02mcl9\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^K\",\"ltr\",\"^7\",\"paragraph\",\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\"],[\"^ \",\"^:\",\"2\",\"^;\",\"normal\",\"^9\",[[\"^ \",\"^:\",\"\",\"^;\",\"normal\",\"^<\",null,\"^=\",\"none\",\"^>\",\"sourcesanspro\",\"^8\",\"6ygph57jvk\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\",\"^I\",\"\"]],\"^<\",null,\"^=\",\"none\",\"^J\",\"left\",\"^>\",\"sourcesanspro\",\"^8\",\"7spmcpj4xe\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^K\",\"ltr\",\"^7\",\"paragraph\",\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\"],[\"^ \",\"^:\",\"2\",\"^;\",\"normal\",\"^9\",[[\"^ \",\"^:\",\"\",\"^;\",\"normal\",\"^<\",null,\"^=\",\"none\",\"^>\",\"sourcesanspro\",\"^8\",\"1clgd5v9o4t\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\",\"^I\",\"Lorem ipsum dolor sit amet consectetur adipiscing elit, per eleifend conubia luctus interdum sapien.commodohendreritjustopharetra potenticum elementum condimentum habitasse.Consequat nisl sociosqu nostra arcurus condimentum enim neque facilisi sodales inceptos , imperdiet pretium tristique interdum vestibulum eget ut, laoreet sagittis pulvinar sociosqu quisque parturient risus.turpis ligulau augue ridiculus lobortis ac maecenas sagittis massa\"],[\"^ \",\"^:\",\"\",\"^;\",\"normal\",\"^<\",null,\"^=\",\"none\",\"^>\",\"sourcesanspro\",\"^8\",\"1ts2alryes9\",\"^?\",\"0\",\"^@\",\"400\",\"^A\",null,\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\",\"^I\",\"\"]],\"^<\",null,\"^=\",\"none\",\"^J\",\"left\",\"^>\",\"sourcesanspro\",\"^8\",\"1cdvst69r2y\",\"^?\",\"0\",\"^@\",\"400\",\"^A\",null,\"^K\",\"ltr\",\"^7\",\"paragraph\",\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\"],[\"^ \",\"^:\",\"2\",\"^;\",\"normal\",\"^9\",[[\"^ \",\"^:\",\"\",\"^;\",\"normal\",\"^<\",null,\"^=\",\"none\",\"^>\",\"sourcesanspro\",\"^8\",\"rt7z5d5xv6\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\",\"^I\",\"\"]],\"^<\",null,\"^=\",\"none\",\"^J\",\"left\",\"^>\",\"sourcesanspro\",\"^8\",\"1tygympmesx\",\"^?\",\"14\",\"^@\",\"400\",\"^A\",null,\"^K\",\"ltr\",\"^7\",\"paragraph\",\"^B\",\"regular\",\"^C\",\"none\",\"^D\",\"0\",\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^H\",\"sourcesanspro\"]]]],\"~:vertical-align\",\"top\"],\"~:hide-in-viewer\",false,\"~:name\",\"column\",\"~:width\",340.0000133038767,\"^7\",\"^I\",\"~:points\",[[\"~#point\",[\"^ \",\"~:x\",195.9999942779541,\"~:y\",260.00001668930054]],[\"^Q\",[\"^ \",\"~:x\",536.0000075818308,\"~:y\",260.00001668930054]],[\"^Q\",[\"^ \",\"~:x\",536.0000075818308,\"~:y\",1250.9999786951764]],[\"^Q\",[\"^ \",\"~:x\",195.9999942779541,\"~:y\",1250.9999786951764]]],\"~:transform-inverse\",[\"^2\",[\"^ \",\"~:a\",1.0,\"~:b\",0.0,\"~:c\",0.0,\"~:d\",1.0,\"~:e\",0.0,\"~:f\",0.0]],\"~:hidden\",false,\"~:id\",\"~ufc65d0b3-73cf-80fc-8007-1bc349043f87\",\"~:parent-id\",\"~u00000000-0000-0000-0000-000000000000\",\"~:position-data\",[[\"~#rect\",[\"^ \",\"~:y\",277.89998125941185,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"~:y1\",-1.100006103515625,\"^O\",235.21665954589844,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"~:x1\",0,\"~:y2\",17.899993896484375,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"~:x2\",235.21665954589844,\"~:direction\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"~:height\",19,\"^I\",\"Lorem ipsum dolor sit amet consectetur \"]],[\"^W\",[\"^ \",\"~:y\",294.69998431116966,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",15.699996948242188,\"^O\",248.9166717529297,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",34.69999694824219,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",248.9166717529297,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"adipiscing elit, per eleifend conubia luctus \"]],[\"^W\",[\"^ \",\"~:y\",311.49998736292747,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",32.5,\"^O\",57.133331298828125,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",51.5,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",57.133331298828125,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"interdum \"]],[\"^W\",[\"^ \",\"~:y\",328.2999904146853,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",49.30000305175781,\"^O\",238.9499969482422,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",68.30000305175781,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",238.9499969482422,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"sapien.commodohendreritjustopharetra \"]],[\"^W\",[\"^ \",\"~:y\",345.0999934664431,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",66.10000610351562,\"^O\",226.8000030517578,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",85.10000610351562,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",226.8000030517578,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"potenticum elementum condimentum \"]],[\"^W\",[\"^ \",\"~:y\",361.89998125941185,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",82.89999389648438,\"^O\",244.3333282470703,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",101.89999389648438,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",244.3333282470703,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"habitasse.Consequat nisl sociosqu nostra \"]],[\"^W\",[\"^ \",\"~:y\",378.69998431116966,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",99.69999694824219,\"^O\",244.39999389648438,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",118.69999694824219,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",244.39999389648438,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"arcurus condimentum enim neque facilisi \"]],[\"^W\",[\"^ \",\"~:y\",395.49998736292747,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",116.5,\"^O\",215.9499969482422,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",135.5,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",215.9499969482422,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"sodales inceptos , imperdiet pretium \"]],[\"^W\",[\"^ \",\"~:y\",412.2999904146853,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",133.3000030517578,\"^O\",221.64999389648438,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",152.3000030517578,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",221.64999389648438,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"tristique interdum vestibulum eget ut,\"]],[\"^W\",[\"^ \",\"~:y\",429.09999346644304,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",150.10000610351562,\"^O\",2.8166656494140625,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",169.10000610351562,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",2.8166656494140625,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\" \"]],[\"^W\",[\"^ \",\"~:y\",445.8999812594118,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",166.89999389648438,\"^O\",245.28334045410156,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",185.89999389648438,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",245.28334045410156,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"laoreet sagittis pulvinar sociosqu quisque \"]],[\"^W\",[\"^ \",\"~:y\",462.6999843111696,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",183.6999969482422,\"^O\",212.01666259765625,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",202.6999969482422,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",212.01666259765625,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"parturient risus.turpis ligulau augue \"]],[\"^W\",[\"^ \",\"~:y\",479.4999873629274,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",200.5,\"^O\",225.23333740234375,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",219.5,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",225.23333740234375,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"ridiculus lobortis ac maecenas sagittis \"]],[\"^W\",[\"^ \",\"~:y\",496.2999904146852,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",217.3000030517578,\"^O\",41.149993896484375,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",236.3000030517578,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",41.149993896484375,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"massa,\"]],[\"^W\",[\"^ \",\"~:y\",513.099993466443,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",234.10000610351562,\"^O\",235.21665954589844,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",253.10000610351562,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",235.21665954589844,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"Lorem ipsum dolor sit amet consectetur \"]],[\"^W\",[\"^ \",\"~:y\",529.8999812594118,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",250.89999389648438,\"^O\",248.9166717529297,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",269.8999938964844,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",248.9166717529297,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"adipiscing elit, per eleifend conubia luctus \"]],[\"^W\",[\"^ \",\"~:y\",546.6999995699587,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",267.70001220703125,\"^O\",57.133331298828125,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",286.70001220703125,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",57.133331298828125,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"interdum \"]],[\"^W\",[\"^ \",\"~:y\",563.4999873629274,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",284.5,\"^O\",238.9499969482422,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",303.5,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",238.9499969482422,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"sapien.commodohendreritjustopharetra \"]],[\"^W\",[\"^ \",\"~:y\",580.2999751558962,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",301.29998779296875,\"^O\",226.8000030517578,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",320.29998779296875,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",226.8000030517578,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"potenticum elementum condimentum \"]],[\"^W\",[\"^ \",\"~:y\",597.099993466443,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",318.1000061035156,\"^O\",244.3333282470703,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",337.1000061035156,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",244.3333282470703,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"habitasse.Consequat nisl sociosqu nostra \"]],[\"^W\",[\"^ \",\"~:y\",613.8999812594118,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",334.8999938964844,\"^O\",244.39999389648438,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",353.8999938964844,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",244.39999389648438,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"arcurus condimentum enim neque facilisi \"]],[\"^W\",[\"^ \",\"~:y\",630.6999995699587,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",351.70001220703125,\"^O\",215.9499969482422,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",370.70001220703125,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",215.9499969482422,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"sodales inceptos , imperdiet pretium \"]],[\"^W\",[\"^ \",\"~:y\",647.4999873629274,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",368.5,\"^O\",224.46665954589844,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",387.5,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",224.46665954589844,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"tristique interdum vestibulum eget ut, \"]],[\"^W\",[\"^ \",\"~:y\",664.2999751558962,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",385.29998779296875,\"^O\",245.28334045410156,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",404.29998779296875,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",245.28334045410156,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"laoreet sagittis pulvinar sociosqu quisque \"]],[\"^W\",[\"^ \",\"~:y\",681.099993466443,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",402.1000061035156,\"^O\",212.01666259765625,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",421.1000061035156,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",212.01666259765625,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"parturient risus.turpis ligulau augue \"]],[\"^W\",[\"^ \",\"~:y\",697.8999812594118,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",418.8999938964844,\"^O\",225.23333740234375,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",437.8999938964844,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",225.23333740234375,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"ridiculus lobortis ac maecenas sagittis \"]],[\"^W\",[\"^ \",\"~:y\",714.6999995699587,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",435.70001220703125,\"^O\",41.149993896484375,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",454.70001220703125,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",41.149993896484375,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\"massa,\"]],[\"^W\",[\"^ \",\"~:y\",731.4999873629274,\"^;\",\"normal\",\"^=\",\"none\",\"^?\",\"14px\",\"^@\",\"400\",\"^X\",452.5,\"^O\",2.8166656494140625,\"^C\",\"none\",\"^D\",\"normal\",\"~:x\",196.0000061182527,\"^Y\",0,\"^Z\",471.5,\"^E\",[[\"^ \",\"^F\",\"#1d0101\",\"^G\",1]],\"^[\",2.8166656494140625,\"^10\",\"ltr\",\"^H\",\"\\\"sourcesanspro\\\"\",\"^11\",19,\"^I\",\" \"]]],\"~:frame-id\",\"~u00000000-0000-0000-0000-000000000000\",\"~:strokes\",[],\"~:x\",195.9999942779541,\"~:blocked\",false,\"~:selrect\",[\"^W\",[\"^ \",\"~:x\",195.9999942779541,\"~:y\",260.00001668930054,\"^O\",340.0000133038767,\"^11\",990.9999620058759,\"^Y\",195.9999942779541,\"^X\",260.00001668930054,\"^[\",536.0000075818308,\"^Z\",1250.9999786951764]],\"^E\",[],\"~:flip-x\",null,\"^11\",990.9999620058759,\"~:flip-y\",null]]" + } + }, + "~:id": "~ua5f238bd-dd8a-8164-8007-1bc3481eaf06", + "~:name": "Page 1" + } + }, + "~:id": "~ua5f238bd-dd8a-8164-8007-1bc3481eaf05", + "~:options": { + "~:components-v2": true, + "~:base-font-size": "16px" + } + } +} \ No newline at end of file diff --git a/frontend/playwright/ui/render-wasm-specs/texts.spec.js b/frontend/playwright/ui/render-wasm-specs/texts.spec.js index 5239fb5606..699cd72a1f 100644 --- a/frontend/playwright/ui/render-wasm-specs/texts.spec.js +++ b/frontend/playwright/ui/render-wasm-specs/texts.spec.js @@ -347,6 +347,23 @@ test("Renders a file with texts with with text spans of different sizes", async await expect(workspace.canvas).toHaveScreenshot(); }); +test("Renders a file with texts with paragraphs and breaking lines", async ({ + page, +}) => { + const workspace = new WasmWorkspacePage(page); + await workspace.setupEmptyFile(); + await workspace.mockGetFile( + "render-wasm/get-file-text-paragraph-new-lines.json", + ); + + await workspace.goToWorkspace({ + id: "a5f238bd-dd8a-8164-8007-1bc3481eaf05", + pageId: "a5f238bd-dd8a-8164-8007-1bc3481eaf06", + }); + await workspace.waitForFirstRender(); + await expect(workspace.canvas).toHaveScreenshot(); +}); + // TODO: enable this test once we use the wasm renderer in the new editor test.skip("Renders a file with texts with tabs", async ({ page }) => { const workspace = new WasmWorkspacePage(page); diff --git a/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-texts-with-paragraphs-and-breaking-lines-1.png b/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-texts-with-paragraphs-and-breaking-lines-1.png new file mode 100644 index 0000000000..c64a86d59d Binary files /dev/null and b/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-texts-with-paragraphs-and-breaking-lines-1.png differ diff --git a/frontend/src/app/util/text/content/to_dom.cljs b/frontend/src/app/util/text/content/to_dom.cljs index 93434e746e..a4c5c747bb 100644 --- a/frontend/src/app/util/text/content/to_dom.cljs +++ b/frontend/src/app/util/text/content/to_dom.cljs @@ -119,13 +119,6 @@ [paragraph] (some #(not= "" (:text % "")) (:children paragraph))) -(defn should-filter-empty-paragraph? - [paragraphs index] - (and (not (has-content? (nth paragraphs index))) - (< index (count paragraphs)) - (some has-content? (drop (inc index) paragraphs)) - (every? #(not (has-content? %)) (take (inc index) paragraphs)))) - (defn create-inline [inline paragraph] (create-element @@ -150,7 +143,6 @@ paragraphs (get-in root [:children 0 :children]) filtered-paragraphs (->> paragraphs (map-indexed vector) - (remove (fn [[index _]] (should-filter-empty-paragraph? paragraphs index))) (mapv second))] (create-element "div" diff --git a/render-wasm/src/render/text.rs b/render-wasm/src/render/text.rs index f8ba8a0c8b..fb396c1d3d 100644 --- a/render-wasm/src/render/text.rs +++ b/render-wasm/src/render/text.rs @@ -217,6 +217,7 @@ fn draw_text( let layer_rec = SaveLayerRec::default(); canvas.save_layer(&layer_rec); + let mut normalized_line_height = text_content.normalized_line_height(); for paragraph_builder_group in paragraph_builder_groups { let mut group_offset_y = global_offset_y; @@ -228,8 +229,14 @@ fn draw_text( let xy = (shape.selrect().x(), shape.selrect().y() + group_offset_y); paragraph.paint(canvas, xy); + let line_metrics = paragraph.get_line_metrics(); if paragraph_index == group_len - 1 { - group_offset_y += paragraph.ideographic_baseline(); + if line_metrics.is_empty() { + group_offset_y += normalized_line_height; + } else { + normalized_line_height = paragraph.ideographic_baseline(); + group_offset_y += paragraph.ideographic_baseline() * line_metrics.len() as f32; + } } for line_metrics in paragraph.get_line_metrics().iter() { diff --git a/render-wasm/src/shapes/text.rs b/render-wasm/src/shapes/text.rs index b12ee09935..25d1f4e85a 100644 --- a/render-wasm/src/shapes/text.rs +++ b/render-wasm/src/shapes/text.rs @@ -38,6 +38,7 @@ pub struct TextContentSize { pub width: f32, pub height: f32, pub max_width: f32, + pub normalized_line_height: f32, } const DEFAULT_TEXT_CONTENT_SIZE: f32 = 0.01; @@ -48,14 +49,7 @@ impl TextContentSize { width: DEFAULT_TEXT_CONTENT_SIZE, height: DEFAULT_TEXT_CONTENT_SIZE, max_width: DEFAULT_TEXT_CONTENT_SIZE, - } - } - - pub fn new(width: f32, height: f32, max_width: f32) -> Self { - Self { - width, - height, - max_width, + normalized_line_height: 0.0, } } @@ -64,6 +58,21 @@ impl TextContentSize { width, height, max_width: DEFAULT_TEXT_CONTENT_SIZE, + normalized_line_height: 0.0, + } + } + + pub fn new_with_normalized_line_height( + width: f32, + height: f32, + max_width: f32, + normalized_line_height: f32, + ) -> Self { + Self { + width, + height, + max_width, + normalized_line_height, } } @@ -93,6 +102,9 @@ impl TextContentSize { } else { self.height = default_height; } + if f32::is_finite(size.normalized_line_height) { + self.normalized_line_height = size.normalized_line_height; + } } } @@ -232,6 +244,10 @@ impl TextContent { self.size.width } + pub fn normalized_line_height(&self) -> f32 { + self.size.normalized_line_height + } + pub fn grow_type(&self) -> GrowType { self.grow_type } @@ -400,9 +416,33 @@ impl TextContent { paragraphs } + /// Calculate the normalized line height from paragraph builders + fn calculate_normalized_line_height( + &self, + paragraph_builders: &mut [ParagraphBuilderGroup], + width: f32, + ) -> f32 { + let mut normalized_line_height = 0.0; + for paragraph_builder_group in paragraph_builders.iter_mut() { + for paragraph_builder in paragraph_builder_group.iter_mut() { + let mut paragraph = paragraph_builder.build(); + paragraph.layout(width); + let baseline = paragraph.ideographic_baseline(); + if baseline > normalized_line_height { + normalized_line_height = baseline; + } + } + } + normalized_line_height + } + /// Performs an Auto Width text layout. fn text_layout_auto_width(&self) -> TextContentLayoutResult { let mut paragraph_builders = self.paragraph_builder_group_from_text(None); + + let normalized_line_height = + self.calculate_normalized_line_height(&mut paragraph_builders, f32::MAX); + let paragraphs = self.build_paragraphs_from_paragraph_builders(&mut paragraph_builders, f32::MAX); @@ -417,7 +457,12 @@ impl TextContent { ) }); - let size = TextContentSize::new(width.ceil(), height.ceil(), width.ceil()); + let size = TextContentSize::new_with_normalized_line_height( + width.ceil(), + height.ceil(), + width.ceil(), + normalized_line_height, + ); TextContentLayoutResult(paragraph_builders, paragraphs, size) } @@ -426,6 +471,10 @@ impl TextContent { fn text_layout_auto_height(&self) -> TextContentLayoutResult { let width = self.width(); let mut paragraph_builders = self.paragraph_builder_group_from_text(None); + + let normalized_line_height = + self.calculate_normalized_line_height(&mut paragraph_builders, width); + let paragraphs = self.build_paragraphs_from_paragraph_builders(&mut paragraph_builders, width); let height = paragraphs @@ -434,7 +483,12 @@ impl TextContent { .fold(0.0, |auto_height, paragraph| { auto_height + paragraph.height() }); - let size = TextContentSize::new_with_size(width.ceil(), height.ceil()); + let size = TextContentSize::new_with_normalized_line_height( + width, + height.ceil(), + DEFAULT_TEXT_CONTENT_SIZE, + normalized_line_height, + ); TextContentLayoutResult(paragraph_builders, paragraphs, size) } @@ -442,6 +496,10 @@ impl TextContent { fn text_layout_fixed(&self) -> TextContentLayoutResult { let width = self.width(); let mut paragraph_builders = self.paragraph_builder_group_from_text(None); + + let normalized_line_height = + self.calculate_normalized_line_height(&mut paragraph_builders, width); + let paragraphs = self.build_paragraphs_from_paragraph_builders(&mut paragraph_builders, width); let paragraph_height = paragraphs @@ -451,7 +509,12 @@ impl TextContent { auto_height + paragraph.height() }); - let size = TextContentSize::new_with_size(width.ceil(), paragraph_height.ceil()); + let size = TextContentSize::new_with_normalized_line_height( + width, + paragraph_height.ceil(), + DEFAULT_TEXT_CONTENT_SIZE, + normalized_line_height, + ); TextContentLayoutResult(paragraph_builders, paragraphs, size) }