Commit 1f45feb1 authored by Derek Schaab's avatar Derek Schaab

Add Lasker figures; switch default style to Lasker

parent 846cc4f2
......@@ -18,7 +18,7 @@ import (
var (
pieceImages pieceImageCache
pieceVectors pieceVectorCache
pieceStyles = []style{merida}
pieceStyles = []style{merida, lasker}
pieceSizes = []size{small, medium, large, xlarge}
pieceNames = map[chess.Piece]string{
chess.WhitePawn: "white_pawn",
......
......@@ -39,7 +39,7 @@ func WritePNG(w io.Writer, g chess.Game, o Options) (err error) {
ctx.SetClip(dst.Bounds())
scaledPieceCache := make(map[chess.Piece]*image.RGBA)
var pieceCounts [256]uint8
pieceSet := pieceImages[merida]
pieceSet := pieceImages[defaultStyle]
for square := chess.First; square <= chess.Last; square++ {
piece := g.Board[square]
if piece == chess.Empty {
......
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M430 432l10 40H72l10-40s27.69-7.146 79.773-11.855L168.8 364C80 176 192 144 256 48c64 96 176 128 87 316l7.308 56.152C402.338 424.862 430 432 430 432z" stroke="#000" stroke-width="16"/><path d="M207.41 118.383c-8.625 9.306-16.96 18.435-24.578 27.683L208 240h32zM256 360a959.05 959.05 0 0 0-79.047 3.29l-2.031 16.226A943.076 943.076 0 0 1 256 376c27.128 0 54.13 1.194 80.95 3.504l-2.114-16.234A959.205 959.205 0 0 0 256 360zm0 32c-27.85 0-55.568 1.235-83.098 3.629l-2.03 16.234A944.128 944.128 0 0 1 256 408c28.549 0 56.96 1.313 85.164 3.867l-2.117-16.242A959.35 959.35 0 0 0 256 392z" color="#000" fill="#fff"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M242 44h28v40h38v28h-38v56h-28v-56h-38V84h38z" color="#000" fill="#fff"/><path d="M230 32v40h-38v52h38v56h52v-56h38V72h-38V32zm16 16h20v40h38v20h-38v56h-20v-56h-38V88h38z" color="#000"/><path d="M430 432l10 40H72l10-40s21.225-5.477 61.614-9.998C142.111 336.916 80.478 239.283 112 192c32-48 95.338-32 144-32 48.662 0 112-16 144 32 31.429 47.143-29.746 145.076-31.587 230.008C408.788 426.526 430 432 430 432z" stroke="#000" stroke-width="16"/><path d="M197.355 165.488c-.825-.013-1.631.014-2.453.008-9.446 10.959-14.944 23.599-17.316 36.844-3.289 18.363-1.062 37.81 3.043 57.308 7.614 36.17 21.585 73.206 23.574 101.793a965.305 965.305 0 0 0-60.008 5.145 376.117 376.117 0 0 1 3.211 15.754C183.281 378.18 219.526 376 256 376c36.52 0 72.809 2.185 108.727 6.355.96-5.259 2.045-10.51 3.23-15.75a965.405 965.405 0 0 0-59.703-5.14c1.982-28.59 15.957-65.638 23.574-101.817 4.105-19.498 6.336-38.945 3.047-57.308-2.372-13.244-7.867-25.886-17.313-36.844-7.315.037-14.764.34-22.257.762l-.106.14c14.464 10.848 21.214 23.626 23.925 38.762 2.711 15.137.942 32.69-2.953 51.192-7.25 34.44-21.925 71.453-23.926 104.367-12.054-.46-24.136-.719-36.245-.719-11.954 0-23.883.255-35.785.703-2.005-32.91-16.676-69.917-23.926-104.351-3.895-18.502-5.668-36.055-2.957-51.192 2.711-15.136 9.462-27.914 23.926-38.762l-.074-.097c-6.655-.377-13.298-.711-19.828-.813zM256 392c-35.65 0-71.086 2.046-106.18 5.957.669 5.32 1.182 10.634 1.485 15.93C185.906 410.019 220.846 408 256 408c35.173 0 70.13 2.023 104.75 5.895.32-5.292.85-10.606 1.531-15.926C327.155 394.05 291.685 392 256 392z" fill="#fff"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M430 432l10 40H72l10-40s19.072-4.922 55.167-9.306l.627-.047-9.825-78.6c48-16 112-64 112-144-32 0-128 8-160 16L72 151.999c32-8 183.97-47.952 151.97-111.952 272 0 248.03 231.952 143.064 381.734C408.16 426.363 430 432 430 432z" stroke="#000" stroke-width="16"/><path d="M208 124.862c12.5-22.463 31.166-29.705 56-21.726-12.5 22.464-31.166 29.705-56 21.726zM256 360c-39.342 0-78.428 2.465-117.074 7.215l1.984 15.871C178.901 378.417 217.324 376 256 376c42.148 0 83.995 2.872 125.309 8.407a439.171 439.171 0 0 0 8.257-15.028C345.563 363.196 300.95 360 256 360zm0 32c-38.007 0-75.773 2.296-113.137 6.73l1.989 15.88C181.559 410.256 218.661 408 256 408c35.805 0 71.394 2.066 106.625 6.07a434.359 434.359 0 0 0 9.82-14.937C334.004 394.432 295.13 392 256 392z" fill="#fff"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M256 40c-39.764 0-72 32.236-72 72a72 72 0 0 0 16.52 45.8c-17.507.5-43.013 1.227-60.52 2.2l-8 40h68c0 64-8 152-68 224-33.126 4.23-50 8-50 8l-10 40h368l-10-40s-15.625-3.702-50-8c-60-72-68-160-68-224h68l-8-40c-17.496-.972-42.992-1.7-60.488-2.2A72 72 0 0 0 328 112c0-39.764-32.236-72-72-72z" stroke="#000" stroke-width="16" stroke-linecap="square" stroke-miterlimit="8"/><path d="M256 207.996c-16.05 0-32.07.268-48.074.676a621.587 621.587 0 0 1-.371 16.016c16.126-.419 32.271-.692 48.445-.692s32.319.273 48.445.692a616.71 616.71 0 0 1-.37-16.016c-16.005-.408-32.026-.676-48.075-.676zM256 360c-25.87 0-51.632 1.076-77.23 3.148a286.307 286.307 0 0 1-8 16.75C198.995 377.331 227.427 376 256 376c28.573 0 57.005 1.331 85.23 3.898a286.307 286.307 0 0 1-8-16.75C307.632 361.076 281.87 360 256 360zm0 32c-31.772 0-63.377 1.613-94.719 4.727a270.922 270.922 0 0 1-11.48 17.332C184.893 410.078 220.337 408 256 408s71.107 2.078 106.2 6.059a270.917 270.917 0 0 1-11.481-17.332C319.377 393.613 287.772 392 256 392z" color="#000" fill="#fff"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M256 40a56 48 0 0 0-56 48 56 48 0 0 0 3.188 15.8 136.343 100 0 0 0-83.876 92.2 136.343 100 0 0 0 .196 2.855C104.813 191.533 90.982 184.237 80 176c35.527 63.16 63.262 158.945 63.645 246C103.235 426.518 82 432 82 432l-10 40h368l-10-40s-21.236-5.482-61.645-10c.383-87.055 28.118-182.84 63.645-246-11.143 8.357-25.216 15.746-40.152 23.176A136.343 100 0 0 0 392 196a136.343 100 0 0 0-83.23-92.098A56 48 0 0 0 312 88a56 48 0 0 0-56-48z" stroke="#000" stroke-width="16" stroke-linecap="square" stroke-miterlimit="8"/><path d="M256 79.379l-22.285 55.707c-6.873 17.182-15.41 29.192-25.684 44.601-5.72 8.582-11.83 18.373-17.687 29.79-20.016-13.683-41.437-23.842-60.074-32.872a66.91 66.91 0 0 0-2.89 17c23.269 11.472 48.835 23.775 69.241 40.852 7.518-18.906 16.241-33.172 24.723-45.894 10.09-15.137 19.602-28.475 27.227-47.536l7.43-18.566 7.429 18.566c7.624 19.061 17.135 32.399 27.226 47.536 8.482 12.722 17.205 26.988 24.723 45.894 20.208-16.91 45.48-29.134 68.57-40.512a66.797 66.797 0 0 0-2.793-17.05c-18.504 8.958-39.698 19.046-59.5 32.582-5.857-11.417-11.966-21.208-17.687-29.79-10.273-15.41-18.81-27.419-25.684-44.601zM256 360c-36.264 0-72.307 2.108-107.992 6.152.646 5.31 1.212 10.62 1.691 15.926C184.825 378.09 220.302 376 256 376c35.698 0 71.175 2.09 106.3 6.078a515.917 515.917 0 0 1 1.692-15.926C328.307 362.108 292.264 360 256 360zm0 32c-35.295 0-70.379 2.005-105.129 5.84.31 5.358.534 10.703.656 16.023C186.057 410.012 220.922 408 256 408c35.079 0 69.944 2.012 104.473 5.863.122-5.32.346-10.665.656-16.023C326.38 394.005 291.295 392 256 392z" fill="#fff"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M110 40l10 96h30l-18 288c-33.126 4.23-50 8-50 8l-10 40h368l-10-40s-15.625-3.702-50-8l-18-288h30l8-96h-61l-3 40h-49l1-40h-64l1 40h-49l-2-40z" stroke="#000" stroke-width="16"/><path d="M256 140c-32.9 0-65.703.916-98.398 2.598l-1.004 16.07c33.026-1.73 66.165-2.672 99.402-2.672 33.237 0 66.375.941 99.402 2.672l-1.004-16.07C321.703 140.916 288.9 140 256 140zm0 220c-37.757 0-75.279 2.263-112.402 6.64l-1.016 16.243C180.029 378.349 217.891 376 256 376c38.108 0 75.969 2.35 113.414 6.883l-1.016-16.242C331.276 362.263 293.756 360 256 360zm0 32c-38.441 0-76.637 2.35-114.418 6.887l-1.016 16.242C178.67 410.433 217.207 408 256 408c38.792 0 77.328 2.433 115.43 7.129l-1.016-16.242C332.634 394.35 294.44 392 256 392z" color="#000" fill="#fff"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M430 432l10 40H72l10-40s27.69-7.146 79.773-11.855L168.8 364C80 176 192 144 256 48c64 96 176 128 87 316l7.308 56.152C402.338 424.862 430 432 430 432z" fill="#fff" stroke="#000" stroke-width="16"/><path d="M256 360a960.244 960.244 0 0 0-87.207 3.984l.008.016-2.031 16.243A944.144 944.144 0 0 1 256 376c29.881 0 59.614 1.434 89.113 4.23L343 364l.016-.035A960.285 960.285 0 0 0 256 360zm0 32a960.204 960.204 0 0 0-91.25 4.36l-2.977 23.785C109.69 424.854 82 432 82 432l-2.227 8.898A927.821 927.821 0 0 1 256 424a927.84 927.84 0 0 1 176.227 16.898L430 432s-27.66-7.138-79.691-11.848l-3.098-23.797A960.208 960.208 0 0 0 256 392zm-51.047-282.79c-8.526 9.142-16.87 18.165-24.668 27.356L208 240h32z" color="#000"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M242 44h28v40h38v28h-38v56h-28v-56h-38V84h38z" color="#000" fill="#fff"/><path d="M230 32v40h-38v52h38v56h52v-56h38V72h-38V32zm16 16h20v40h38v20h-38v56h-20v-56h-38V88h38z" color="#000"/><path d="M430 432l10 40H72l10-40s21.225-5.477 61.614-9.998C142.111 336.916 80.478 239.283 112 192c32-48 95.338-32 144-32 48.662 0 112-16 144 32 31.429 47.143-29.746 145.076-31.587 230.008C408.788 426.526 430 432 430 432z" fill="#fff" stroke="#000" stroke-width="16"/><path d="M207.66 153.602c-17.536 13.152-26.785 30.374-30.074 48.738-3.289 18.363-1.062 37.81 3.043 57.308 8.21 38.997 23.832 79.019 23.832 108.352h16c0-34.667-16.382-74.645-24.172-111.648-3.895-18.502-5.668-36.055-2.957-51.192 2.711-15.136 9.462-27.914 23.926-38.762zm97.14 0l-9.6 12.796c14.463 10.848 21.214 23.626 23.925 38.762 2.711 15.137.942 32.69-2.953 51.192C308.382 293.355 292 333.333 292 368h16c0-29.333 15.618-69.355 23.828-108.352 4.105-19.498 6.336-38.945 3.047-57.308-3.289-18.364-12.538-35.586-30.074-48.738zM256 360a960.077 960.077 0 0 0-119.84 7.516 378.17 378.17 0 0 1 3.242 15.707A944.106 944.106 0 0 1 256 376c39.23 0 78.207 2.443 116.73 7.242a385.507 385.507 0 0 1 3.262-15.707A960.07 960.07 0 0 0 256 360zm0 32c-38.349 0-76.46 2.31-114.152 6.824.993 7.796 1.63 15.537 1.765 23.176C103.223 426.52 82 432 82 432l-2.227 8.898A927.82 927.82 0 0 1 256 424a927.82 927.82 0 0 1 176.227 16.898L430 432s-21.211-5.474-61.586-9.992c.166-7.634.826-15.374 1.84-23.172A960.075 960.075 0 0 0 256 392z" color="#000"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M430 432l10 40H72l10-40s19.072-4.922 55.167-9.306l.627-.047-9.825-78.6c48-16 112-64 112-144-32 0-128 8-160 16L72 152c32-8 183.97-47.953 151.97-111.953 272 0 248.03 231.953 143.064 381.735C408.16 426.364 430 432 430 432z" fill="#fff" stroke="#000" stroke-width="15.998"/><path d="M208 124.863c12.5-22.463 31.166-29.705 56-21.726-12.5 22.463-31.166 29.705-56 21.726zM256 360a960.022 960.022 0 0 0-125.016 8.191l1.985 15.875A944.059 944.059 0 0 1 256 376c45.073 0 89.81 3.244 133.91 9.562a448.487 448.487 0 0 0 8.13-14.996A959.95 959.95 0 0 0 256 360zm0 32c-41.18 0-82.085 2.662-122.492 7.86L132 424c-33.126 4.23-50 8-50 8l-2.227 8.898A927.821 927.821 0 0 1 256 424a927.84 927.84 0 0 1 176.227 16.898L430 432s-15.625-3.702-50-8l-1.508-24.14A960.006 960.006 0 0 0 256 392z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M256 40c-39.764 0-72 32.236-72 72a72 72 0 0 0 16.52 45.8c-17.507.5-43.013 1.227-60.52 2.2l-8 40h68c0 64-8 152-68 224-33.126 4.23-50 8-50 8l-10 40h368l-10-40s-15.625-3.702-50-8c-60-72-68-160-68-224h68l-8-40c-17.496-.972-42.992-1.7-60.488-2.2A72 72 0 0 0 328 112c0-39.764-32.236-72-72-72z" fill="#fff" stroke="#000" stroke-width="16" stroke-linecap="square" stroke-miterlimit="8"/><path d="M256 188c-40.948 0-81.76 1.329-122.383 3.922L132 200h68c0 6.694-.118 13.702-.344 20.875 18.75-.56 37.53-.875 56.344-.875s37.593.316 56.344.875A668.052 668.052 0 0 1 312 200h68l-1.617-8.078A1921.006 1921.006 0 0 0 256 188zm0 172a959.11 959.11 0 0 0-88.402 4.102 244.768 244.768 0 0 1-7.59 16.832C191.762 377.684 223.793 376 256 376c32.207 0 64.238 1.683 95.992 4.934a244.776 244.776 0 0 1-7.59-16.832A959.11 959.11 0 0 0 256 360zm0 32a959.261 959.261 0 0 0-105.34 5.824c-5.473 8.99-11.64 17.753-18.66 26.176-33.126 4.23-50 8-50 8l-2.223 8.898A927.82 927.82 0 0 1 256 424a927.82 927.82 0 0 1 176.223 16.898L430 432s-15.625-3.702-50-8c-7.02-8.423-13.187-17.185-18.66-26.176A959.261 959.261 0 0 0 256 392z" color="#000"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><g transform="matrix(2 0 0 2 -2048 0)"><ellipse cx="1152" cy="44" rx="28" ry="24" fill="#fff" stroke="#000" stroke-width="8" stroke-linecap="square"/><ellipse ry="50" rx="68.172" cy="98" cx="1151.828" fill="#fff" stroke="#000" stroke-width="8" stroke-linecap="square"/><path d="M1239 216l5 20h-184l5-20s10.619-2.74 30.823-5c-.191-43.527-14.06-91.42-31.823-123 16 12 44 20 60 36 8-24 20-32 28-52 8 20 20 28 28 52 16-16 44-24 60-36-17.764 31.58-31.632 79.473-31.823 123 20.204 2.26 30.823 5 30.823 5z" fill="#fff" stroke="#000" stroke-width="8" stroke-miterlimit="8"/><path d="M1152 180c-19.482 0-38.842 1.19-57.984 3.52.325 2.653.61 5.306.85 7.955A472.044 472.044 0 0 1 1152 188a471.96 471.96 0 0 1 57.135 3.475c.24-2.65.524-5.302.85-7.955A480.046 480.046 0 0 0 1152 180zm0 16a480.037 480.037 0 0 0-56.549 3.35c.225 3.908.354 7.796.371 11.65-20.204 2.259-30.822 5-30.822 5l-1.113 4.45A463.91 463.91 0 0 1 1152 212a463.91 463.91 0 0 1 88.113 8.45L1239 216s-10.618-2.741-30.822-5c.017-3.854.146-7.742.37-11.65A480.037 480.037 0 0 0 1152 196z" color="#000"/></g></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M110 40l10 96h30l-18 288c-33.126 4.23-50 8-50 8l-10 40h368l-10-40s-15.625-3.702-50-8l-18-288h30l8-96h-61l-3 40h-49l1-40h-64l1 40h-49l-2-40z" fill="#fff" stroke="#000" stroke-width="16"/><path d="M256 123.996c-45.775 0-91.378 1.665-136.738 4.902L120 136h30l-1.441 23.09c35.683-2.033 71.507-3.094 107.441-3.094s71.758 1.061 107.441 3.094L362 136h30l.594-7.113c-45.313-3.23-90.868-4.89-136.594-4.89zM256 360a960.01 960.01 0 0 0-120.477 7.598l-1.015 16.27A944.064 944.064 0 0 1 256 376c40.848 0 81.42 2.668 121.492 7.867l-1.015-16.27A960.064 960.064 0 0 0 256 360zm0 32c-41.18 0-82.085 2.662-122.492 7.86L132 424c-33.126 4.23-50 8-50 8l-2.227 8.898A927.821 927.821 0 0 1 256 424a927.84 927.84 0 0 1 176.227 16.898L430 432s-15.625-3.702-50-8l-1.508-24.14A960.006 960.006 0 0 0 256 392z" color="#000"/></svg>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -188,7 +188,7 @@ func (w *svgWriter) writeDefs(g chess.Game, rowSize int, rowSizeStr, lightRGBASt
w.write(slash)
w.write(bracket)
seen := make(map[chess.Piece]bool)
pieceStyle := pieceVectors[merida]
pieceStyle := pieceVectors[defaultStyle]
pieceScaleStr := []byte(fmt.Sprintf("scale(%f)", float64(rowSize)/512))
var p chess.Piece
for s := chess.First; s <= chess.Last; s++ {
......
......@@ -59,8 +59,10 @@ type pieceImageCache map[style]map[chess.Piece]map[size]image.Image
type pieceVectorCache map[style]map[chess.Piece][]byte
const (
firaSans font = "Fira Sans"
merida style = "merida"
firaSans font = "Fira Sans"
merida style = "merida"
lasker style = "lasker"
defaultStyle style = lasker
)
const (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment