diff --git a/README.md b/README.md index 7c11a8a29..18e2f34b9 100644 --- a/README.md +++ b/README.md @@ -271,3 +271,5 @@ this selected list of featured projects using D2. - Open-source money manager app for Android (1.1k stars). - [LocalStack](https://docs.localstack.cloud/references/network-troubleshooting/) - Cloud service emulator (46k stars) +- [Queue Library](https://github.com/golang-queue/queue/tree/master/images) + - Queue is a Golang library for spawning and managing a Goroutine pool diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index ff334fa5c..6acfa4bcc 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -8,4 +8,9 @@ #### Bugfixes ⛑️ +- Fix a bug in 32bit builds [#1115](https://github.com/terrastruct/d2/issues/1115) - Fix a bug in ID parsing [#322](https://github.com/terrastruct/d2/issues/322) +- Fix a bug in watch mode parsing SVG [#1119](https://github.com/terrastruct/d2/issues/1119) +- Namespace transitions so that multiple animated D2 diagrams can exist on the same page [#1123](https://github.com/terrastruct/d2/issues/1123) +- Fix a bug in vertical alignment of appendix lines [#1104](https://github.com/terrastruct/d2/issues/1104) +- Fix precision difference for sketch mode running on different architectures [#921](https://github.com/terrastruct/d2/issues/921) diff --git a/d2cli/static/watch.js b/d2cli/static/watch.js index 156a2992d..71fa9436f 100644 --- a/d2cli/static/watch.js +++ b/d2cli/static/watch.js @@ -25,14 +25,9 @@ function init(reconnectDelay) { console.debug("watch websocket received data"); } if (msg.svg) { - // We could turn d2SVG into an actual SVG element and use outerHTML to fully replace it - // with the result from the renderer but unfortunately that overwrites the #d2-svg ID. - // Even if you add another line to set it afterwards. The parsing/interpretation of outerHTML must be async. - // - // There's no way around that short of parsing out the top level svg tag in the msg and - // setting innerHTML to only the actual svg innards. However then you also need to parse - // out the width, height and viewbox out of the top level SVG tag and update those manually. - d2SVG.innerHTML = msg.svg; + // we can't just set `d2SVG.innerHTML = msg.svg` need to parse this as xml not html + const parsedXML = new DOMParser().parseFromString(msg.svg, "text/xml"); + d2SVG.replaceChildren(parsedXML.documentElement); const svgEl = d2SVG.querySelector("#d2-svg"); // just use inner SVG in watch mode diff --git a/d2renderers/d2animate/d2animate.go b/d2renderers/d2animate/d2animate.go index b2f1b3074..7fca92dd7 100644 --- a/d2renderers/d2animate/d2animate.go +++ b/d2renderers/d2animate/d2animate.go @@ -14,23 +14,23 @@ import ( var transitionDurationMS = 1 -func makeKeyframe(delayMS, durationMS, totalMS, identifier int) string { +func makeKeyframe(delayMS, durationMS, totalMS, identifier int, diagramHash string) string { percentageBefore := (math.Max(0, float64(delayMS-transitionDurationMS)) / float64(totalMS)) * 100. percentageStart := (float64(delayMS) / float64(totalMS)) * 100. percentageEnd := (float64(delayMS+durationMS-transitionDurationMS) / float64(totalMS)) * 100. if int(math.Ceil(percentageEnd)) == 100 { - return fmt.Sprintf(`@keyframes d2Transition-%d { + return fmt.Sprintf(`@keyframes d2Transition-%s-%d { 0%%, %f%% { opacity: 0; } %f%%, %f%% { opacity: 1; } -}`, identifier, percentageBefore, percentageStart, math.Ceil(percentageEnd)) +}`, diagramHash, identifier, percentageBefore, percentageStart, math.Ceil(percentageEnd)) } percentageAfter := (float64(delayMS+durationMS) / float64(totalMS)) * 100. - return fmt.Sprintf(`@keyframes d2Transition-%d { + return fmt.Sprintf(`@keyframes d2Transition-%s-%d { 0%%, %f%% { opacity: 0; } @@ -40,7 +40,7 @@ func makeKeyframe(delayMS, durationMS, totalMS, identifier int) string { %f%%, 100%% { opacity: 0; } -}`, identifier, percentageBefore, percentageStart, percentageEnd, percentageAfter) +}`, diagramHash, identifier, percentageBefore, percentageStart, percentageEnd, percentageAfter) } func Wrap(rootDiagram *d2target.Diagram, svgs [][]byte, renderOpts d2svg.RenderOpts, intervalMS int) ([]byte, error) { @@ -99,13 +99,13 @@ func Wrap(rootDiagram *d2target.Diagram, svgs [][]byte, renderOpts d2svg.RenderO fmt.Fprint(buf, ``) for i, svg := range svgs { str := string(svg) - str = strings.Replace(str, " -rectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloud +rectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloud \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/all_shapes_dark/sketch.exp.svg b/d2renderers/d2sketch/testdata/all_shapes_dark/sketch.exp.svg index af8dcf744..b2c01767e 100644 --- a/d2renderers/d2sketch/testdata/all_shapes_dark/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/all_shapes_dark/sketch.exp.svg @@ -95,7 +95,7 @@ -rectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloud +rectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloud \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/animated/sketch.exp.svg b/d2renderers/d2sketch/testdata/animated/sketch.exp.svg index 7a128d8ce..47ed52d24 100644 --- a/d2renderers/d2sketch/testdata/animated/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/animated/sketch.exp.svg @@ -110,7 +110,7 @@ -wintersummertreessnowsun +wintersummertreessnowsun \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/animated_dark/sketch.exp.svg b/d2renderers/d2sketch/testdata/animated_dark/sketch.exp.svg index f9ac02951..b2e8a5c53 100644 --- a/d2renderers/d2sketch/testdata/animated_dark/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/animated_dark/sketch.exp.svg @@ -108,7 +108,7 @@ -wintersummertreessnowsun +wintersummertreessnowsun \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/arrowheads/sketch.exp.svg b/d2renderers/d2sketch/testdata/arrowheads/sketch.exp.svg index fb7f5db39..538921890 100644 --- a/d2renderers/d2sketch/testdata/arrowheads/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/arrowheads/sketch.exp.svg @@ -104,7 +104,7 @@ -112233445566778899none arrow triangle diamond diamond filled cf-many cf-many-required cf-one cf-one-required +112233445566778899none arrow triangle diamond diamond filled cf-many cf-many-required cf-one cf-one-required diff --git a/d2renderers/d2sketch/testdata/arrowheads_dark/sketch.exp.svg b/d2renderers/d2sketch/testdata/arrowheads_dark/sketch.exp.svg index a548d4246..764ed37d3 100644 --- a/d2renderers/d2sketch/testdata/arrowheads_dark/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/arrowheads_dark/sketch.exp.svg @@ -102,7 +102,7 @@ -112233445566778899none arrow triangle diamond diamond filled cf-many cf-many-required cf-one cf-one-required +112233445566778899none arrow triangle diamond diamond filled cf-many cf-many-required cf-one cf-one-required diff --git a/d2renderers/d2sketch/testdata/basic/sketch.exp.svg b/d2renderers/d2sketch/testdata/basic/sketch.exp.svg index 67b68ac01..ebb0c22d7 100644 --- a/d2renderers/d2sketch/testdata/basic/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/basic/sketch.exp.svg @@ -97,7 +97,7 @@ -ab +ab \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/basic_dark/sketch.exp.svg b/d2renderers/d2sketch/testdata/basic_dark/sketch.exp.svg index 77ae0d395..3516f2453 100644 --- a/d2renderers/d2sketch/testdata/basic_dark/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/basic_dark/sketch.exp.svg @@ -95,7 +95,7 @@ -ab +ab \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/child_to_child/sketch.exp.svg b/d2renderers/d2sketch/testdata/child_to_child/sketch.exp.svg index 922677f9a..c2defab67 100644 --- a/d2renderers/d2sketch/testdata/child_to_child/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/child_to_child/sketch.exp.svg @@ -104,7 +104,7 @@ -wintersummersnowsun +wintersummersnowsun \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/child_to_child_dark/sketch.exp.svg b/d2renderers/d2sketch/testdata/child_to_child_dark/sketch.exp.svg index cab12158a..449671153 100644 --- a/d2renderers/d2sketch/testdata/child_to_child_dark/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/child_to_child_dark/sketch.exp.svg @@ -102,7 +102,7 @@ -wintersummersnowsun +wintersummersnowsun \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/connection_label/sketch.exp.svg b/d2renderers/d2sketch/testdata/connection_label/sketch.exp.svg index 07bf1fc06..2b5f0eea3 100644 --- a/d2renderers/d2sketch/testdata/connection_label/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/connection_label/sketch.exp.svg @@ -104,7 +104,7 @@ -ab hello +ab hello \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/connection_label_dark/sketch.exp.svg b/d2renderers/d2sketch/testdata/connection_label_dark/sketch.exp.svg index 12e3d5689..9347547a5 100644 --- a/d2renderers/d2sketch/testdata/connection_label_dark/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/connection_label_dark/sketch.exp.svg @@ -102,7 +102,7 @@ -ab hello +ab hello \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/crows_feet/sketch.exp.svg b/d2renderers/d2sketch/testdata/crows_feet/sketch.exp.svg index 823824bd2..fc076f22e 100644 --- a/d2renderers/d2sketch/testdata/crows_feet/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/crows_feet/sketch.exp.svg @@ -97,7 +97,7 @@ -a1b1a2b2a3b3c1d1c2d2c3d3e1f1e2f2e3f3g1h1g2h2g3h3cdf +a1b1a2b2a3b3c1d1c2d2c3d3e1f1e2f2e3f3g1h1g2h2g3h3cdf \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/crows_feet_dark/sketch.exp.svg b/d2renderers/d2sketch/testdata/crows_feet_dark/sketch.exp.svg index 466a5dd23..bb1b56fff 100644 --- a/d2renderers/d2sketch/testdata/crows_feet_dark/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/crows_feet_dark/sketch.exp.svg @@ -95,7 +95,7 @@ -a1b1a2b2a3b3c1d1c2d2c3d3e1f1e2f2e3f3g1h1g2h2g3h3cdf +a1b1a2b2a3b3c1d1c2d2c3d3e1f1e2f2e3f3g1h1g2h2g3h3cdf \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/dots-all/sketch.exp.svg b/d2renderers/d2sketch/testdata/dots-all/sketch.exp.svg index f533efe47..a589773d6 100644 --- a/d2renderers/d2sketch/testdata/dots-all/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/dots-all/sketch.exp.svg @@ -130,7 +130,7 @@ -rectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloud +rectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloud \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/dots-multiple/sketch.exp.svg b/d2renderers/d2sketch/testdata/dots-multiple/sketch.exp.svg index 87a268e65..4a9a62da6 100644 --- a/d2renderers/d2sketch/testdata/dots-multiple/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/dots-multiple/sketch.exp.svg @@ -130,7 +130,7 @@ -rectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloud +rectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloud \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/dots-real/sketch.exp.svg b/d2renderers/d2sketch/testdata/dots-real/sketch.exp.svg index 0179b5089..c75d9d004 100644 --- a/d2renderers/d2sketch/testdata/dots-real/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/dots-real/sketch.exp.svg @@ -159,7 +159,7 @@ -NETWORKD2 Parser+readerio.RuneReader+readerPosd2ast.Position-lookahead[]rune#peekn(n int)(s string, eof bool)+peek()(r rune, eof bool)+rewind()void+commit()voidCELL TOWERSATELLITESTRANSMITTER SEND SEND SEND +NETWORKD2 Parser+readerio.RuneReader+readerPosd2ast.Position-lookahead[]rune#peekn(n int)(s string, eof bool)+peek()(r rune, eof bool)+rewind()void+commit()voidCELL TOWERSATELLITESTRANSMITTER SEND SEND SEND diff --git a/d2renderers/d2sketch/testdata/elk_corners/sketch.exp.svg b/d2renderers/d2sketch/testdata/elk_corners/sketch.exp.svg index 6c95c7608..f8e43a0c2 100644 --- a/d2renderers/d2sketch/testdata/elk_corners/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/elk_corners/sketch.exp.svg @@ -97,7 +97,7 @@ -abc +abc \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/opacity/sketch.exp.svg b/d2renderers/d2sketch/testdata/opacity/sketch.exp.svg index 0455f094c..f160edef3 100644 --- a/d2renderers/d2sketch/testdata/opacity/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/opacity/sketch.exp.svg @@ -854,7 +854,7 @@ x

linux: because a PC is a terrible thing to waste

-
auserslast_logindatetime You don't have to know how the computer works,just how to work the computer. +auserslast_logindatetime You don't have to know how the computer works,just how to work the computer. \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/opacity_dark/sketch.exp.svg b/d2renderers/d2sketch/testdata/opacity_dark/sketch.exp.svg index 925e52862..5759a8155 100644 --- a/d2renderers/d2sketch/testdata/opacity_dark/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/opacity_dark/sketch.exp.svg @@ -852,7 +852,7 @@ x

linux: because a PC is a terrible thing to waste

-
auserslast_logindatetime You don't have to know how the computer works,just how to work the computer. +auserslast_logindatetime You don't have to know how the computer works,just how to work the computer. \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/paper-real/sketch.exp.svg b/d2renderers/d2sketch/testdata/paper-real/sketch.exp.svg index 6e7e0d143..c61df223a 100644 --- a/d2renderers/d2sketch/testdata/paper-real/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/paper-real/sketch.exp.svg @@ -1205,7 +1205,7 @@ -NETWORKCELL TOWERSATELLITESTRANSMITTER SEND SEND SEND +NETWORKCELL TOWERSATELLITESTRANSMITTER SEND SEND SEND diff --git a/d2renderers/d2sketch/testdata/root-fill/sketch.exp.svg b/d2renderers/d2sketch/testdata/root-fill/sketch.exp.svg index a4febb5c7..4faf61487 100644 --- a/d2renderers/d2sketch/testdata/root-fill/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/root-fill/sketch.exp.svg @@ -853,7 +853,7 @@
  • Staging
  • Dispatch to Site
  • - + \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/sql_tables/sketch.exp.svg b/d2renderers/d2sketch/testdata/sql_tables/sketch.exp.svg index c60d9db93..7b8e108c9 100644 --- a/d2renderers/d2sketch/testdata/sql_tables/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/sql_tables/sketch.exp.svg @@ -97,7 +97,7 @@ -usersidintnamestringemailstringpasswordstringlast_logindatetimeproductsidintpricedecimalskustringnamestringordersidintuser_idintproduct_idintshipmentsidintorder_idinttracking_numberstringPKstatusstring +usersidintnamestringemailstringpasswordstringlast_logindatetimeproductsidintpricedecimalskustringnamestringordersidintuser_idintproduct_idintshipmentsidintorder_idinttracking_numberstringPKstatusstring \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/sql_tables_dark/sketch.exp.svg b/d2renderers/d2sketch/testdata/sql_tables_dark/sketch.exp.svg index 7da016ed9..e47b0c700 100644 --- a/d2renderers/d2sketch/testdata/sql_tables_dark/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/sql_tables_dark/sketch.exp.svg @@ -95,7 +95,7 @@ -usersidintnamestringemailstringpasswordstringlast_logindatetimeproductsidintpricedecimalskustringnamestringordersidintuser_idintproduct_idintshipmentsidintorder_idinttracking_numberstringPKstatusstring +usersidintnamestringemailstringpasswordstringlast_logindatetimeproductsidintpricedecimalskustringnamestringordersidintuser_idintproduct_idintshipmentsidintorder_idinttracking_numberstringPKstatusstring \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/terminal/sketch.exp.svg b/d2renderers/d2sketch/testdata/terminal/sketch.exp.svg index cf449f49b..167aac474 100644 --- a/d2renderers/d2sketch/testdata/terminal/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/terminal/sketch.exp.svg @@ -137,7 +137,7 @@ -NETWORKUSERAPI SERVERLOGSCELL TOWERONLINE PORTALDATA PROCESSORSATELLITESTRANSMITTERUISTORAGE SEND SEND SEND PHONE LOGS MAKE CALL ACCESS DISPLAY PERSIST +NETWORKUSERAPI SERVERLOGSCELL TOWERONLINE PORTALDATA PROCESSORSATELLITESTRANSMITTERUISTORAGE SEND SEND SEND PHONE LOGS MAKE CALL ACCESS DISPLAY PERSIST diff --git a/d2renderers/d2sketch/testdata/twitter/sketch.exp.svg b/d2renderers/d2sketch/testdata/twitter/sketch.exp.svg index 3f44782ec..53a56f1c5 100644 --- a/d2renderers/d2sketch/testdata/twitter/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/twitter/sketch.exp.svg @@ -870,7 +870,7 @@
  • Served data logging
  • GraphQLFederated Strato Column

    Tweet/user content hydration, visibility filtering

    -
    TLS-API (being deprecated)CrMixerEarlyBirdUtagSpaceCommunities iPhone web HTTP Android Thrift RPC Candidate Fetch Feature Hydration Candidate sources +TLS-API (being deprecated)CrMixerEarlyBirdUtagSpaceCommunities iPhone web HTTP Android Thrift RPC Candidate Fetch Feature Hydration Candidate sources diff --git a/d2renderers/d2sketch/testdata/twitter_dark/sketch.exp.svg b/d2renderers/d2sketch/testdata/twitter_dark/sketch.exp.svg index 03fe712f7..c24cfa73e 100644 --- a/d2renderers/d2sketch/testdata/twitter_dark/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/twitter_dark/sketch.exp.svg @@ -870,7 +870,7 @@
  • Served data logging
  • GraphQLFederated Strato Column

    Tweet/user content hydration, visibility filtering

    -
    TLS-API (being deprecated)CrMixerEarlyBirdUtagSpaceCommunities iPhone web HTTP Android Thrift RPC Candidate Fetch Feature Hydration Candidate sources +TLS-API (being deprecated)CrMixerEarlyBirdUtagSpaceCommunities iPhone web HTTP Android Thrift RPC Candidate Fetch Feature Hydration Candidate sources diff --git a/d2renderers/d2svg/appendix/appendix.go b/d2renderers/d2svg/appendix/appendix.go index a0eb21077..0f58ffa82 100644 --- a/d2renderers/d2svg/appendix/appendix.go +++ b/d2renderers/d2svg/appendix/appendix.go @@ -238,7 +238,7 @@ func generateLine(i, y int, text string, ruler *textmeasure.Ruler) (string, int, 0, y, generateNumberedIcon(i, 0, 0)) line += fmt.Sprintf(`%s`, - ICON_RADIUS*3, y, FONT_SIZE, d2svg.RenderText(text, ICON_RADIUS*3, float64(dims.Height))) + ICON_RADIUS*3, y+5, FONT_SIZE, d2svg.RenderText(text, ICON_RADIUS*3, float64(dims.Height))) return line, dims.Width + ICON_RADIUS*3, go2.IntMax(dims.Height, ICON_RADIUS*2) } diff --git a/d2renderers/d2svg/appendix/testdata/diagram_wider_than_tooltip/sketch.exp.svg b/d2renderers/d2svg/appendix/testdata/diagram_wider_than_tooltip/sketch.exp.svg index 615e8b5ff..2a624e820 100644 --- a/d2renderers/d2svg/appendix/testdata/diagram_wider_than_tooltip/sketch.exp.svg +++ b/d2renderers/d2svg/appendix/testdata/diagram_wider_than_tooltip/sketch.exp.svg @@ -115,8 +115,8 @@ -1Like starbucks or something -2I'm not sure what this is +1Like starbucks or something +2I'm not sure what this is x1 -1root > x +
    1root > x x1y2Gee, I feel kind of LIGHT in the head now, knowing I can't make my satellite dish PAYMENTS!3 -1https://d2lang.com -2Gee, I feel kind of LIGHT in the head now,knowing I can't make my satellite dish PAYMENTS! -3https://terrastruct.com +
    1https://d2lang.com +2Gee, I feel kind of LIGHT in the head now,knowing I can't make my satellite dish PAYMENTS! +3https://terrastruct.com x1y2Gee, I feel kind of LIGHT in the head now, knowing I can't make my satellite dish PAYMENTS!3 -1https://d2lang.com -2Gee, I feel kind of LIGHT in the head now,knowing I can't make my satellite dish PAYMENTS! -3https://fosny.eu +
    1https://d2lang.com +2Gee, I feel kind of LIGHT in the head now,knowing I can't make my satellite dish PAYMENTS! +3https://fosny.eu x1Total abstinence is easier than perfect moderationy2Gee, I feel kind of LIGHT in the head now, knowing I can't make my satellite dish PAYMENTS! -1Total abstinence is easier than perfect moderation -2Gee, I feel kind of LIGHT in the head now,knowing I can't make my satellite dish PAYMENTS! +
    1Total abstinence is easier than perfect moderation +2Gee, I feel kind of LIGHT in the head now,knowing I can't make my satellite dish PAYMENTS! x1Total abstinence is easier than perfect moderationy2Gee, I feel kind of LIGHT in the head now, knowing I can't make my satellite dish PAYMENTS! -1Total abstinence is easier than perfect moderation -2Gee, I feel kind of LIGHT in the head now,knowing I can't make my satellite dish PAYMENTS! +
    1Total abstinence is easier than perfect moderation +2Gee, I feel kind of LIGHT in the head now,knowing I can't make my satellite dish PAYMENTS! Chicken's plan +}]]>Chicken's plan -Approach roadChicken's plan +Approach roadChicken's plan -Approach roadCross roadChicken's plan +Approach roadCross roadChicken's plan -Approach roadCross roadMake you wonder whyChicken's plan +Approach roadCross roadMake you wonder whyChicken's plan \ No newline at end of file diff --git a/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf index 64ceca2ea..463c4cc7a 100644 Binary files a/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf and b/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf differ diff --git a/lib/font/font.go b/lib/font/font.go index 698319b20..1b84a5e19 100644 --- a/lib/font/font.go +++ b/lib/font/font.go @@ -49,8 +49,8 @@ var ( WOFF_ENTRY_OFFSET_CHECKSUM = 16 // magic - MAGIC_WOFF = 0x774f4646 - MAGIC_CHECKSUM_ADJUSTMENT = 0xb1b0afba + MAGIC_WOFF uint32 = 0x774f4646 + MAGIC_CHECKSUM_ADJUSTMENT uint32 = 0xb1b0afba // sizes SIZE_OF_WOFF_HEADER = 44 @@ -85,7 +85,7 @@ func Sfnt2Woff(fontBuf []byte) ([]byte, error) { numTables := binary.BigEndian.Uint16(fontBuf[4:]) woffHeader := make([]byte, SIZE_OF_WOFF_HEADER) - binary.BigEndian.PutUint32(woffHeader[WOFF_OFFSET_MAGIC:], uint32(MAGIC_WOFF)) + binary.BigEndian.PutUint32(woffHeader[WOFF_OFFSET_MAGIC:], MAGIC_WOFF) binary.BigEndian.PutUint16(woffHeader[WOFF_OFFSET_NUM_TABLES:], numTables) binary.BigEndian.PutUint16(woffHeader[WOFF_OFFSET_SFNT_SIZE:], 0) binary.BigEndian.PutUint32(woffHeader[WOFF_OFFSET_META_OFFSET:], 0) @@ -148,7 +148,7 @@ func Sfnt2Woff(fontBuf []byte) ([]byte, error) { csum += tableEntry.CheckSum } - var checksumAdjustment = uint32(MAGIC_CHECKSUM_ADJUSTMENT) - csum + var checksumAdjustment = MAGIC_CHECKSUM_ADJUSTMENT - csum majorVersion := uint16(0) minVersion := uint16(1) diff --git a/lib/geo/vector.go b/lib/geo/vector.go index db1bb107b..16a3fccb3 100644 --- a/lib/geo/vector.go +++ b/lib/geo/vector.go @@ -78,7 +78,7 @@ func GetUnitNormalVector(x1, y1, x2, y2 float64) (float64, float64) { } func (a Vector) Radians() float64 { - return math.Atan2(a[1], a[0]) + return float64(float32(math.Atan2(a[1], a[0]))) } func (a Vector) Degrees() float64 { diff --git a/lib/shape/shape_oval.go b/lib/shape/shape_oval.go index 8e035f845..da1b96239 100644 --- a/lib/shape/shape_oval.go +++ b/lib/shape/shape_oval.go @@ -35,7 +35,7 @@ func (s shapeOval) GetInnerBox() *geo.Box { } func (s shapeOval) GetDimensionsToFit(width, height, paddingX, paddingY float64) (float64, float64) { - theta := math.Atan2(height, width) + theta := float64(float32(math.Atan2(height, width))) // add padding in direction of diagonal so there is padding distance between top left and border paddedWidth := width + paddingX*math.Cos(theta) paddedHeight := height + paddingY*math.Sin(theta) @@ -59,7 +59,7 @@ func (s shapeOval) GetInsidePlacement(width, height, paddingX, paddingY float64) // ├───cos*r───┤ rx := s.Box.Width / 2 ry := s.Box.Height / 2 - theta := math.Atan2(ry, rx) + theta := float64(float32(math.Atan2(ry, rx))) sin := math.Sin(theta) cos := math.Cos(theta) // r is the ellipse radius on the line between node.TopLeft and the ellipse center