Commit graph

119 commits

Author SHA1 Message Date
Gavin Nishizawa
94bf92a28b
use per-axis padding 2023-02-10 16:19:19 -08:00
Gavin Nishizawa
93fa13ab0f
add FullShape to use shape's InnerBox for placement 2023-02-10 13:52:58 -08:00
Gavin Nishizawa
6b65665b61
fix GetInsidePlacement inconsistencies 2023-02-10 13:52:58 -08:00
Gavin Nishizawa
4bfb6af7e6
Merge branch 'master' into shape-specific-inner-boxes 2023-02-02 20:25:52 -08:00
Anmol Sethi
09dc9fd12f
Merge remote-tracking branch 'upstream/master' into scenarios-a407 2023-02-02 10:33:31 -08:00
Gavin Nishizawa
1b1cdaff15
Merge branch 'master' into shape-specific-inner-boxes 2023-02-01 10:31:46 -08:00
Gavin Nishizawa
57fa903fe6
also limit person AR with width/height attributes unless both are entered 2023-01-31 16:08:06 -08:00
Gavin Nishizawa
bd23d0758b
update hexagon inner box 2023-01-26 16:44:20 -08:00
Gavin Nishizawa
597bc319bf
update other chopPrecision 2023-01-26 16:44:20 -08:00
Gavin Nishizawa
fed4bd2b9f
ceil dimensions to fit 2023-01-26 16:44:20 -08:00
Gavin Nishizawa
e367a007e5
chopPrecision once at end 2023-01-26 16:44:20 -08:00
Gavin Nishizawa
f30fe2c2c4
round from float32 precision 2023-01-26 16:44:20 -08:00
Gavin Nishizawa
c12e71af15
update circle fitting 2023-01-26 16:44:19 -08:00
Gavin Nishizawa
cc8c7756ab
cleanup 2023-01-26 16:44:19 -08:00
Gavin Nishizawa
d5f2ed00d5
handle person shape aspect ratio 2023-01-26 16:44:19 -08:00
Gavin Nishizawa
b1beddc9e2
Adjust padding per shape 2023-01-26 16:44:19 -08:00
Gavin Nishizawa
6f26167beb
fix class dimensions 2023-01-26 16:44:19 -08:00
Gavin Nishizawa
0311a3f7d7
use paddingX and paddingY in GetDimensionsToFit 2023-01-26 16:44:19 -08:00
Gavin Nishizawa
b76d43536d
remove debugging code 2023-01-26 16:44:18 -08:00
Gavin Nishizawa
23097370e2
set up shape specific inner bounding boxes for labels 2023-01-26 16:43:36 -08:00
Kevin David
9ba1d85d21
d2graph: check that font family is entirely loaded before using it
I tested this by removing the changes I added in `d2fonts`, which led to:
```
[21:23:54] info: compiling GetUniqueColumnName-fix.d2...
[21:23:54] err: failed to compile: ruler does not have entire font family SourceCodePro loaded, is a style missing?
```

The error was also rendered in the UI.
2023-01-24 21:25:01 -05:00
Anmol Sethi
4b50748dd0
d2ir: Final PR imports
https://github.com/terrastruct/terrastruct-backend/pull/975/files#diff-1b00307a7a2bd1ffc68527a7df7c9c83327d8cd2dd00f4741ec6bd0b96605cd4
2023-01-24 02:56:31 -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
Gavin Nishizawa
1a07492517
update li measurement + h1 border-bottom 2023-01-15 23:31:06 -08:00
Alexander Wang
0314a74eab
unescape img hrefs 2023-01-14 14:20:08 -08:00
Gavin Nishizawa
224af99efd
add sketch versions of arrowheads 2023-01-13 18:13:28 -08:00
Gavin Nishizawa
54f34d72ad
extend previous segment to target if last segment is very short 2023-01-12 11:23:23 -08:00
Bernard Xie
80892f9ff9
Merge pull request #601 from berniexie/540/fit-to-screen-fix
export: add fit to screen mode to exported svg
2023-01-03 17:42:01 -08:00
Bernard Xie
35c1a1633f
add script to tests 2023-01-03 16:42:39 -08:00
Anmol Sethi
296b6407e9
lib/version/version.go: Update 2023-01-03 14:13:29 -08:00
Alexander Wang
2f545e3f61
tables 2022-12-22 11:06:57 -08:00
Alexander Wang
9812ea54fb
test 2022-12-22 00:46:46 -08:00
Alexander Wang
39cc074757
cleanup 2022-12-22 00:45:32 -08:00
Alexander Wang
4ccaf4a578
ok 2022-12-21 23:57:56 -08:00
Alexander Wang
3a9a784342
wip 2022-12-21 23:13:52 -08:00
Alexander Wang
07fb1a3d86
implement sketch 2022-12-21 20:55:27 -08:00
Anmol Sethi
e79c840ef8
v0.1.2 2022-12-18 22:46:59 -08:00
Alexander Wang
b3a47c845a
bump upscale factor 2022-12-18 20:25:29 -08:00
Bernard Xie
abb86e1c53
increase png export quality by 1.5 2022-12-14 10:35:15 -08:00
Alexander Wang
8b32b0965b
make compression dict determinstic 2022-12-10 16:38:02 -08:00
Anmol Sethi
d89354a8cf
lib/version: Update whoops 2022-12-08 03:03:05 -08:00
Anmol Sethi
b72959a91f
fmt 2022-12-07 23:22:20 -08:00
Anmol Sethi
22e0ed0f9f
v0.1.0 2022-12-06 09:22:51 -08:00
Júlio César Batista
15f83d3b03
Fix page inner size 2022-12-05 19:39:09 -08:00
Júlio César Batista
2cc9405a25
Change inner path base height to 79 2022-12-05 19:16:45 -08:00
Júlio César Batista
3db0afd9c7
Change inner path base width to 66 2022-12-05 19:05:35 -08:00
Júlio César Batista
58cd8d6922
Fix page outer path 2022-12-05 18:52:08 -08:00
Anmol Sethi
d116889fc9
Switch fully to util-go 2022-12-01 11:48:49 -08:00
Anmol Sethi
07e316fac5
xmain: rm -rf 2022-12-01 11:48:49 -08:00
Anmol Sethi
820226c72b
lib/xexec: rm -rf 2022-12-01 11:48:49 -08:00