@jjlmoya/utils-tools 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/src/category/i18n/de.ts +172 -0
- package/src/category/i18n/id.ts +172 -0
- package/src/category/i18n/it.ts +172 -0
- package/src/category/i18n/ja.ts +172 -0
- package/src/category/i18n/ko.ts +172 -0
- package/src/category/i18n/nl.ts +172 -0
- package/src/category/i18n/pl.ts +172 -0
- package/src/category/i18n/pt.ts +172 -0
- package/src/category/i18n/ru.ts +172 -0
- package/src/category/i18n/sv.ts +172 -0
- package/src/category/i18n/tr.ts +172 -0
- package/src/category/i18n/zh.ts +172 -0
- package/src/category/index.ts +13 -1
- package/src/tests/i18n_coverage.test.ts +36 -0
- package/src/tests/locale_completeness.test.ts +1 -1
- package/src/tests/slug_uniqueness.test.ts +81 -0
- package/src/tests/title_quality.test.ts +0 -1
- package/src/tool/date-diff-calculator/i18n/de.ts +132 -0
- package/src/tool/date-diff-calculator/i18n/fr.ts +1 -1
- package/src/tool/date-diff-calculator/i18n/id.ts +132 -0
- package/src/tool/date-diff-calculator/i18n/it.ts +132 -0
- package/src/tool/date-diff-calculator/i18n/ja.ts +132 -0
- package/src/tool/date-diff-calculator/i18n/ko.ts +132 -0
- package/src/tool/date-diff-calculator/i18n/nl.ts +132 -0
- package/src/tool/date-diff-calculator/i18n/pl.ts +132 -0
- package/src/tool/date-diff-calculator/i18n/pt.ts +132 -0
- package/src/tool/date-diff-calculator/i18n/ru.ts +132 -0
- package/src/tool/date-diff-calculator/i18n/sv.ts +132 -0
- package/src/tool/date-diff-calculator/i18n/tr.ts +132 -0
- package/src/tool/date-diff-calculator/i18n/zh.ts +132 -0
- package/src/tool/date-diff-calculator/index.ts +12 -0
- package/src/tool/drive-direct-link/i18n/de.ts +118 -0
- package/src/tool/drive-direct-link/i18n/id.ts +118 -0
- package/src/tool/drive-direct-link/i18n/it.ts +118 -0
- package/src/tool/drive-direct-link/i18n/ja.ts +118 -0
- package/src/tool/drive-direct-link/i18n/ko.ts +118 -0
- package/src/tool/drive-direct-link/i18n/nl.ts +118 -0
- package/src/tool/drive-direct-link/i18n/pl.ts +118 -0
- package/src/tool/drive-direct-link/i18n/pt.ts +118 -0
- package/src/tool/drive-direct-link/i18n/ru.ts +118 -0
- package/src/tool/drive-direct-link/i18n/sv.ts +118 -0
- package/src/tool/drive-direct-link/i18n/tr.ts +118 -0
- package/src/tool/drive-direct-link/i18n/zh.ts +118 -0
- package/src/tool/drive-direct-link/index.ts +12 -0
- package/src/tool/email-list-cleaner/i18n/de.ts +140 -0
- package/src/tool/email-list-cleaner/i18n/es.ts +1 -1
- package/src/tool/email-list-cleaner/i18n/fr.ts +1 -1
- package/src/tool/email-list-cleaner/i18n/id.ts +140 -0
- package/src/tool/email-list-cleaner/i18n/it.ts +140 -0
- package/src/tool/email-list-cleaner/i18n/ja.ts +140 -0
- package/src/tool/email-list-cleaner/i18n/ko.ts +140 -0
- package/src/tool/email-list-cleaner/i18n/nl.ts +140 -0
- package/src/tool/email-list-cleaner/i18n/pl.ts +140 -0
- package/src/tool/email-list-cleaner/i18n/pt.ts +140 -0
- package/src/tool/email-list-cleaner/i18n/ru.ts +140 -0
- package/src/tool/email-list-cleaner/i18n/sv.ts +140 -0
- package/src/tool/email-list-cleaner/i18n/tr.ts +140 -0
- package/src/tool/email-list-cleaner/i18n/zh.ts +140 -0
- package/src/tool/email-list-cleaner/index.ts +12 -0
- package/src/tool/env-badge-spain/i18n/de.ts +153 -0
- package/src/tool/env-badge-spain/i18n/es.ts +1 -1
- package/src/tool/env-badge-spain/i18n/fr.ts +1 -1
- package/src/tool/env-badge-spain/i18n/id.ts +153 -0
- package/src/tool/env-badge-spain/i18n/it.ts +153 -0
- package/src/tool/env-badge-spain/i18n/ja.ts +153 -0
- package/src/tool/env-badge-spain/i18n/ko.ts +153 -0
- package/src/tool/env-badge-spain/i18n/nl.ts +153 -0
- package/src/tool/env-badge-spain/i18n/pl.ts +153 -0
- package/src/tool/env-badge-spain/i18n/pt.ts +153 -0
- package/src/tool/env-badge-spain/i18n/ru.ts +153 -0
- package/src/tool/env-badge-spain/i18n/sv.ts +153 -0
- package/src/tool/env-badge-spain/i18n/tr.ts +153 -0
- package/src/tool/env-badge-spain/i18n/zh.ts +153 -0
- package/src/tool/env-badge-spain/index.ts +12 -0
- package/src/tool/morse-beacon/i18n/de.ts +157 -0
- package/src/tool/morse-beacon/i18n/es.ts +1 -1
- package/src/tool/morse-beacon/i18n/id.ts +157 -0
- package/src/tool/morse-beacon/i18n/it.ts +157 -0
- package/src/tool/morse-beacon/i18n/ja.ts +157 -0
- package/src/tool/morse-beacon/i18n/ko.ts +157 -0
- package/src/tool/morse-beacon/i18n/nl.ts +157 -0
- package/src/tool/morse-beacon/i18n/pl.ts +157 -0
- package/src/tool/morse-beacon/i18n/pt.ts +157 -0
- package/src/tool/morse-beacon/i18n/ru.ts +157 -0
- package/src/tool/morse-beacon/i18n/sv.ts +157 -0
- package/src/tool/morse-beacon/i18n/tr.ts +157 -0
- package/src/tool/morse-beacon/i18n/zh.ts +157 -0
- package/src/tool/morse-beacon/index.ts +13 -1
- package/src/tool/password-generator/i18n/de.ts +166 -0
- package/src/tool/password-generator/i18n/fr.ts +1 -1
- package/src/tool/password-generator/i18n/id.ts +166 -0
- package/src/tool/password-generator/i18n/it.ts +166 -0
- package/src/tool/password-generator/i18n/ja.ts +166 -0
- package/src/tool/password-generator/i18n/ko.ts +166 -0
- package/src/tool/password-generator/i18n/nl.ts +166 -0
- package/src/tool/password-generator/i18n/pl.ts +166 -0
- package/src/tool/password-generator/i18n/pt.ts +166 -0
- package/src/tool/password-generator/i18n/ru.ts +166 -0
- package/src/tool/password-generator/i18n/sv.ts +166 -0
- package/src/tool/password-generator/i18n/tr.ts +166 -0
- package/src/tool/password-generator/i18n/zh.ts +166 -0
- package/src/tool/password-generator/index.ts +13 -1
- package/src/tool/routes/i18n/de.ts +157 -0
- package/src/tool/routes/i18n/es.ts +1 -1
- package/src/tool/routes/i18n/id.ts +157 -0
- package/src/tool/routes/i18n/it.ts +157 -0
- package/src/tool/routes/i18n/ja.ts +157 -0
- package/src/tool/routes/i18n/ko.ts +157 -0
- package/src/tool/routes/i18n/nl.ts +157 -0
- package/src/tool/routes/i18n/pl.ts +157 -0
- package/src/tool/routes/i18n/pt.ts +157 -0
- package/src/tool/routes/i18n/ru.ts +157 -0
- package/src/tool/routes/i18n/sv.ts +157 -0
- package/src/tool/routes/i18n/tr.ts +157 -0
- package/src/tool/routes/i18n/zh.ts +157 -0
- package/src/tool/routes/index.ts +13 -1
- package/src/tool/rule-of-three/i18n/de.ts +171 -0
- package/src/tool/rule-of-three/i18n/en.ts +1 -1
- package/src/tool/rule-of-three/i18n/id.ts +171 -0
- package/src/tool/rule-of-three/i18n/it.ts +171 -0
- package/src/tool/rule-of-three/i18n/ja.ts +171 -0
- package/src/tool/rule-of-three/i18n/ko.ts +171 -0
- package/src/tool/rule-of-three/i18n/nl.ts +171 -0
- package/src/tool/rule-of-three/i18n/pl.ts +171 -0
- package/src/tool/rule-of-three/i18n/pt.ts +171 -0
- package/src/tool/rule-of-three/i18n/ru.ts +171 -0
- package/src/tool/rule-of-three/i18n/sv.ts +171 -0
- package/src/tool/rule-of-three/i18n/tr.ts +171 -0
- package/src/tool/rule-of-three/i18n/zh.ts +171 -0
- package/src/tool/rule-of-three/index.ts +13 -1
- package/src/tool/seo-content-optimizer/i18n/de.ts +136 -0
- package/src/tool/seo-content-optimizer/i18n/id.ts +136 -0
- package/src/tool/seo-content-optimizer/i18n/it.ts +136 -0
- package/src/tool/seo-content-optimizer/i18n/ja.ts +136 -0
- package/src/tool/seo-content-optimizer/i18n/ko.ts +136 -0
- package/src/tool/seo-content-optimizer/i18n/nl.ts +136 -0
- package/src/tool/seo-content-optimizer/i18n/pl.ts +136 -0
- package/src/tool/seo-content-optimizer/i18n/pt.ts +136 -0
- package/src/tool/seo-content-optimizer/i18n/ru.ts +136 -0
- package/src/tool/seo-content-optimizer/i18n/sv.ts +136 -0
- package/src/tool/seo-content-optimizer/i18n/tr.ts +136 -0
- package/src/tool/seo-content-optimizer/i18n/zh.ts +136 -0
- package/src/tool/seo-content-optimizer/index.ts +12 -0
- package/src/tool/speed-reader/i18n/de.ts +152 -0
- package/src/tool/speed-reader/i18n/es.ts +1 -1
- package/src/tool/speed-reader/i18n/id.ts +152 -0
- package/src/tool/speed-reader/i18n/it.ts +152 -0
- package/src/tool/speed-reader/i18n/ja.ts +152 -0
- package/src/tool/speed-reader/i18n/ko.ts +152 -0
- package/src/tool/speed-reader/i18n/nl.ts +152 -0
- package/src/tool/speed-reader/i18n/pl.ts +152 -0
- package/src/tool/speed-reader/i18n/pt.ts +152 -0
- package/src/tool/speed-reader/i18n/ru.ts +152 -0
- package/src/tool/speed-reader/i18n/sv.ts +152 -0
- package/src/tool/speed-reader/i18n/tr.ts +152 -0
- package/src/tool/speed-reader/i18n/zh.ts +152 -0
- package/src/tool/speed-reader/index.ts +12 -0
- package/src/tool/text-pixel-calculator/i18n/de.ts +133 -0
- package/src/tool/text-pixel-calculator/i18n/id.ts +133 -0
- package/src/tool/text-pixel-calculator/i18n/it.ts +133 -0
- package/src/tool/text-pixel-calculator/i18n/ja.ts +133 -0
- package/src/tool/text-pixel-calculator/i18n/ko.ts +133 -0
- package/src/tool/text-pixel-calculator/i18n/nl.ts +133 -0
- package/src/tool/text-pixel-calculator/i18n/pl.ts +133 -0
- package/src/tool/text-pixel-calculator/i18n/pt.ts +133 -0
- package/src/tool/text-pixel-calculator/i18n/ru.ts +133 -0
- package/src/tool/text-pixel-calculator/i18n/sv.ts +133 -0
- package/src/tool/text-pixel-calculator/i18n/tr.ts +133 -0
- package/src/tool/text-pixel-calculator/i18n/zh.ts +133 -0
- package/src/tool/text-pixel-calculator/index.ts +12 -0
- package/src/tool/whatsapp-link/i18n/de.ts +128 -0
- package/src/tool/whatsapp-link/i18n/es.ts +1 -1
- package/src/tool/whatsapp-link/i18n/id.ts +128 -0
- package/src/tool/whatsapp-link/i18n/it.ts +128 -0
- package/src/tool/whatsapp-link/i18n/ja.ts +128 -0
- package/src/tool/whatsapp-link/i18n/ko.ts +128 -0
- package/src/tool/whatsapp-link/i18n/nl.ts +128 -0
- package/src/tool/whatsapp-link/i18n/pl.ts +128 -0
- package/src/tool/whatsapp-link/i18n/pt.ts +128 -0
- package/src/tool/whatsapp-link/i18n/ru.ts +128 -0
- package/src/tool/whatsapp-link/i18n/sv.ts +128 -0
- package/src/tool/whatsapp-link/i18n/tr.ts +128 -0
- package/src/tool/whatsapp-link/i18n/zh.ts +128 -0
- package/src/tool/whatsapp-link/index.ts +12 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { ToolLocaleContent } from '../../../types';
|
|
2
|
+
import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
|
|
3
|
+
import type { TextPixelCalculatorUI } from '../ui';
|
|
4
|
+
|
|
5
|
+
const faqData = [
|
|
6
|
+
{
|
|
7
|
+
question: 'Jak obliczyć szerokość tekstu w pikselach online?',
|
|
8
|
+
answer: 'Wklej tekst do pola wejściowego, skonfiguruj czcionkę i rozmiar, a narzędzie automatycznie użyje interfejsu API Canvas przeglądarki, aby zwrócić dokładną szerokość w pikselach.',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
question: 'Dlaczego szerokość w pikselach różni się między krojami pisma?',
|
|
12
|
+
answer: 'Większość czcionek jest proporcjonalna, co oznacza, że każdy znak ma inną szerokość. Na przykład wielka litera „M” jest zawsze szersza niż mała litera „i” w standardowej czcionce bezszeryfowej.',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
question: 'Czy mierzenie znaków to to samo co mierzenie pikseli?',
|
|
16
|
+
answer: 'Nie. Mierzenie znaków podaje długość ciągu, natomiast mierzenie pikseli podaje przestrzeń wizualną, jaką on zajmuje. Jest to kluczowe dla upewnienia się, że tekst nie wystaje poza swój kontener w projekcie internetowym.',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
question: 'Czy mogę użyć dowolnego kroju pisma z Google Fonts?',
|
|
20
|
+
answer: 'Tak, o ile czcionka jest zainstalowana w systemie operacyjnym lub załadowana na bieżącej stronie, narzędzie dokładnie zmierzy jej wymiary.',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
question: 'Czy przetwarzanie prywatnego tekstu lub fragmentów kodu jest bezpieczne?',
|
|
24
|
+
answer: 'Tak. Kalkulator działa całkowicie lokalnie. Żadne dane nie są wysyłane do zewnętrznych serwerów, co gwarantuje pełną prywatność Twoich projektów.',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const howToData = [
|
|
29
|
+
{ name: 'Wpisz tekst', text: 'Wpisz lub wklej tekst, który chcesz zmierzyć, w obszarze wejściowym.' },
|
|
30
|
+
{ name: 'Skonfiguruj czcionkę', text: 'Ustaw rodzinę czcionek, rozmiar w pikselach, wagę i to, czy ma być pochylona.' },
|
|
31
|
+
{ name: 'Odczytaj wynik', text: 'Szerokość w pikselach i liczba znaków są aktualizowane w czasie rzeczywistym.' },
|
|
32
|
+
{ name: 'Skopiuj wartość', text: 'Kliknij „Kopiuj szerokość”, aby zapisać liczbę pikseli w schowku.' },
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
const faqSchema: WithContext<FAQPage> = {
|
|
36
|
+
'@context': 'https://schema.org',
|
|
37
|
+
'@type': 'FAQPage',
|
|
38
|
+
mainEntity: faqData.map((item) => ({
|
|
39
|
+
'@type': 'Question',
|
|
40
|
+
name: item.question,
|
|
41
|
+
acceptedAnswer: { '@type': 'Answer', text: item.answer },
|
|
42
|
+
})),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const howToSchema: WithContext<HowTo> = {
|
|
46
|
+
'@context': 'https://schema.org',
|
|
47
|
+
'@type': 'HowTo',
|
|
48
|
+
name: 'Jak zmierzyć szerokość tekstu w pikselach',
|
|
49
|
+
step: howToData.map((s) => ({ '@type': 'HowToStep', name: s.name, text: s.text })),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const appSchema: WithContext<SoftwareApplication> = {
|
|
53
|
+
'@context': 'https://schema.org',
|
|
54
|
+
'@type': 'SoftwareApplication',
|
|
55
|
+
name: 'Kalkulator szerokości pikseli tekstu',
|
|
56
|
+
applicationCategory: 'UtilitiesApplication',
|
|
57
|
+
operatingSystem: 'Web',
|
|
58
|
+
offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
|
|
59
|
+
description: 'Dokładnie oblicz szerokość dowolnego tekstu w pikselach na podstawie czcionki, rozmiaru i stylu.',
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const ui: TextPixelCalculatorUI = {
|
|
63
|
+
textLabel: 'Tekst do zmierzenia',
|
|
64
|
+
textPlaceholder: 'Wpisz lub wklej tutaj tekst, który chcesz zmierzyć...',
|
|
65
|
+
defaultText: 'Witaj świecie',
|
|
66
|
+
fontLabel: 'Rodzina czcionek',
|
|
67
|
+
sizeLabel: 'Rozmiar (px)',
|
|
68
|
+
weightLabel: 'Waga',
|
|
69
|
+
italicLabel: 'Kursywa',
|
|
70
|
+
widthLabel: 'Szerokość (piksele)',
|
|
71
|
+
charsLabel: 'Znaki',
|
|
72
|
+
previewLabel: 'Podgląd wizualny',
|
|
73
|
+
copyBtn: 'Kopiuj szerokość',
|
|
74
|
+
resetBtn: 'Resetuj',
|
|
75
|
+
copyDone: 'Szerokość skopiowana',
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const content: ToolLocaleContent<TextPixelCalculatorUI> = {
|
|
79
|
+
slug: 'kalkulator-szerokosci-pikseli-tekstu',
|
|
80
|
+
title: 'Kalkulator szerokości pikseli tekstu',
|
|
81
|
+
description: 'Dokładnie oblicz, jak szeroki jest dowolny tekst w pikselach na podstawie czcionki, rozmiaru i stylu. Darmowe narzędzie dla projektantów i programistów.',
|
|
82
|
+
ui,
|
|
83
|
+
faqTitle: 'Często zadawane pytania',
|
|
84
|
+
faq: faqData,
|
|
85
|
+
howTo: howToData,
|
|
86
|
+
bibliographyTitle: 'Źródła',
|
|
87
|
+
bibliography: [
|
|
88
|
+
{ name: 'W3C: CSS Text Module Level 3', url: 'https://www.w3.org/TR/css-text-3/' },
|
|
89
|
+
{ name: 'Google Fonts: Understanding variable fonts', url: 'https://fonts.google.com/knowledge/glossary/variable_fonts' },
|
|
90
|
+
],
|
|
91
|
+
schemas: [faqSchema, howToSchema, appSchema],
|
|
92
|
+
seo: [
|
|
93
|
+
{ type: 'title', level: 2, text: 'Zmierz dokładną szerokość dowolnego tekstu w pikselach' },
|
|
94
|
+
{
|
|
95
|
+
type: 'paragraph',
|
|
96
|
+
html: 'Czy Twój tekst wystaje poza swój kontener? Musisz wiedzieć, ile miejsca zajmuje nagłówek przed jego wyrenderowaniem? Interfejs <strong>API Canvas przeglądarki</strong> umożliwia pomiar dokładnej szerokości dowolnego ciągu tekstowego z precyzją piksela, bez renderowania go w DOM.',
|
|
97
|
+
},
|
|
98
|
+
{ type: 'title', level: 3, text: 'Dlaczego liczenie znaków nie wystarczy' },
|
|
99
|
+
{
|
|
100
|
+
type: 'paragraph',
|
|
101
|
+
html: 'Nowoczesne kroje pisma są <strong>proporcjonalne</strong>: każdy glif ma inną szerokość. Litera „W” może zajmować trzy razy więcej miejsca niż „i”. Liczba znaków nic nie mówi o rzeczywistej przestrzeni wizualnej, jaką zajmuje tekst.',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: 'list',
|
|
105
|
+
items: [
|
|
106
|
+
'<strong>Projektowanie stron www:</strong> Zapobiegaj przepełnieniu przycisków, etykiet i komórek tabel.',
|
|
107
|
+
'<strong>SEO:</strong> Wyszukiwarki ucinają tytuły według pikseli, a nie znaków.',
|
|
108
|
+
'<strong>Canvas i PDF:</strong> Oblicz dokładną pozycję przed programowym narysowaniem tekstu.',
|
|
109
|
+
'<strong>Tooltipy i dymki:</strong> Dynamicznie zmieniaj rozmiar kontenerów na podstawie tekstu wewnętrznego.',
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
{ type: 'title', level: 3, text: 'Jak działa pomiar za pomocą Canvas' },
|
|
113
|
+
{
|
|
114
|
+
type: 'paragraph',
|
|
115
|
+
html: 'Metoda <code>ctx.measureText()</code> interfejsu API Canvas zwraca obiekt <code>TextMetrics</code> z właściwością <code>width</code> odzwierciedlającą szerokość w pikselach CSS przy użyciu aktualnie aktywnej czcionki. To narzędzie konfiguruje kontekst z Twoją czcionką, rozmiarem, wagą i stylem przed pomiarem.',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: 'code',
|
|
119
|
+
ariaLabel: 'Przykład Canvas measureText',
|
|
120
|
+
code: "const ctx = document.createElement('canvas').getContext('2d');\nctx.font = '700 16px Inter, system-ui, sans-serif';\nconst width = ctx.measureText('Witaj świecie').width; // np. 74.5",
|
|
121
|
+
},
|
|
122
|
+
{ type: 'title', level: 3, text: 'Prywatność i przetwarzanie lokalne' },
|
|
123
|
+
{
|
|
124
|
+
type: 'paragraph',
|
|
125
|
+
html: 'Wszystkie obliczenia odbywają się w Twojej przeglądarce. Żaden tekst, fragment kodu ani prywatne dane nie opuszczają Twojego urządzenia.',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'tip',
|
|
129
|
+
title: 'Kroje pisma Google Fonts',
|
|
130
|
+
html: 'Aby dokładnie zmierzyć krój pisma Google Fonts, najpierw upewnij się, że jest on załadowany na stronie lub zainstalowany w systemie. W przeciwnym razie przeglądarka użyje czcionki zastępczej i wynik będzie się różnił.',
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { ToolLocaleContent } from '../../../types';
|
|
2
|
+
import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
|
|
3
|
+
import type { TextPixelCalculatorUI } from '../ui';
|
|
4
|
+
|
|
5
|
+
const faqData = [
|
|
6
|
+
{
|
|
7
|
+
question: 'Como calcular a largura em píxeis de um texto online?',
|
|
8
|
+
answer: 'Cole o seu texto na caixa de entrada, configure a fonte e o tamanho, e a ferramenta utilizará automaticamente a API Canvas do navegador para devolver a largura exata em píxeis.',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
question: 'Por que a largura em píxeis varia entre diferentes fontes?',
|
|
12
|
+
answer: "A maioria das fontes são proporcionais, o que significa que cada caráter tem uma largura diferente. Por exemplo, um 'M' maiúsculo é sempre mais largo do que um 'i' minúsculo numa fonte sans-serif padrão.",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
question: 'Medir carateres é o mesmo que medir píxeis?',
|
|
16
|
+
answer: 'Não. Medir carateres dá-lhe o comprimento da string, enquanto medir píxeis dá-lhe o espaço visual que ela ocupa. Isto é crucial para garantir que o texto não transborde do seu contentor num web design.',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
question: 'Posso usar qualquer fonte do Google Fonts?',
|
|
20
|
+
answer: 'Sim, desde que a fonte esteja instalada no seu sistema operativo ou carregada na página atual, a ferramenta medirá as suas dimensões com precisão.',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
question: 'É seguro processar textos privados ou trechos de código?',
|
|
24
|
+
answer: 'Sim. A calculadora funciona inteiramente de forma local. Nenhuns dados são enviados para servidores externos, garantindo total privacidade para os seus projetos.',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const howToData = [
|
|
29
|
+
{ name: 'Introduza o texto', text: 'Escreva ou cole o texto que deseja medir na área de entrada.' },
|
|
30
|
+
{ name: 'Configure a fonte', text: 'Defina a família da fonte, o tamanho em píxeis, o peso e se é itálico.' },
|
|
31
|
+
{ name: 'Leia o resultado', text: 'A largura em píxeis e a contagem de carateres são atualizadas em tempo real.' },
|
|
32
|
+
{ name: 'Copie o valor', text: 'Clique em "Copiar largura" para guardar o número de píxeis na área de transferência.' },
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
const faqSchema: WithContext<FAQPage> = {
|
|
36
|
+
'@context': 'https://schema.org',
|
|
37
|
+
'@type': 'FAQPage',
|
|
38
|
+
mainEntity: faqData.map((item) => ({
|
|
39
|
+
'@type': 'Question',
|
|
40
|
+
name: item.question,
|
|
41
|
+
acceptedAnswer: { '@type': 'Answer', text: item.answer },
|
|
42
|
+
})),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const howToSchema: WithContext<HowTo> = {
|
|
46
|
+
'@context': 'https://schema.org',
|
|
47
|
+
'@type': 'HowTo',
|
|
48
|
+
name: 'Como medir a largura do texto em píxeis',
|
|
49
|
+
step: howToData.map((s) => ({ '@type': 'HowToStep', name: s.name, text: s.text })),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const appSchema: WithContext<SoftwareApplication> = {
|
|
53
|
+
'@context': 'https://schema.org',
|
|
54
|
+
'@type': 'SoftwareApplication',
|
|
55
|
+
name: 'Calculadora de Largura de Píxeis de Texto',
|
|
56
|
+
applicationCategory: 'UtilitiesApplication',
|
|
57
|
+
operatingSystem: 'Web',
|
|
58
|
+
offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
|
|
59
|
+
description: 'Calcule com precisão a largura em píxeis de qualquer texto com base na fonte, tamanho e estilo.',
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const ui: TextPixelCalculatorUI = {
|
|
63
|
+
textLabel: 'Texto a medir',
|
|
64
|
+
textPlaceholder: 'Escreva ou cole aqui o texto que deseja medir...',
|
|
65
|
+
defaultText: 'Olá Mundo',
|
|
66
|
+
fontLabel: 'Família da fonte',
|
|
67
|
+
sizeLabel: 'Tamanho (px)',
|
|
68
|
+
weightLabel: 'Peso',
|
|
69
|
+
italicLabel: 'Itálico',
|
|
70
|
+
widthLabel: 'Largura (píxeis)',
|
|
71
|
+
charsLabel: 'Carateres',
|
|
72
|
+
previewLabel: 'Pré-visualização visual',
|
|
73
|
+
copyBtn: 'Copiar largura',
|
|
74
|
+
resetBtn: 'Repor',
|
|
75
|
+
copyDone: 'Largura copiada',
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const content: ToolLocaleContent<TextPixelCalculatorUI> = {
|
|
79
|
+
slug: 'calculadora-largura-pixel-texto',
|
|
80
|
+
title: 'Calculadora de Largura de Píxeis de Texto',
|
|
81
|
+
description: 'Calcule com precisão a largura de qualquer texto em píxeis com base na fonte, tamanho e estilo. Ferramenta gratuita para designers e programadores.',
|
|
82
|
+
ui,
|
|
83
|
+
faqTitle: 'Perguntas Frequentes',
|
|
84
|
+
faq: faqData,
|
|
85
|
+
howTo: howToData,
|
|
86
|
+
bibliographyTitle: 'Referências',
|
|
87
|
+
bibliography: [
|
|
88
|
+
{ name: 'W3C: CSS Text Module Level 3', url: 'https://www.w3.org/TR/css-text-3/' },
|
|
89
|
+
{ name: 'Google Fonts: Understanding variable fonts', url: 'https://fonts.google.com/knowledge/glossary/variable_fonts' },
|
|
90
|
+
],
|
|
91
|
+
schemas: [faqSchema, howToSchema, appSchema],
|
|
92
|
+
seo: [
|
|
93
|
+
{ type: 'title', level: 2, text: 'Meça a largura exata em píxeis de qualquer texto' },
|
|
94
|
+
{
|
|
95
|
+
type: 'paragraph',
|
|
96
|
+
html: 'O seu texto está a transbordar do contentor? Precisa de saber quanto espaço um título ocupa antes de o renderizar? A <strong>API Canvas do navegador</strong> permite-lhe medir a largura exata de qualquer string de texto com precisão de píxeis, sem a renderizar no DOM.',
|
|
97
|
+
},
|
|
98
|
+
{ type: 'title', level: 3, text: 'Por que a contagem de carateres não é suficiente' },
|
|
99
|
+
{
|
|
100
|
+
type: 'paragraph',
|
|
101
|
+
html: 'As fontes modernas são <strong>proporcionais</strong>: cada glifo tem uma largura diferente. Um "W" pode ocupar três vezes mais espaço do que um "i". O número de carateres não diz nada sobre o espaço visual real que o texto ocupa.',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: 'list',
|
|
105
|
+
items: [
|
|
106
|
+
'<strong>Web design:</strong> Previna o transbordo em botões, etiquetas e células de tabela.',
|
|
107
|
+
'<strong>SEO:</strong> Os motores de busca truncam títulos por píxeis, não por carateres.',
|
|
108
|
+
'<strong>Canvas e PDF:</strong> Calcule a posição exata antes de desenhar o texto programaticamente.',
|
|
109
|
+
'<strong>Tooltips e balões:</strong> Dimensione dinamicamente os contentores com base no texto interior.',
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
{ type: 'title', level: 3, text: 'Como funciona a medição com Canvas' },
|
|
113
|
+
{
|
|
114
|
+
type: 'paragraph',
|
|
115
|
+
html: 'O método <code>ctx.measureText()</code> da API Canvas devolve um objeto <code>TextMetrics</code> com uma propriedade <code>width</code> que reflete a largura CSS em píxeis usando a fonte atualmente ativa. Esta ferramenta configura o contexto com a sua fonte, tamanho, peso e estilo antes de medir.',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: 'code',
|
|
119
|
+
ariaLabel: 'Exemplo de Canvas measureText',
|
|
120
|
+
code: "const ctx = document.createElement('canvas').getContext('2d');\nctx.font = '700 16px Inter, system-ui, sans-serif';\nconst width = ctx.measureText('Olá Mundo').width; // ex: 74.5",
|
|
121
|
+
},
|
|
122
|
+
{ type: 'title', level: 3, text: 'Privacidade e processamento local' },
|
|
123
|
+
{
|
|
124
|
+
type: 'paragraph',
|
|
125
|
+
html: 'Todo o cálculo acontece no seu navegador. Nenhuns textos, trechos de código ou dados privados saem do seu dispositivo.',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'tip',
|
|
129
|
+
title: 'Fontes do Google Fonts',
|
|
130
|
+
html: 'Para medir uma fonte do Google Fonts com precisão, certifique-se primeiro de que ela está carregada na página ou instalada no seu sistema. Caso contrário, o navegador recorrerá a uma fonte substituta e o resultado será diferente.',
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { ToolLocaleContent } from '../../../types';
|
|
2
|
+
import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
|
|
3
|
+
import type { TextPixelCalculatorUI } from '../ui';
|
|
4
|
+
|
|
5
|
+
const faqData = [
|
|
6
|
+
{
|
|
7
|
+
question: 'Как рассчитать ширину текста в пикселях онлайн?',
|
|
8
|
+
answer: 'Вставьте текст в поле ввода, настройте шрифт и размер, и инструмент автоматически использует Canvas API браузера, чтобы вернуть точную ширину в пикселях.',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
question: 'Почему ширина в пикселях различается у разных шрифтов?',
|
|
12
|
+
answer: 'Большинство шрифтов являются пропорциональными, что означает, что каждый символ имеет разную ширину. Например, заглавная буква «M» всегда шире строчной «i» в стандартном шрифте без засечек.',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
question: 'Равна ли длина в символах ширине в пикселях?',
|
|
16
|
+
answer: 'Нет. Количество символов дает вам длину строки, а измерение в пикселях — визуальное пространство, которое она занимает. Это крайне важно для предотвращения переполнения контейнера текстом в веб-дизайне.',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
question: 'Могу ли я использовать любой шрифт Google Fonts?',
|
|
20
|
+
answer: 'Да, если шрифт установлен в вашей операционной системе или загружен на текущей странице, инструмент точно измерит его размеры.',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
question: 'Безопасно ли обрабатывать личный текст или фрагменты кода?',
|
|
24
|
+
answer: 'Да. Калькулятор работает полностью локально. Данные не отправляются на внешние серверы, что гарантирует полную конфиденциальность ваших проектов.',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const howToData = [
|
|
29
|
+
{ name: 'Введите текст', text: 'Введите или вставьте текст, который вы хотите измерить, в поле ввода.' },
|
|
30
|
+
{ name: 'Настройте шрифт', text: 'Укажите семейство шрифтов, размер в пикселях, насыщенность и начертание (курсив).' },
|
|
31
|
+
{ name: 'Получите результат', text: 'Ширина в пикселях и количество символов обновляются в режиме реального времени.' },
|
|
32
|
+
{ name: 'Скопируйте значение', text: 'Нажмите «Копировать ширину», чтобы сохранить количество пикселей в буфер обмена.' },
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
const faqSchema: WithContext<FAQPage> = {
|
|
36
|
+
'@context': 'https://schema.org',
|
|
37
|
+
'@type': 'FAQPage',
|
|
38
|
+
mainEntity: faqData.map((item) => ({
|
|
39
|
+
'@type': 'Question',
|
|
40
|
+
name: item.question,
|
|
41
|
+
acceptedAnswer: { '@type': 'Answer', text: item.answer },
|
|
42
|
+
})),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const howToSchema: WithContext<HowTo> = {
|
|
46
|
+
'@context': 'https://schema.org',
|
|
47
|
+
'@type': 'HowTo',
|
|
48
|
+
name: 'Как измерить ширину текста в пикселях',
|
|
49
|
+
step: howToData.map((s) => ({ '@type': 'HowToStep', name: s.name, text: s.text })),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const appSchema: WithContext<SoftwareApplication> = {
|
|
53
|
+
'@context': 'https://schema.org',
|
|
54
|
+
'@type': 'SoftwareApplication',
|
|
55
|
+
name: 'Калькулятор ширины текста в пикселях',
|
|
56
|
+
applicationCategory: 'UtilitiesApplication',
|
|
57
|
+
operatingSystem: 'Web',
|
|
58
|
+
offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
|
|
59
|
+
description: 'Точно рассчитайте ширину любого текста в пикселях на основе шрифта, размера и стиля.',
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const ui: TextPixelCalculatorUI = {
|
|
63
|
+
textLabel: 'Текст для измерения',
|
|
64
|
+
textPlaceholder: 'Введите или вставьте здесь текст, который хотите измерить...',
|
|
65
|
+
defaultText: 'Привет, мир',
|
|
66
|
+
fontLabel: 'Семейство шрифтов',
|
|
67
|
+
sizeLabel: 'Размер (px)',
|
|
68
|
+
weightLabel: 'Насыщенность',
|
|
69
|
+
italicLabel: 'Курсив',
|
|
70
|
+
widthLabel: 'Ширина (пиксели)',
|
|
71
|
+
charsLabel: 'Символы',
|
|
72
|
+
previewLabel: 'Визуальный просмотр',
|
|
73
|
+
copyBtn: 'Копировать ширину',
|
|
74
|
+
resetBtn: 'Сброс',
|
|
75
|
+
copyDone: 'Ширина скопирована',
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const content: ToolLocaleContent<TextPixelCalculatorUI> = {
|
|
79
|
+
slug: 'kalkulyator-shiriny-pikseley-teksta',
|
|
80
|
+
title: 'Калькулятор ширины текста в пикселях',
|
|
81
|
+
description: 'Точно рассчитайте ширину любого текста в пикселях на основе шрифта, размера и стиля. Бесплатный инструмент для дизайнеров и разработчиков.',
|
|
82
|
+
ui,
|
|
83
|
+
faqTitle: 'Часто задаваемые вопросы',
|
|
84
|
+
faq: faqData,
|
|
85
|
+
howTo: howToData,
|
|
86
|
+
bibliographyTitle: 'Источники',
|
|
87
|
+
bibliography: [
|
|
88
|
+
{ name: 'W3C: CSS Text Module Level 3', url: 'https://www.w3.org/TR/css-text-3/' },
|
|
89
|
+
{ name: 'Google Fonts: Understanding variable fonts', url: 'https://fonts.google.com/knowledge/glossary/variable_fonts' },
|
|
90
|
+
],
|
|
91
|
+
schemas: [faqSchema, howToSchema, appSchema],
|
|
92
|
+
seo: [
|
|
93
|
+
{ type: 'title', level: 2, text: 'Измерьте точную ширину любого текста в пикселях' },
|
|
94
|
+
{
|
|
95
|
+
type: 'paragraph',
|
|
96
|
+
html: 'Ваш текст выходит за пределы контейнера? Нужно узнать, сколько места занимает заголовок перед рендерингом? <strong>Canvas API браузера</strong> позволяет измерить точную ширину любой текстовой строки с пиксельной точностью без ее отрисовки в DOM.',
|
|
97
|
+
},
|
|
98
|
+
{ type: 'title', level: 3, text: 'Почему подсчета символов недостаточно' },
|
|
99
|
+
{
|
|
100
|
+
type: 'paragraph',
|
|
101
|
+
html: 'Современные шрифты являются <strong>пропорциональными</strong>: каждый глиф имеет разную ширину. Буква «W» может занимать в три раза больше места, чем «i». Количество символов ничего не говорит вам о фактическом визуальном пространстве, которое занимает текст.',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: 'list',
|
|
105
|
+
items: [
|
|
106
|
+
'<strong>Веб-дизайн:</strong> предотвращайте переполнение в кнопках, метках и ячейках таблиц.',
|
|
107
|
+
'<strong>SEO:</strong> поисковые системы обрезают заголовки по пикселям, а не по символам.',
|
|
108
|
+
'<strong>Canvas и PDF:</strong> рассчитывайте точное положение перед программной отрисовкой текста.',
|
|
109
|
+
'<strong>Подсказки и баблы:</strong> динамически устанавливайте размер контейнеров на основе текста внутри.',
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
{ type: 'title', level: 3, text: 'Как работает измерение с помощью Canvas' },
|
|
113
|
+
{
|
|
114
|
+
type: 'paragraph',
|
|
115
|
+
html: 'Метод <code>ctx.measureText()</code> интерфейса Canvas API возвращает объект <code>TextMetrics</code> со свойством <code>width</code>, отражающим ширину в CSS-пикселях с использованием текущего активного шрифта. Этот инструмент настраивает контекст с вашим шрифтом, размером, насыщенностью и стилем перед измерением.',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: 'code',
|
|
119
|
+
ariaLabel: 'Пример использования Canvas measureText',
|
|
120
|
+
code: "const ctx = document.createElement('canvas').getContext('2d');\nctx.font = '700 16px Inter, system-ui, sans-serif';\nconst width = ctx.measureText('Привет, мир').width; // например, 74.5",
|
|
121
|
+
},
|
|
122
|
+
{ type: 'title', level: 3, text: 'Конфиденциальность и локальная обработка' },
|
|
123
|
+
{
|
|
124
|
+
type: 'paragraph',
|
|
125
|
+
html: 'Все вычисления происходят в вашем браузере. Никакой текст, фрагмент кода или личные данные не покидают ваше устройство.',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'tip',
|
|
129
|
+
title: 'Шрифты Google Fonts',
|
|
130
|
+
html: 'Чтобы точно измерить шрифт Google Fonts, сначала убедитесь, что он загружен на страницу или установлен в вашей системе. В противном случае браузер вернется к подменному шрифту, и результат будет отличаться.',
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { ToolLocaleContent } from '../../../types';
|
|
2
|
+
import type { WithContext, FAQPage, HowTo, SoftwareApplication } from 'schema-dts';
|
|
3
|
+
import type { TextPixelCalculatorUI } from '../ui';
|
|
4
|
+
|
|
5
|
+
const faqData = [
|
|
6
|
+
{
|
|
7
|
+
question: 'Hur beräknar jag pixelbredden för text online?',
|
|
8
|
+
answer: 'Klistra in din text i inmatningsrutan, konfigurera typsnitt och storlek, så använder verktyget automatiskt webbläsarens Canvas API för att returnera den exakta bredden i pixlar.',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
question: 'Varför varierar pixelbredden mellan olika typsnitt?',
|
|
12
|
+
answer: "De flesta typsnitt är proportionella, vilket innebär att varje tecken har en annan bredd. Till exempel är ett versalt 'M' alltid bredare än ett gement 'i' i ett vanligt sans-serif-typsnitt.",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
question: 'Är mätning av tecken detsamma som mätning av pixlar?',
|
|
16
|
+
answer: 'Nej. Mätning av tecken ger dig stränglängden, medan mätning av pixlar ger dig det visuella utrymmet den upptar. Detta är avgörande för att säkerställa att texten inte flödar över sin behållare i en webbdesign.',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
question: 'Kan jag använda vilket Google Fonts-typsnitt som helst?',
|
|
20
|
+
answer: 'Ja, så länge typsnittet är installerat på ditt operativsystem eller laddat på den aktuella sidan, kommer verktyget att mäta dess dimensioner korrekt.',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
question: 'Är det säkert att bearbeta privat text eller kodsnuttar?',
|
|
24
|
+
answer: 'Ja. Kalkylatorn fungerar helt lokalt. Inga data skickas till externa servrar, vilket garanterar fullständig integritet för dina projekt.',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const howToData = [
|
|
29
|
+
{ name: 'Ange texten', text: 'Skriv eller klistra in texten du vill mäta i inmatningsområdet.' },
|
|
30
|
+
{ name: 'Konfigurera typsnittet', text: 'Ställ in typsnittsfamilj, storlek i pixlar, vikt och om den ska vara kursiv.' },
|
|
31
|
+
{ name: 'Läs av resultatet', text: 'Pixelbredden och teckenantalet uppdateras i realtid.' },
|
|
32
|
+
{ name: 'Kopiera värdet', text: 'Klicka på "Kopiera bredd" för att spara pixelantalet till klippbordet.' },
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
const faqSchema: WithContext<FAQPage> = {
|
|
36
|
+
'@context': 'https://schema.org',
|
|
37
|
+
'@type': 'FAQPage',
|
|
38
|
+
mainEntity: faqData.map((item) => ({
|
|
39
|
+
'@type': 'Question',
|
|
40
|
+
name: item.question,
|
|
41
|
+
acceptedAnswer: { '@type': 'Answer', text: item.answer },
|
|
42
|
+
})),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const howToSchema: WithContext<HowTo> = {
|
|
46
|
+
'@context': 'https://schema.org',
|
|
47
|
+
'@type': 'HowTo',
|
|
48
|
+
name: 'Hur man mäter textbredd i pixlar',
|
|
49
|
+
step: howToData.map((s) => ({ '@type': 'HowToStep', name: s.name, text: s.text })),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const appSchema: WithContext<SoftwareApplication> = {
|
|
53
|
+
'@context': 'https://schema.org',
|
|
54
|
+
'@type': 'SoftwareApplication',
|
|
55
|
+
name: 'Textpixelbreddskalkylator',
|
|
56
|
+
applicationCategory: 'UtilitiesApplication',
|
|
57
|
+
operatingSystem: 'Web',
|
|
58
|
+
offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
|
|
59
|
+
description: 'Beräkna pixelbredden för valfri text korrekt baserat på typsnitt, storlek och stil.',
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const ui: TextPixelCalculatorUI = {
|
|
63
|
+
textLabel: 'Text att mäta',
|
|
64
|
+
textPlaceholder: 'Skriv eller klistra in texten du vill mäta här...',
|
|
65
|
+
defaultText: 'Hej världen',
|
|
66
|
+
fontLabel: 'Typsnittsfamilj',
|
|
67
|
+
sizeLabel: 'Storlek (px)',
|
|
68
|
+
weightLabel: 'Vikt',
|
|
69
|
+
italicLabel: 'Kursiv',
|
|
70
|
+
widthLabel: 'Bredd (pixlar)',
|
|
71
|
+
charsLabel: 'Tecken',
|
|
72
|
+
previewLabel: 'Visuell förhandsgranskning',
|
|
73
|
+
copyBtn: 'Kopiera bredd',
|
|
74
|
+
resetBtn: 'Återställ',
|
|
75
|
+
copyDone: 'Bredd kopierad',
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const content: ToolLocaleContent<TextPixelCalculatorUI> = {
|
|
79
|
+
slug: 'text-pixel-width-calculator-sv',
|
|
80
|
+
title: 'Text Pixel Beräknare',
|
|
81
|
+
description: 'Beräkna exakt hur bred en text är i pixlar baserat på typsnitt, storlek och stil. Gratis verktyg för designers och utvecklare.',
|
|
82
|
+
ui,
|
|
83
|
+
faqTitle: 'Vanliga frågor',
|
|
84
|
+
faq: faqData,
|
|
85
|
+
howTo: howToData,
|
|
86
|
+
bibliographyTitle: 'Referenser',
|
|
87
|
+
bibliography: [
|
|
88
|
+
{ name: 'W3C: CSS Text Module Level 3', url: 'https://www.w3.org/TR/css-text-3/' },
|
|
89
|
+
{ name: 'Google Fonts: Understanding variable fonts', url: 'https://fonts.google.com/knowledge/glossary/variable_fonts' },
|
|
90
|
+
],
|
|
91
|
+
schemas: [faqSchema, howToSchema, appSchema],
|
|
92
|
+
seo: [
|
|
93
|
+
{ type: 'title', level: 2, text: 'Mät den exakta pixelbredden för valfri text' },
|
|
94
|
+
{
|
|
95
|
+
type: 'paragraph',
|
|
96
|
+
html: 'Flödar din text över sin behållare? Behöver du veta hur mycket utrymme en rubrik tar upp innan den renderas? Webbläsarens <strong>Canvas API</strong> låter dig mäta den exakta bredden på valfri textsträng med pixelprecision, utan att rendera den i DOM.',
|
|
97
|
+
},
|
|
98
|
+
{ type: 'title', level: 3, text: 'Varför teckenräkning inte räcker' },
|
|
99
|
+
{
|
|
100
|
+
type: 'paragraph',
|
|
101
|
+
html: 'Moderna typsnitt är <strong>proportionella</strong>: varje glyf har en annan bredd. Ett "W" kan ta upp tre gånger mer utrymme än ett "i". Antalet tecken säger ingenting om det faktiska visuella utrymmet texten upptar.',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: 'list',
|
|
105
|
+
items: [
|
|
106
|
+
'<strong>Webbdesign:</strong> Förhindra spill i knappar, etiketter och tabellceller.',
|
|
107
|
+
'<strong>SEO:</strong> Sökmotorer trunkerar titlar efter pixlar, inte efter tecken.',
|
|
108
|
+
'<strong>Canvas och PDF:</strong> Beräkna den exakta positionen innan du ritar text programmatiskt.',
|
|
109
|
+
'<strong>Tooltips och bubblor:</strong> Storleksanpassa behållare dynamiskt baserat på den inre texten.',
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
{ type: 'title', level: 3, text: 'Hur mätning fungerar med Canvas' },
|
|
113
|
+
{
|
|
114
|
+
type: 'paragraph',
|
|
115
|
+
html: 'Metoden <code>ctx.measureText()</code> i Canvas API returnerar ett <code>TextMetrics</code>-objekt med en <code>width</code>-egenskap som speglar CSS-pixelbredden med det för närvarande aktiva typsnittet. Detta verktyg konfigurerar kontexten med ditt typsnitt, storlek, vikt och stil före mätning.',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: 'code',
|
|
119
|
+
ariaLabel: 'Exempel på Canvas measureText',
|
|
120
|
+
code: "const ctx = document.createElement('canvas').getContext('2d');\nctx.font = '700 16px Inter, system-ui, sans-serif';\nconst width = ctx.measureText('Hej världen').width; // t.ex. 74.5",
|
|
121
|
+
},
|
|
122
|
+
{ type: 'title', level: 3, text: 'Integritet och lokal bearbetning' },
|
|
123
|
+
{
|
|
124
|
+
type: 'paragraph',
|
|
125
|
+
html: 'All beräkning sker i din webbläsare. Ingen text, kodsnutt eller privat data lämnar din enhet.',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'tip',
|
|
129
|
+
title: 'Google Fonts typsnitt',
|
|
130
|
+
html: 'För att mäta ett Google Fonts-typsnitt korrekt, se först till att det är laddat på sidan eller installerat på ditt system. Annars kommer webbläsaren att falla tillbaka på ett ersättningstypsnitt och resultatet kommer att skilja sig.',
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
};
|