Skip to content

Commit 2429915

Browse files
committed
fix: Minimum font size makes text labels very big #78
close #78
1 parent a73fa60 commit 2429915

7 files changed

+90
-75
lines changed

src/analog-joystick-element.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,8 @@ export class AnalogJoystickElement extends LitElement {
123123
d="M1.3 0v31.7h25.5V0zm2.33.683a1.87 1.87 0 01.009 0 1.87 1.87 0 011.87 1.87 1.87 1.87 0 01-1.87 1.87 1.87 1.87 0 01-1.87-1.87 1.87 1.87 0 011.87-1.87zm20.5 0a1.87 1.87 0 01.009 0 1.87 1.87 0 011.87 1.87 1.87 1.87 0 01-1.87 1.87 1.87 1.87 0 01-1.87-1.87 1.87 1.87 0 011.87-1.87zm-20.5 26.8a1.87 1.87 0 01.009 0 1.87 1.87 0 011.87 1.87 1.87 1.87 0 01-1.87 1.87 1.87 1.87 0 01-1.87-1.87 1.87 1.87 0 011.87-1.87zm20.4 0a1.87 1.87 0 01.009 0 1.87 1.87 0 011.87 1.87 1.87 1.87 0 01-1.87 1.87 1.87 1.87 0 01-1.87-1.87 1.87 1.87 0 011.87-1.87zm-12.7 2.66a.489.489 0 01.004 0 .489.489 0 01.489.489.489.489 0 01-.489.489.489.489 0 01-.489-.489.489.489 0 01.485-.489zm2.57 0a.489.489 0 01.004 0 .489.489 0 01.489.489.489.489 0 01-.489.489.489.489 0 01-.489-.489.489.489 0 01.485-.489zm2.49.013a.489.489 0 01.004 0 .489.489 0 01.489.489.489.489 0 01-.489.489.489.489 0 01-.489-.489.489.489 0 01.485-.489zm-7.62.007a.489.489 0 01.004 0 .489.489 0 01.489.489.489.489 0 01-.489.489.489.489 0 01-.489-.49.489.489 0 01.485-.488zm10.2.013a.489.489 0 01.004 0 .489.489 0 01.489.489.489.489 0 01-.489.489.489.489 0 01-.489-.49.489.489 0 01.485-.488z"
124124
fill="#bd1e34"
125125
/>
126-
<g
127-
fill="#fff"
128-
font-family="sans-serif"
129-
text-anchor="middle"
130-
stroke-width=".03"
131-
font-size="1.2"
132-
>
133-
<text letter-spacing=".053">
126+
<g fill="#fff" font-family="sans-serif" stroke-width=".03">
127+
<text text-anchor="middle" font-size="1.2" letter-spacing=".053">
134128
<tspan x="4.034" y="25.643">Analog</tspan>
135129
<tspan x="4.061" y="27.159">Joystick</tspan>
136130
</text>

src/arduino-mega-element.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { customElement, html, LitElement, property, svg } from 'lit-element';
1+
import { css, customElement, html, LitElement, property, svg } from 'lit-element';
22
import { pinsFemalePattern } from './patterns/pins-female';
33
import { analog, ElementPin, i2c, spi, usart } from './pin';
44

@@ -99,6 +99,15 @@ export class ArduinoMegaElement extends LitElement {
9999
{ name: 'A15', x: 357.75, y: 184.5, signals: [analog(15)] },
100100
];
101101

102+
static get styles() {
103+
return css`
104+
text {
105+
font-size: 2px;
106+
font-family: monospace;
107+
}
108+
`;
109+
}
110+
102111
render() {
103112
const { ledPower, led13, ledRX, ledTX } = this;
104113
return html`
@@ -107,7 +116,6 @@ export class ArduinoMegaElement extends LitElement {
107116
height="50.80mm"
108117
version="1.1"
109118
viewBox="-4 0 102.66 50.80"
110-
style="font-size: 2px; font-family: monospace"
111119
xmlns="http://www.w3.org/2000/svg"
112120
>
113121
<defs>

src/arduino-nano-element.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { customElement, html, LitElement, property, svg, query } from 'lit-element';
1+
import { customElement, html, LitElement, property, svg, query, css } from 'lit-element';
22
import { analog, ElementPin, i2c, spi, usart } from './pin';
33
import { SPACE_KEYS } from './utils/keys';
44

@@ -50,26 +50,29 @@ export class ArduinoNanoElement extends LitElement {
5050
{ name: 'GND.3', x: 154.1, y: 24, signals: [{ type: 'power', signal: 'GND' }] },
5151
];
5252

53+
static get styles() {
54+
return css`
55+
text {
56+
font-size: 1px;
57+
font-family: monospace;
58+
user-select: none;
59+
}
60+
61+
circle[tabindex]:hover,
62+
circle[tabindex]:focus {
63+
stroke: white;
64+
outline: none;
65+
}
66+
`;
67+
}
68+
5369
render() {
5470
const { ledPower, led13, ledRX, ledTX } = this;
5571
return html`
56-
<style>
57-
text {
58-
user-select: none;
59-
}
60-
circle[tabindex]:hover,
61-
circle[tabindex]:focus {
62-
stroke: white;
63-
outline: none;
64-
}
65-
</style>
66-
6772
<svg
6873
width="44.9mm"
6974
height="17.8mm"
7075
viewBox="-1.4 0 44.9 17.8"
71-
font-size="1px"
72-
font-family="DejaVu Mono, Cascadia Mono, monospace"
7376
font-weight="bold"
7477
version="1.1"
7578
xmlns="http://www.w3.org/2000/svg"

src/arduino-uno-element.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { customElement, html, LitElement, property, svg } from 'lit-element';
1+
import { css, customElement, html, LitElement, property, svg } from 'lit-element';
22
import { pinsFemalePattern } from './patterns/pins-female';
33
import { analog, ElementPin, i2c, spi, usart } from './pin';
44

@@ -43,6 +43,16 @@ export class ArduinoUnoElement extends LitElement {
4343
{ name: 'A5', x: 255.5, y: 191.5, signals: [analog(5), i2c('SCL')] },
4444
];
4545

46+
static get styles() {
47+
return css`
48+
text {
49+
font-size: 2px;
50+
font-family: monospace;
51+
user-select: none;
52+
}
53+
`;
54+
}
55+
4656
render() {
4757
const { ledPower, led13, ledRX, ledTX } = this;
4858
return html`
@@ -51,7 +61,6 @@ export class ArduinoUnoElement extends LitElement {
5161
height="53.34mm"
5262
version="1.1"
5363
viewBox="-4 0 72.58 53.34"
54-
style="font-size: 2px; font-family: monospace"
5564
xmlns="http://www.w3.org/2000/svg"
5665
>
5766
<defs>

src/ir-receiver-element.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ export class IRReceiverElement extends LitElement {
4949
d="m41.6 62.5c0-0.377-0.15-0.739-0.417-1.01s-0.629-0.417-1.01-0.417c-0.377 0-0.739 0.15-1.01 0.417s-0.417 0.629-0.417 1.01v25.8c0 0.231 0.188 0.419 0.419 0.419h2.01c0.231 0 0.419-0.188 0.419-0.419v-25.8z"
5050
/>
5151
</g>
52-
<g transform="rotate(90)" fill="#ffffff" font-size="5px">
53-
<text x="45.369" y="-37.601">DAT</text>
54-
<text x="45.609" y="-28.801">VCC</text>
55-
<text x="45.359" y="-20.2">GND</text>
52+
<text transform="rotate(90)" fill="#ffffff" font-size="5px">
53+
<tspan x="45.369" y="-37.601">DAT</tspan>
54+
<tspan x="45.609" y="-28.801">VCC</tspan>
55+
<tspan x="45.359" y="-20.2">GND</tspan>
5656
<text font-size="5.71px">
5757
<tspan
5858
x="16.234 18.076 22.422 24.263 28.608 32.018 35.112 36.639 40.05 43.144 46.553"
@@ -61,7 +61,7 @@ export class IRReceiverElement extends LitElement {
6161
IR Reciever
6262
</tspan>
6363
</text>
64-
</g>
64+
</text>
6565
<g fill="none" stroke="#fff">
6666
<path
6767
d="m56.3 6.32c-0.654 0.514-1.48 0.82-2.37 0.82-0.895 0-1.72-0.306-2.37-0.82"

src/lcd1602-element.ts

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,13 @@ export class LCD1602Element extends LitElement {
166166
renderI2CPins() {
167167
return svg`
168168
<rect x="7.55" y="-2.5" height="2.5" width="10.16" fill="url(#pins)" transform="rotate(90)" />
169-
<text y="6.8" x="0.7" fill="white">1</text>
170-
<text y="8.9" x="2.3" fill="white">GND</text>
171-
<text y="11.4" x="2.3" fill="white">VCC</text>
172-
<text y="14" x="2.3" fill="white">SDA</text>
173-
<text y="16.6" x="2.3" fill="white">SCL</text>
169+
<text fill="white" font-size="1.5px" font-family= "monospace">
170+
<tspan y="6.8" x="0.7" fill="white">1</tspan>
171+
<tspan y="8.9" x="2.3" fill="white">GND</tspan>
172+
<tspan y="11.4" x="2.3" fill="white">VCC</tspan>
173+
<tspan y="14" x="2.3" fill="white">SDA</tspan>
174+
<tspan y="16.6" x="2.3" fill="white">SCL</tspan>
175+
</text>
174176
`;
175177
}
176178

@@ -179,24 +181,26 @@ export class LCD1602Element extends LitElement {
179181
return svg`
180182
<g transform="translate(0, ${y})">
181183
<rect x="7.55" y="1" height="2.5" width="40.64" fill="url(#pins)" />
182-
<text x="6" y="2.7" fill="white">1</text>
183-
<text x="7.2" y="0.7" fill="white">VSS</text>
184-
<text x="9.9" y="0.7" fill="white">VDD</text>
185-
<text x="12.7" y="0.7" fill="white">V0</text>
186-
<text x="15.2" y="0.7" fill="white">RS</text>
187-
<text x="17.8" y="0.7" fill="white">RW</text>
188-
<text x="20.8" y="0.7" fill="white">E</text>
189-
<text x="22.7" y="0.7" fill="white">D0</text>
190-
<text x="25.3" y="0.7" fill="white">D1</text>
191-
<text x="27.9" y="0.7" fill="white">D2</text>
192-
<text x="30.4" y="0.7" fill="white">D3</text>
193-
<text x="33" y="0.7" fill="white">D4</text>
194-
<text x="35.6" y="0.7" fill="white">D5</text>
195-
<text x="38.2" y="0.7" fill="white">D6</text>
196-
<text x="40.8" y="0.7" fill="white">D7</text>
197-
<text x="43.6" y="0.7" fill="white">A</text>
198-
<text x="46.2" y="0.7" fill="white">K</text>
199-
<text x="48" y="2.7" fill="white">16</text>
184+
<text fill="white" font-size="1.5px" font-family= "monospace">
185+
<tspan x="6" y="2.7">1</tspan>
186+
<tspan x="7.2" y="0.7">VSS</tspan>
187+
<tspan x="9.9" y="0.7">VDD</tspan>
188+
<tspan x="12.7" y="0.7">V0</tspan>
189+
<tspan x="15.2" y="0.7">RS</tspan>
190+
<tspan x="17.8" y="0.7">RW</tspan>
191+
<tspan x="20.8" y="0.7">E</tspan>
192+
<tspan x="22.7" y="0.7">D0</tspan>
193+
<tspan x="25.3" y="0.7">D1</tspan>
194+
<tspan x="27.9" y="0.7">D2</tspan>
195+
<tspan x="30.4" y="0.7">D3</tspan>
196+
<tspan x="33" y="0.7">D4</tspan>
197+
<tspan x="35.6" y="0.7">D5</tspan>
198+
<tspan x="38.2" y="0.7">D6</tspan>
199+
<tspan x="40.8" y="0.7">D7</tspan>
200+
<tspan x="43.6" y="0.7">A</tspan>
201+
<tspan x="46.2" y="0.7">K</tspan>
202+
<tspan x="48" y="2.7">16</tspan>
203+
</text>
200204
</g>
201205
`;
202206
}

src/ssd1306-element.ts

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -102,33 +102,30 @@ export class SSD1306Element extends LitElement {
102102
</g>
103103
104104
<!-- All texts -->
105-
<g
105+
<text
106106
fill="#FFF"
107107
text-anchor="middle"
108108
font-size="5"
109109
font-weight="300"
110-
font-family="MarkerFelt-Wide, Marker Felt, monospace"
110+
font-family="monospace"
111111
>
112-
<g transform="translate(37 3)">
113-
<text x="0" y="5">Data</text>
114-
<text x="19" y="5">SA0</text>
115-
<text x="41" y="5">CS</text>
116-
<text x="60" y="5">Vin</text>
117-
</g>
112+
<tspan x="37" y="8">Data</tspan>
113+
<tspan x="56" y="8">SA0</tspan>
114+
<tspan x="78" y="8">CS</tspan>
115+
<tspan x="97" y="8">Vin</tspan>
116+
<tspan x="41" y="23">C1k</tspan>
117+
<tspan x="53" y="23">DC</tspan>
118+
<tspan x="64" y="23">Rst</tspan>
119+
<tspan x="80" y="23">3v3</tspan>
120+
<tspan x="99" y="23">Gnd</tspan>
121+
</text>
118122
119-
<g transform="translate(41 17)">
120-
<text x="0" y="6">C1k</text>
121-
<text x="12" y="6">DC</text>
122-
<text x="23" y="6">Rst</text>
123-
<text x="39" y="6">3v3</text>
124-
<text x="58" y="6">Gnd</text>
125-
</g>
126-
<!-- Star -->
127-
<path
128-
d="M115.5 10.06l-1.59 2.974-3.453.464 2.495 2.245-.6 3.229 3.148-1.528 3.148 1.528-.6-3.23 2.495-2.244-3.453-.464-1.59-2.974z"
129-
stroke="#FFF"
130-
/>
131-
</g>
123+
<!-- Star -->
124+
<path
125+
fill="#FFF"
126+
d="M115.5 10.06l-1.59 2.974-3.453.464 2.495 2.245-.6 3.229 3.148-1.528 3.148 1.528-.6-3.23 2.495-2.244-3.453-.464-1.59-2.974z"
127+
stroke="#FFF"
128+
/>
132129
133130
<!-- PINS -->
134131
<g transform="translate(33 9)" fill="#9D9D9A" stroke-width="0.4">

0 commit comments

Comments
 (0)