Skip to content

Commit

Permalink
add font
Browse files Browse the repository at this point in the history
  • Loading branch information
seadfeng committed Nov 1, 2024
1 parent f160115 commit 2dbe5b7
Show file tree
Hide file tree
Showing 4 changed files with 178 additions and 7 deletions.
14 changes: 9 additions & 5 deletions bin/transforms.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import { alternatingFontKeys, alternatingFonts, fonts, superFonts } from "../src/fonts";
import { alternatingFontKeys, alternatingFonts, fonts, RenameFonts, superFonts } from "../src/fonts";
import { FontKey } from "../src/transforms";

const outputFile = path.join(process.cwd(), 'src', 'transforms.ts');
Expand Down Expand Up @@ -34,10 +34,14 @@ Object.keys(alternatingFonts).forEach((fontKey) => {
const fontKeys = Object.keys(fonts).filter(key => key);

function toReadableFontName(key: string): string {
return key
.split(/(?=[A-Z])/)
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ')
if (key in RenameFonts) {
return RenameFonts[key];
} else {
return key
.split(/(?=[A-Z])/)
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ')
}
}

const fontsObject: FontMap = Object.fromEntries(
Expand Down
63 changes: 63 additions & 0 deletions src/fonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const fonts = {
squared: "\"\\ !#$%&'()*+,-./0123456789:;<=>?@🄰🄱🄲🄳🄴🄵🄶🄷🄸🄹🄺🄻🄼🄽🄾🄿🅀🅁🅂🅃🅄🅅🅆🅇🅈🅉[]^_`🄰🄱🄲🄳🄴🄵🄶🄷🄸🄹🄺🄻🄼🄽🄾🄿🅀🅁🅂🅃🅄🅅🅆🅇🅈🅉{|}~",
squaredNegative: "\"⧅ !#$%&'()⧆⊞,⊟⊡⧄0123456789:;<=>?@🅰🅱🅲🅳🅴🅵🅶🅷🅸🅹🅺🅻🅼🅽🅾🅿🆀🆁🆂🆃🆄🆅🆆🆇🆈🆉[]^_`🅰🅱🅲🅳🅴🅵🅶🅷🅸🅹🅺🅻🅼🅽🅾🅿🆀🆁🆂🆃🆄🆅🆆🆇🆈🆉{|}~",
parenthesized: "\"\\ !#$%&'()*+,-./0⑴⑵⑶⑷⑸⑹⑺⑻⑼:;<=>?@⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵[]^_`⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵{|}~",
block: "\"\\ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",
smallCaps: "\"\\ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴩꞯʀꜱᴛᴜᴠᴡxʏᴢ{|}~",
subscript: "\"\\ !#$%&'₍₎*₊,₋./₀₁₂₃₄₅₆₇₈₉:;<₌>?@ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘ🇶ʀꜱᴛᴜᴠᴡxʏᴢ[]^_`ₐᵦ𝒸𝒹ₑ𝒻𝓰ₕᵢⱼₖₗₘₙₒₚᵩᵣₛₜᵤᵥ𝓌ₓᵧ𝓏{|}~",
superscript: "\"\\ !#$%&'⁽⁾*⁺,⁻./⁰¹²³⁴⁵⁶⁷⁸⁹:;<⁼>?@ᴬᴮᶜᴰᴱᶠᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᵠᴿˢᵀᵁⱽᵂˣʸᶻ[]^_`ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖᵠʳˢᵗᵘᵛʷˣʸᶻ{|}~",
Expand All @@ -46,6 +47,8 @@ export const alternatingFontKeys = [
"alternatingSerifBold",
"alternatingSansBold",
"alternatingBubble",
"alternatingBubbleSquared",
"alternatingBlackBubbleSquared",
"alternatingSquared",
"alternatingBoldScript",
"alternatingBoldFraktur",
Expand All @@ -62,6 +65,8 @@ export const alternatingFonts: Record<AlternatingFontKey, FontKey[]> = {
alternatingSerifBold: ["serifBold", "normal"],
alternatingSansBold: ["sansBold", "sansSerif"],
alternatingBubble: ["bubble", "blackBubble"],
alternatingBubbleSquared: ["bubble", "squared"],
alternatingBlackBubbleSquared: ["blackBubble", "squaredNegative"],
alternatingSquared: ["squaredNegative", "squared"],
alternatingBoldScript: ["boldScript", "script"],
alternatingBoldFraktur: ["boldFraktur", "fraktur"],
Expand All @@ -73,9 +78,67 @@ export const alternatingFonts: Record<AlternatingFontKey, FontKey[]> = {
alternatingBold: ["sansBold", "serifBold"]
}

export const RenameFonts: Partial<Record<AlternatingFontKey, string>> = {
alternatingBubbleSquared: "White Shapes",
alternatingBlackBubbleSquared: "Black Shapes"
}

// áäÄéíóúÁÉÍÓÚàâæçèêëîïôœùûüÿÀÂÆÇÈÊËÎÏÔŒÙÛÜŸğĞöÖşŞıİ
export const superFonts = {
block: {
"A": "🇦\u200C",
"B": "🇧\u200C",
"C": "🇨\u200C",
"D": "🇩\u200C",
"E": "🇪\u200C",
"F": "🇫\u200C",
"G": "🇬\u200C",
"H": "🇭\u200C",
"I": "🇮\u200C",
"J": "🇯\u200C",
"K": "🇰\u200C",
"L": "🇱\u200C",
"M": "🇲\u200C",
"N": "🇳\u200C",
"O": "🇴\u200C",
"P": "🇵\u200C",
"Q": "🇶‌\u200C",
"R": "🇷‌\u200C",
"S": "🇸‌\u200C",
"T": "🇹\u200C",
"U": "🇺‌\u200C",
"V": "🇻\u200C",
"W": "🇼\u200C",
"X": "🇽\u200C",
"Y": "🇾\u200C",
"Z": "🇿\u200C",
"a": "🇦‌\u200C",
"b": "🇧\u200C",
"c": "🇨\u200C",
"d": "🇩\u200C",
"e": "🇪\u200C",
"f": "🇫\u200C",
"g": "🇬‌\u200C",
"h": "🇭\u200C",
"i": "🇮\u200C",
"j": "🇯\u200C",
"k": "🇰\u200C",
"l": "🇱\u200C",
"m": "🇲‌\u200C",
"n": "🇳\u200C",
"o": "🇴\u200C",
"p": "🇵\u200C",
"q": "🇶‌\u200C",
"r": "🇷‌\u200C",
"s": "🇸‌\u200C",
"t": "🇹\u200C",
"u": "🇺‌\u200C",
"v": "🇻\u200C",
"w": "🇼\u200C",
"x": "🇽\u200C",
"y": "🇾\u200C",
"z": "🇿\u200C"
},
sansSerif: {
"á": "𝖺́",
"ä": "𝖺̈",
Expand Down
5 changes: 3 additions & 2 deletions src/slugs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const styleFonts: Record<StyleKey, FontKey[]> = {
"bubble", "blackBubble", "alternatingBubble"
],
"square-text": [
"squared", "squaredNegative", "alternatingSquared"
"squared", "squaredNegative", "alternatingSquared", "block"
],
"alternating": [
"alternatingSerifBold",
Expand All @@ -94,7 +94,8 @@ export const styleFonts: Record<StyleKey, FontKey[]> = {
"alternatingItalicBold",
"alternatingCursiveScriptBold",
"alternatingFraktur",
"alternatingBold"
"alternatingBold",
"alternatingBlackBubbleSquared"
],
"sans-serif": [
"sansSerif",
Expand Down
103 changes: 103 additions & 0 deletions src/transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2588,6 +2588,103 @@ export const transforms = {
"}": "}",
"~": "~"
},
"block": {
"0": "0",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7",
"8": "8",
"9": "9",
"\"": "\"",
"\\": "\\",
" ": " ",
"!": "!",
"#": "#",
"$": "$",
"%": "%",
"&": "&",
"'": "'",
"(": "(",
")": ")",
"*": "*",
"+": "+",
",": ",",
"-": "-",
".": ".",
"/": "/",
":": ":",
";": ";",
"<": "<",
"=": "=",
">": ">",
"?": "?",
"@": "@",
"A": "🇦‌",
"B": "🇧‌",
"C": "🇨‌",
"D": "🇩‌",
"E": "🇪‌",
"F": "🇫‌",
"G": "🇬‌",
"H": "🇭‌",
"I": "🇮‌",
"J": "🇯‌",
"K": "🇰‌",
"L": "🇱‌",
"M": "🇲‌",
"N": "🇳‌",
"O": "🇴‌",
"P": "🇵‌",
"Q": "🇶‌‌",
"R": "🇷‌‌",
"S": "🇸‌‌",
"T": "🇹‌",
"U": "🇺‌‌",
"V": "🇻‌",
"W": "🇼‌",
"X": "🇽‌",
"Y": "🇾‌",
"Z": "🇿‌",
"[": "[",
"]": "]",
"^": "^",
"_": "_",
"`": "`",
"a": "🇦‌‌",
"b": "🇧‌",
"c": "🇨‌",
"d": "🇩‌",
"e": "🇪‌",
"f": "🇫‌",
"g": "🇬‌‌",
"h": "🇭‌",
"i": "🇮‌",
"j": "🇯‌",
"k": "🇰‌",
"l": "🇱‌",
"m": "🇲‌‌",
"n": "🇳‌",
"o": "🇴‌",
"p": "🇵‌",
"q": "🇶‌‌",
"r": "🇷‌‌",
"s": "🇸‌‌",
"t": "🇹‌",
"u": "🇺‌‌",
"v": "🇻‌",
"w": "🇼‌",
"x": "🇽‌",
"y": "🇾‌",
"z": "🇿‌",
"{": "{",
"|": "|",
"}": "}",
"~": "~"
},
"smallCaps": {
"0": "0",
"1": "1",
Expand Down Expand Up @@ -3853,6 +3950,8 @@ export const transforms = {
"alternatingSerifBold": {},
"alternatingSansBold": {},
"alternatingBubble": {},
"alternatingBubbleSquared": {},
"alternatingBlackBubbleSquared": {},
"alternatingSquared": {},
"alternatingBoldScript": {},
"alternatingBoldFraktur": {},
Expand Down Expand Up @@ -3885,6 +3984,7 @@ export const fontKeys = [
"squared",
"squaredNegative",
"parenthesized",
"block",
"smallCaps",
"subscript",
"superscript",
Expand Down Expand Up @@ -3922,6 +4022,7 @@ export const fonts: Record<FontKey, string> = {
"squared": "Squared",
"squaredNegative": "Squared Negative",
"parenthesized": "Parenthesized",
"block": "Block",
"smallCaps": "Small Caps",
"subscript": "Subscript",
"superscript": "Superscript",
Expand All @@ -3937,6 +4038,8 @@ export const fonts: Record<FontKey, string> = {
"alternatingSerifBold": "Alternating Serif Bold",
"alternatingSansBold": "Alternating Sans Bold",
"alternatingBubble": "Alternating Bubble",
"alternatingBubbleSquared": "White Shapes",
"alternatingBlackBubbleSquared": "Black Shapes",
"alternatingSquared": "Alternating Squared",
"alternatingBoldScript": "Alternating Bold Script",
"alternatingBoldFraktur": "Alternating Bold Fraktur",
Expand Down

0 comments on commit 2dbe5b7

Please sign in to comment.