Commit graph

246 commits

Author SHA1 Message Date
OneRain2333
9a070a52f9 Add double bordered rect, oval, square 2023-01-24 16:21:25 +08:00
OneRain2333
344718dad3 Remove double circle shape 2023-01-24 16:21:25 +08:00
OneRain2333
9575c768dc Make to be a style attribute and remove shape 2023-01-24 16:21:25 +08:00
OneRain2333
c75e540840 update renderDoubleOval function 2023-01-24 16:21:25 +08:00
OneRain2333
a64d87eb61 Implement the sketch of double circle 2023-01-24 16:21:25 +08:00
OneRain2333
8bb86250fb Add double circle shape 2023-01-24 16:21:25 +08:00
Kevin David
bd7e18395e
d2renderers: d2fonts: add bold + italic styles for Source Code Pro
👋 I've been playing around with changing the entire font of a diagram to something fixed-width, starting by hand-editing `main.go`

I noticed that if I switched over the family to Source Code Pro, d2 crashed with the following stack:

```
[23:38:30] info: compiling GetUniqueColumnName-fix.d2...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x1c4 pc=0x16b562c]

goroutine 43 [running]:
github.com/golang/freetype/truetype.(*Font).Bounds(0xc000669670?, 0x0?)
        /Users/kevin/dev/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/truetype/truetype.go:378 +0xc
github.com/golang/freetype/truetype.NewFace(0x0, 0xc0003276c0)
        /Users/kevin/dev/go/pkg/mod/github.com/golang/freetype@v0.0.0-20170609003504-e2365dfdc4a0/truetype/face.go:199 +0x325
oss.terrastruct.com/d2/lib/textmeasure.(*Ruler).addFontSize(0xc00037c000, {{0x1bb9a34, 0xd}, {0x1b82732, 0x4}, 0x1f})
        /Users/kevin/dev/d2/lib/textmeasure/textmeasure.go:141 +0x112
oss.terrastruct.com/d2/lib/textmeasure.(*Ruler).MeasurePrecise(0xc00037c000, {{0x1bb9a34, 0xd}, {0x1b82732, 0x4}, 0x1f}, {0xc000582100, 0x1f})
        /Users/kevin/dev/d2/lib/textmeasure/textmeasure.go:157 +0xde
oss.terrastruct.com/d2/lib/textmeasure.(*Ruler).Measure(...)
        /Users/kevin/dev/d2/lib/textmeasure/textmeasure.go:151
oss.terrastruct.com/d2/d2graph.GetTextDimensions({0x0, 0x0, 0xc000657860?}, 0xc00037c000, 0xc000620280, 0xc000092020)
```

Which I tracked down to these missing styles, which appear to matter even if they aren't used.

I acquired the `ttf` files from https://fonts.google.com/specimen/Source+Code+Pro

I created the encoded fonts on my Mac with:
```
base64 -i SourceCodePro-Italic.ttf -o ../encoded/SourceCodePro-Italic.txt
```

Hopefully this is correct! Open to all feedback, especially since I think this is the first change I've ever made to a go program :)

Signed-off-by: Kevin David <kevin-david@github.com>
2023-01-23 00:35:19 -05:00
OneRain2333
c19d90eb20 Use constant to define offset of double-bordered shape 2023-01-22 18:21:30 +08:00
OneRain2333
be73f4b2b2 fix typo 2023-01-22 17:53:10 +08:00
Alexander Wang
a1bebb8b23
Merge pull request #634 from Paracelsus-Rose/master
d2renderer: #579 Circle Arrowhead
2023-01-19 17:56:36 -08:00
Alexander Wang
b41d8cdbc7
tests 2023-01-19 12:44:53 -08:00
Alexander Wang
2966d393ae
fix bounding box for multiple 2023-01-19 12:39:12 -08:00
Alexander Wang
2d17947a44
account for 3d offset in bounding box 2023-01-19 11:51:30 -08:00
Paracelsus-Rose
fd43527da0
Merge branch 'master' of github.com:terrastruct/d2 into terrastruct-master 2023-01-19 14:38:24 -05:00
Paracelsus-Rose
100927e7dc
Seems right. Thanks Gavin. 2023-01-19 14:19:29 -05:00
Alexander Wang
c84dcbacf5
tests 2023-01-19 10:58:46 -08:00
Alexander Wang
74b54f3f8a
update 2023-01-19 00:52:10 -08:00
Alexander Wang
d832fdd6af
fix 2023-01-19 00:46:30 -08:00
Alexander Wang
7651aedb8c
fix opacity for labels 2023-01-19 00:26:00 -08:00
OneRain2333
16d2eee4a3 update test using go 1.18 2023-01-19 15:24:39 +08:00
OneRain2333
735c421230 update d2svg.go 2023-01-19 15:12:26 +08:00
Gavin Nishizawa
66e912698c
update tests 2023-01-15 23:31:06 -08:00
Paracelsus-Rose
3b90f3502d
Numbers copied from TS but not working 2023-01-15 14:55:12 -05:00
Paracelsus-Rose
5cfc71f271
Tried making values equal to TS project. 2023-01-15 01:36:58 -05:00
Gavin Nishizawa
7e2d722f50
cf one required seed 2023-01-13 19:20:05 -08:00
Gavin Nishizawa
413acead61
move cf closer to match non-sketch positions 2023-01-13 19:15:24 -08:00
Gavin Nishizawa
967dd21c27
move cf one line away from circle 2023-01-13 18:29:11 -08:00
Gavin Nishizawa
a56db93723
bigger cf one circle 2023-01-13 18:20:22 -08:00
Gavin Nishizawa
b49fbc75e3
update sketch arrowheads test 2023-01-13 18:16:53 -08:00
Gavin Nishizawa
005ceec44f
refactor source/target adjustment and pass to sketch arrowheads 2023-01-13 18:13:28 -08:00
Gavin Nishizawa
a599875931
update tests 2023-01-13 18:13:28 -08:00
Gavin Nishizawa
ebdc3b029c
fixed precision floats from rough 2023-01-13 18:13:28 -08:00
Gavin Nishizawa
88c72c96f4
update tests 2023-01-13 18:13:28 -08:00
Gavin Nishizawa
224af99efd
add sketch versions of arrowheads 2023-01-13 18:13:28 -08:00
Gavin Nishizawa
62d153f798
update tests 2023-01-13 18:13:28 -08:00
Gavin Nishizawa
af2a032a9e
render sketch arrowheads separately 2023-01-13 18:13:28 -08:00
Gavin Nishizawa
033a005eea
add arrowheads sketch test 2023-01-13 18:13:14 -08:00
Alexander Wang
b9c4678302
tooltip 2023-01-13 08:16:18 -08:00
Alexander Wang
a6b34634cd
refactor 2023-01-12 11:22:53 -08:00
Alexander Wang
48c9cc7929
sketch 2023-01-12 11:20:18 -08:00
Alexander Wang
60523f0446
works 2023-01-12 11:06:36 -08:00
Alexander Wang
9c1e7eeb73
test 2023-01-12 10:51:26 -08:00
Alexander Wang
cc0a048757
test 2023-01-12 10:29:13 -08:00
Alexander Wang
6c852cf792
fallback lexer if none found 2023-01-11 23:53:02 -08:00
Paracelsus-Rose
75c0dee349
Circles Rendering closer to border. Still not perfect. 2023-01-10 19:16:02 -05:00
Paracelsus-Rose
f21226bfa7
Removed Offset and refactored 2023-01-10 15:30:20 -05:00
Paracelsus-Rose
fc15982b93
Requested Changes 2023-01-10 12:48:54 -05:00
Paracelsus-Rose
d46ce55c2f
Update d2svg.go 2023-01-10 12:08:26 -05:00
Paracelsus-Rose
2c59b1c163
Formatting 2023-01-09 23:48:26 -05:00
Paracelsus-Rose
b0d3b9d3fd
Init 2023-01-09 22:44:45 -05:00
Alexander Wang
2a80a45bf6
update tests 2023-01-06 12:30:16 -08:00
Bernard Xie
35c1a1633f
add script to tests 2023-01-03 16:42:39 -08:00
Bernard Xie
510e7be593
Add comment 2023-01-03 15:32:31 -08:00
Bernard Xie
dfd66232fc
add d2-svg id on generation 2023-01-03 15:01:21 -08:00
Bernard Xie
070b50a6e2
add check to only run script on root svg 2023-01-03 14:44:36 -08:00
Bernard Xie
643aa13de9
add fit to screen to exported svg 2023-01-03 11:27:15 -08:00
Alexander Wang
be6c3a1eff
Merge pull request #578 from martinjirku/d2-384-crows-feet-arrowhead
d2renderer: #384 The arrowhead crow feet variants
2023-01-01 13:47:28 -08:00
harryjrk
e3047b6aba
fix curved connections issues 2023-01-01 11:35:21 +01:00
OneRain2333
f2a0de9f69 update tests 2023-01-01 16:13:32 +08:00
Alexander Wang
405fdbe57f
don't add appendix seperator without appendix 2022-12-31 12:17:05 -08:00
harryjrk
2bff170c6f
rename crow foot to shorter name, add tests 2022-12-31 19:03:40 +01:00
harryjrk
847b712101
add next.MD message, replace falltrough with comma 2022-12-31 19:03:40 +01:00
harryjrk
8891227045
Add the crow feet variants to arrowheads
Introduce new styles for arrowhead:
  - crows-feet-many-required
  - crows-feet-many-optional
  - crows-feet-one-required
  - crows-feet-one-optional
2022-12-31 19:03:39 +01:00
OneRain2333
ec92fb3606 Add double bordered rect, oval, square 2022-12-31 15:57:22 +08:00
OneRain2333
679474dce8 Remove double circle shape 2022-12-31 15:33:16 +08:00
OneRain2333
1b37cf4e48 Make to be a style attribute and remove shape 2022-12-31 15:26:38 +08:00
OneRain2333
f1b7f2706d update renderDoubleOval function 2022-12-31 14:17:34 +08:00
Alexander Wang
e8a897530c
update tests 2022-12-30 21:00:34 -08:00
Alexander Wang
510c10227e
fix bounding boxes 2022-12-30 20:49:49 -08:00
Alexander Wang
8708bceef0
Merge pull request #563 from alixander/layout-configs
Pass layout configs
2022-12-30 14:31:05 -08:00
Alexander Wang
115d6e4147
default layouts 2022-12-30 13:36:49 -08:00
nekikara
cab3aedfe2
fix typo 2022-12-30 21:12:04 +01:00
OneRain2333
07bfb748b0 Implement the sketch of double circle 2022-12-30 17:30:29 +08:00
OneRain2333
7ad0b6e99c Add double circle shape 2022-12-30 17:14:44 +08:00
Gavin Nishizawa
8b81428693
use header width for sql_tables if larger than row width 2022-12-29 12:01:31 -08:00
Alexander Wang
51e281d3f6
update tests 2022-12-28 16:42:22 -08:00
Alexander Wang
d52b3b4db5
add xlink href for older browsers 2022-12-28 16:41:15 -08:00
Alexander Wang
385a2564c7
appendix 2022-12-28 16:33:46 -08:00
Alexander Wang
d50449cf63
works 2022-12-28 16:19:30 -08:00
Alexander Wang
60b6133b2c
remove commented 2022-12-28 15:16:18 -08:00
Alexander Wang
e7aa4f8d19
fix tooltip shadow 2022-12-28 15:15:38 -08:00
Alexander Wang
36ef848a82
len -> radius 2022-12-28 14:58:27 -08:00
Alexander Wang
6d4e0cd64c
add ascii diagram 2022-12-28 14:54:04 -08:00
Alexander Wang
6af5a9728f
save 2022-12-28 12:07:01 -08:00
Alexander Wang
65df91b70e
save 2022-12-28 11:39:20 -08:00
Alexander Wang
3aebfaf1d2
save 2022-12-27 20:29:51 -08:00
Alexander Wang
70f76a8f5b
replace icon 2022-12-27 10:07:19 -08:00
Alexander Wang
51d51709b0
svg works 2022-12-27 00:20:49 -08:00
Alexander Wang
e4a7bb5215
save 2022-12-26 23:56:23 -08:00
Alexander Wang
9e658adf08
update tests 2022-12-25 21:50:40 -08:00
Alexander Wang
4cc7dde896
text font sizes and bold, italic, underline 2022-12-25 21:49:26 -08:00
Alexander Wang
a09f614f5f
update tests 2022-12-25 17:33:12 -08:00
Alexander Wang
7c41142487
make font family for markdown headings explicit 2022-12-25 17:22:55 -08:00
Alexander Wang
a02779cb7f
use monospace font for class shape 2022-12-24 16:10:58 -08:00
Alexander Wang
64d7d5f1b6
apply themes to tables and classes 2022-12-24 15:56:22 -08:00
Alexander Wang
96374da51e
fix icon query param escaping 2022-12-24 12:45:12 -08:00
Alexander Wang
2a03b65f1c
don't use ruler if doesn't exist 2022-12-23 08:48:54 -08:00
Alexander Wang
c828d2c825
classes 2022-12-22 11:32:41 -08:00
Alexander Wang
2f545e3f61
tables 2022-12-22 11:06:57 -08:00
Alexander Wang
1e0d6c294c
delete 2022-12-22 00:42:43 -08:00