Commit graph

42 commits

Author SHA1 Message Date
Gavin Nishizawa
c38f15712d
rename to Lookup and Get 2023-10-30 15:02:26 -07:00
Gavin Nishizawa
fdbde73605
rename to Get and MustGet 2023-10-30 13:51:37 -07:00
Gavin Nishizawa
1cfa2b9f81
use new SyncMap with FontFaces/FontEncoding 2023-10-30 12:15:32 -07:00
Gavin Nishizawa
a67c186cae
d2fonts.FontFaces sync.Map 2023-10-24 16:40:56 -07:00
Gavin Nishizawa
6b255c61da
d2fonts.FontEncodings sync.Map 2023-10-24 16:31:30 -07:00
Alexander Wang
a5b867ba5b
fix race 2023-08-02 19:44:36 -07:00
Alexander Wang
07a6344a3c
fuzzybubbles 2023-07-01 20:56:48 -07:00
Gavin Nishizawa
14afd8c433
improve code measurement and rendering 2023-06-19 17:09:36 -07:00
Bernard Xie
dedf9e2d55
more accurate 2023-05-31 16:58:10 -07:00
Bernard Xie
8de7711e68
fix 2023-05-31 16:30:11 -07:00
Andreas Deininger
6ae417cde9
Fixing typos
Signed-off-by: Andreas Deininger <andreas@deininger.net>
2023-04-14 07:48:22 +02:00
Gavin Nishizawa
735bcda933
handdrawn semibold 2023-04-10 15:06:26 -07:00
Gavin Nishizawa
e51429749a
custom semibold font option 2023-04-10 15:06:26 -07:00
Gavin Nishizawa
07faf97941
using semibold 2023-04-10 15:06:26 -07:00
Gavin Nishizawa
d4228a171e
add SourceCodePro-Semibold font 2023-04-10 15:06:26 -07:00
Gavin Nishizawa
624b2a9a10
setting up semibold font 2023-04-10 15:06:25 -07:00
Gavin Nishizawa
4c35a27791
add SourceSansPro-Semibold font 2023-04-10 15:06:25 -07:00
Alexander Wang
2f57ea5ca2
accept font input 2023-03-29 17:29:30 -07:00
Bernard Xie
f2aca1bb4b
getCorpus 2023-03-29 13:50:00 -07:00
Bernard Xie
322d253fce
rename cutset -> corpus 2023-03-29 10:03:44 -07:00
Bernard Xie
8e07980b06
Revert "remove GetUniqueChars"
This reverts commit da7e2fbcc7.
2023-03-29 09:51:36 -07:00
Bernard Xie
da7e2fbcc7
remove GetUniqueChars 2023-03-28 15:11:23 -07:00
Bernard Xie
70b4fd8912
copy byte slice first 2023-03-28 13:58:53 -07:00
Bernard Xie
e5eeebefde
remove custom font cli 2023-03-28 11:30:03 -07:00
Bernard Xie
ffc414260e
refactor 2023-03-27 19:26:49 -07:00
Bernard Xie
48a7472667
add and fix utf8cutfont 2023-03-27 19:19:12 -07:00
Alexander Wang
705f4a4845
test 2023-03-27 17:04:53 -07:00
Bernard Xie
f195053ef3
small change 2023-03-27 15:38:53 -07:00
Bernard Xie
ff1ef999a3
tests still borken 2023-03-27 14:46:03 -07:00
Bernard Xie
7a137227e7
test without woff 2023-03-27 14:17:48 -07:00
Bernard Xie
2d6243ded3
cutset test 2023-03-27 13:41:40 -07:00
Bernard Xie
7c146dd213
subset fonts 2023-03-24 19:50:16 -07:00
Bernard Xie
194fb58027
Update d2renderers/d2fonts/d2fonts.go
Co-authored-by: gavin-ts <85081687+gavin-ts@users.noreply.github.com>
2023-03-24 17:31:58 -07:00
Bernard Xie
54b501dc92
errors that make more sense 2023-03-24 15:36:51 -07:00
Bernard Xie
811a630fb7
Add cli option 2023-03-24 15:04:35 -07:00
Alexander Wang
ba282b5f96
font: mono 2023-03-09 20:06:15 -08:00
Kevin David
500e3e179e
SourceCodePro bold/italic: use .woff for encoded fonts instead of .ttf
Sourced from: https://github.com/adobe-fonts/source-code-pro/releases/tag/2.038R-ro%2F1.058R-it%2F1.018R-VAR

Translated with the following commands:
```
base64 -i ~/Downloads/WOFF-source-code-pro-2.038R-ro-1.058R-it/TTF/SourceCodePro-It.ttf.woff -o ./d2renderers/d2fonts/encoded/SourceCodePro-Italic.txt
base64 -i ~/Downloads/WOFF-source-code-pro-2.038R-ro-1.058R-it/TTF/SourceCodePro-Bold.ttf.woff -o ./d2renderers/d2fonts/encoded/SourceCodePro-Bold.txt
```

I used the `.ttf.woff` files because that seemed "closer" to the original `.ttf` files included, but I'm not sure if that's correct.
2023-01-24 21:20:16 -05: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
Alexander Wang
c859ad3ca7
fix encoding 2022-12-22 00:41:05 -08:00
Alexander Wang
07fb1a3d86
implement sketch 2022-12-21 20:55:27 -08:00
Alexander Wang
80136a2a11
2022-11-21 04:32:58PM 2022-11-21 16:32:58 -08:00
Alexander Wang
524c089a74 oss
Co-authored-by: Anmol Sethi <hi@nhooyr.io>
2022-11-03 06:54:49 -07:00