Skip to content

Commit 0398c8d

Browse files
committed
Add era-appropriate system fonts
Uses Chicago and Charcoal for the Classic and Platinum appearances. Fixes #211
1 parent 9916392 commit 0398c8d

File tree

12 files changed

+77
-12
lines changed

12 files changed

+77
-12
lines changed

index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@
2020
crossorigin="anonymous"
2121
href="/src/Fonts/AppleGaramond.woff2"
2222
/>
23+
<link
24+
rel="preload"
25+
as="font"
26+
crossorigin="anonymous"
27+
href="/src/Fonts/ChicagoFLF.woff2"
28+
/>
29+
<link
30+
rel="preload"
31+
as="font"
32+
crossorigin="anonymous"
33+
href="/src/Fonts/Charcoal.woff2"
34+
/>
2335
<title>Infinite Mac</title>
2436
</head>
2537
<body>

src/About.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {useEffect, useRef, useState} from "react";
22
import {Dialog} from "./controls/Dialog";
33
import {Donate} from "./Donate";
44
import * as varz from "./varz";
5+
import {appearanceSystemFont} from "./controls/Appearance";
56

67
export function About({onDone}: {onDone: () => void}) {
78
const email = [
@@ -18,14 +19,21 @@ export function About({onDone}: {onDone: () => void}) {
1819
const aboutContainerRef = useRef<HTMLDivElement>(null);
1920

2021
useEffect(() => {
22+
const aboutContainerDom = aboutContainerRef.current;
23+
console.log(aboutContainerDom);
24+
if (!aboutContainerDom) {
25+
return;
26+
}
27+
for (const headings of aboutContainerDom.querySelectorAll("h2")) {
28+
headings.classList.add(appearanceSystemFont("Classic"));
29+
}
30+
2131
const emailLink =
22-
aboutContainerRef.current?.querySelector<HTMLAnchorElement>(
23-
".email"
24-
);
32+
aboutContainerDom.querySelector<HTMLAnchorElement>(".email");
2533
if (emailLink) {
2634
emailLink.href = `mailto:${email}`;
2735
}
28-
const donateLink = aboutContainerRef.current?.querySelector(".donate");
36+
const donateLink = aboutContainerDom.querySelector(".donate");
2937
if (donateLink) {
3038
const showDonate = () => setDonateVisible(true);
3139
donateLink.addEventListener("click", showDonate);

src/Browser.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@
141141
}
142142

143143
.DiskContents .Row {
144-
margin-bottom: 1em;
144+
margin-bottom: 18px;
145145
}
146146

147147
@media (max-width: 440px) {
148148
.DiskContents .Row {
149-
margin-bottom: 0.5em;
149+
margin-bottom: 12px;
150150
}
151151
}
152152

src/Fonts/Charcoal.woff2

31.5 KB
Binary file not shown.

src/Fonts/ChicagoFLF.woff2

16.8 KB
Binary file not shown.

src/controls/Appearance.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* ChicagoFLF is a TrueType version of Chicago, downloaded from
2+
https://tinkerdifferent.com/resources/collection-of-classic-apple-fonts-for-your-modern-computer.130/ */
3+
@font-face {
4+
font-family: "ChicagoFLF";
5+
src: url(../Fonts/ChicagoFLF.woff2);
6+
font-display: swap;
7+
font-weight: 400;
8+
font-style: normal;
9+
}
10+
11+
/* Charcoal downloaded from https://os9.ca/ */
12+
@font-face {
13+
font-family: "Charcoal";
14+
src: url(../Fonts/Charcoal.woff2);
15+
font-display: swap;
16+
font-weight: 400;
17+
font-style: normal;
18+
}
19+
20+
.AppearanceSystemFont-Classic {
21+
font-family: "ChicagoFLF", "Helvetica", "Arial", sans-serif;
22+
font-weight: normal !important;
23+
}
24+
25+
.AppearanceSystemFont-Platinum {
26+
font-family: "Charcoal", "Helvetica", "Arial", sans-serif;
27+
font-weight: normal !important;
28+
}
29+
30+
.AppearanceSystemFont-NeXT {
31+
font-family: "Helvetica", "Arial", sans-serif;
32+
}

src/controls/Appearance.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1+
import "./Appearance.css";
2+
13
export type Appearance = "Classic" | "Platinum" | "NeXT";
4+
5+
export function appearanceSystemFont(appearance: Appearance) {
6+
return `AppearanceSystemFont-${appearance}`;
7+
}

src/controls/Button.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
padding: 1px 8px;
88
font-size: 13px;
99
color: #000;
10-
font-family: "Helvetica", "Arial", sans-serif;
1110
font-weight: bold;
1211
user-select: none;
1312
white-space: nowrap;
@@ -33,6 +32,7 @@
3332

3433
.Button.Button-Classic {
3534
border-image-source: url(../Images/ClassicButton.png);
35+
line-height: 13px;
3636
}
3737

3838
.Button.Button-Classic:active {
@@ -41,6 +41,7 @@
4141

4242
.Button.Button-Platinum {
4343
border-image-source: url(../Images/PlatinumButton.png);
44+
line-height: 13px;
4445
}
4546

4647
.Button.Button-Platinum:active {

src/controls/Button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import classNames from "classnames";
22
import "./Button.css";
3-
import {type Appearance} from "./Appearance";
3+
import {appearanceSystemFont, type Appearance} from "./Appearance";
44

55
export function Button({
66
appearance,
@@ -13,6 +13,7 @@ export function Button({
1313
const buttonClassName = classNames(
1414
"Button",
1515
`Button-${appearance}`,
16+
appearanceSystemFont(appearance),
1617
className
1718
);
1819
return (

src/controls/Dialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ReactDOM from "react-dom";
33
import {Button} from "./Button";
44
import "./Dialog.css";
55
import classNames from "classnames";
6-
import {type Appearance} from "./Appearance";
6+
import {appearanceSystemFont, type Appearance} from "./Appearance";
77

88
export function Dialog({
99
title,
@@ -36,7 +36,7 @@ export function Dialog({
3636
`Dialog-${appearance}`,
3737
className
3838
)}>
39-
<h1>{title}</h1>
39+
<h1 className={appearanceSystemFont(appearance)}>{title}</h1>
4040

4141
<div className="Dialog-Content">{children}</div>
4242

0 commit comments

Comments
 (0)