Skip to content

Commit

Permalink
Add more fonts, and all locally
Browse files Browse the repository at this point in the history
  • Loading branch information
rberenguel committed Nov 11, 2024
1 parent ab0ef57 commit 94e6012
Show file tree
Hide file tree
Showing 23 changed files with 233 additions and 125 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,9 @@ All images are algorithmic art pieces I have created, see [mostlymaths.net/sketc
- Uses the [charts.js](https://chartsjs.org) plotting library.
- Uses the free and awesome [OpenMeteo API](https://open-meteo.com/en/docs).
- Many thanks to [Google Gemini](http://gemini.google.com") for the help.
- Added the following open source fonts:
- [Roboto Mono](https://fonts.google.com/specimen/Roboto+Mono)
- [Reforma 1969](https://pampatype.com/reforma) (or from [FontSquirrel](https://www.fontsquirrel.com/fonts/reforma) to see the license)
- [Inter](https://rsms.me/inter/)
- [Monoid](https://larsenwork.com/monoid/)

52 changes: 52 additions & 0 deletions fonts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@font-face {
font-family: "Inter";
src: url("./fonts/InterDisplay-Regular.woff2") format("woff2");
}
@font-face {
font-family: "Inter";
src: url("./fonts/InterDisplay-Bold.woff2") format("woff2");
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: "Inter";
src: url("./fonts/InterDisplay-Italic.woff2") format("woff2");
font-weight: normal;
font-style: italic;
}
@font-face {
font-family: "Roboto";
src: url("./fonts/Roboto-Regular.woff") format("woff");
}
@font-face {
font-family: "Reforma1969";
src: url("./fonts/Reforma1969-Blanca.woff2") format("woff2");
}
@font-face {
font-family: "Reforma1969";
src: url("./fonts/Reforma1969-Negra.woff") format("woff2");
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: "Reforma1969";
src: url("./fonts/Reforma1969-BlancaItalica.woff2") format("woff2");
font-weight: normal;
font-style: italic;
}
@font-face {
font-family: "Monoid";
src: url("./fonts/monoid-regular.woff2") format("woff2");
}
@font-face {
font-family: "Monoid";
src: url("./fonts/monoid-bold.woff2") format("woff2");
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: "Monoid";
src: url("./fonts/monoid-italic.woff2") format("woff2");
font-weight: normal;
font-style: italic;
}
Binary file added fonts/InterDisplay-Bold.woff2
Binary file not shown.
Binary file added fonts/InterDisplay-Italic.woff2
Binary file not shown.
Binary file added fonts/InterDisplay-Regular.woff2
Binary file not shown.
Binary file added fonts/Reforma1969-Blanca.woff2
Binary file not shown.
Binary file added fonts/Reforma1969-BlancaItalica.woff2
Binary file not shown.
Binary file added fonts/Reforma1969-Negra.woff
Binary file not shown.
Binary file added fonts/Roboto-Regular.woff
Binary file not shown.
Binary file added fonts/fontawesome/fa-regular-400.ttf
Binary file not shown.
Binary file added fonts/fontawesome/fa-regular-400.woff2
Binary file not shown.
Binary file added fonts/fontawesome/fa-solid-900.ttf
Binary file not shown.
Binary file added fonts/fontawesome/fa-solid-900.woff2
Binary file not shown.
25 changes: 25 additions & 0 deletions fonts/fontawesome/regular.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*!
* Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
* Copyright 2024 Fonticons, Inc.
*/
:root,
:host {
--fa-style-family-classic: "Font Awesome 6 Free";
--fa-font-regular: normal 400 1em/1 "Font Awesome 6 Free";
}

@font-face {
font-family: "Font Awesome 6 Free Regular";
font-style: normal;
font-weight: 400;
font-display: block;
src:
url("./fa-regular-400.woff2") format("woff2"),
url("./fa-regular-400.ttf") format("truetype");
}

.far,
.fa-regular {
font-weight: 400;
}
25 changes: 25 additions & 0 deletions fonts/fontawesome/solid.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*!
* Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
* Copyright 2024 Fonticons, Inc.
*/
:root,
:host {
--fa-style-family-classic: "Font Awesome 6 Free";
--fa-font-solid: normal 900 1em/1 "Font Awesome 6 Free";
}

@font-face {
font-family: "Font Awesome 6 Free Solid";
font-style: normal;
font-weight: 900;
font-display: block;
src:
url("./fa-solid-900.woff2") format("woff2"),
url("./fa-solid-900.ttf") format("truetype");
}

.fas,
.fa-solid {
font-weight: 900;
}
Binary file added fonts/monoid-bold.woff2
Binary file not shown.
Binary file added fonts/monoid-italic.woff2
Binary file not shown.
Binary file added fonts/monoid-regular.woff2
Binary file not shown.
5 changes: 1 addition & 4 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="fonts.css" />
<link rel="stylesheet" href="style.css" />
<link
href="https://fonts.googleapis.com/css?family=Roboto Mono"
rel="stylesheet"
/>
<script src="libs/chart.js"></script>
<script src="libs/chart-annotation.js"></script>
<title></title>
Expand Down
1 change: 0 additions & 1 deletion lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const linkRegex = /\[(.*?)\]\((.*?)\)/;
const linkPlusRegex = /\[(.*?)\]\((.*?)\)(\s*.*)/;
const linkWithShortcut = /`(.*?)`\s*\[(.*?)\]\((.*?)\)/;


function toTop(div) {
const allDivs = document.querySelectorAll("div");
const zs = Array.from(allDivs)
Expand Down
197 changes: 98 additions & 99 deletions lib/parser.js
Original file line number Diff line number Diff line change
@@ -1,120 +1,119 @@
function textToObject(text, hPos = 0, filepath) {
const lines = text.split("\n");
let obj = {};
obj._hPos = hPos;
obj._filepath = filepath;
obj.lines = []; // Only used (for now) for quotes
let settings = false;
let projects = false;
for (let i = 0; i < lines.length; i++) {
const line = lines[i].trim();
// Extract the task. If it has a link, it is the main link.
// Handle settings and projects inline, breaking.
if (line.startsWith("# ")) {
let cleaned = line.replace("# ", "").trim();
if (cleaned == "Settings") {
settings = true;
obj._valid = true;
obj.settings = {};
continue;
}
if (cleaned == "Projects") {
projects = true;
obj._valid = true;
obj.projects = [];
continue;
}
if (cleaned == "hr") {
obj.hr = true;
obj._valid = true;
continue;
}
if (cleaned.startsWith("[x]") || cleaned.startsWith("[X]")) {
obj.done = true;
cleaned = cleaned.slice(3);
}
if (cleaned.endsWith("(someday)") || cleaned.endsWith("(Someday)")) {
obj.someday = true;
obj.prio = -1000;
cleaned = cleaned.replace(/\s+\(.omeday\)/, "");
}
const linkMatch = cleaned.match(linkPlusRegex);
if (linkMatch) {
obj.text = linkMatch[1] + (linkMatch[3] ?? "");
obj.link = linkMatch[2];
} else {
obj.text = cleaned;
}
const lines = text.split("\n");
let obj = {};
obj._hPos = hPos;
obj._filepath = filepath;
obj.lines = []; // Only used (for now) for quotes
let settings = false;
let projects = false;
for (let i = 0; i < lines.length; i++) {
const line = lines[i].trim();
// Extract the task. If it has a link, it is the main link.
// Handle settings and projects inline, breaking.
if (line.startsWith("# ")) {
let cleaned = line.replace("# ", "").trim();
if (cleaned == "Settings") {
settings = true;
obj._valid = true;
obj.settings = {};
continue;
}
if (line == "[x]" || line == "[X]") {
obj.done = true;
if (cleaned == "Projects") {
projects = true;
obj._valid = true;
obj.projects = [];
continue;
}
if (line.startsWith("> ")) {
obj.lines.push(line.replace(/^> /, ""));
if (cleaned == "hr") {
obj.hr = true;
obj._valid = true;
continue;
}
if (line.startsWith("prio:") ) {
if(!obj.someday){
obj.prio = parseInt(line.replace("prio:", ""));
}
continue;
if (cleaned.startsWith("[x]") || cleaned.startsWith("[X]")) {
obj.done = true;
cleaned = cleaned.slice(3);
}
if (line.startsWith("color:")) {
obj.color = line.replace("color:", "").trim();
continue;
if (cleaned.endsWith("(someday)") || cleaned.endsWith("(Someday)")) {
obj.someday = true;
obj.prio = -1000;
cleaned = cleaned.replace(/\s+\(.omeday\)/, "");
}
if (line.startsWith("extracolor:")) {
obj.extraColor = line.replace("extracolor:", "").trim();
continue;
const linkMatch = cleaned.match(linkPlusRegex);
if (linkMatch) {
obj.text = linkMatch[1] + (linkMatch[3] ?? "");
obj.link = linkMatch[2];
} else {
obj.text = cleaned;
}
obj._valid = true;
continue;
}
if (line == "[x]" || line == "[X]") {
obj.done = true;
continue;
}
if (line.startsWith("> ")) {
obj.lines.push(line.replace(/^> /, ""));
obj._valid = true;
continue;
}
if (line.startsWith("prio:")) {
if (!obj.someday) {
obj.prio = parseInt(line.replace("prio:", ""));
}
continue;
}
if (line.startsWith("color:")) {
obj.color = line.replace("color:", "").trim();
continue;
}
if (line.startsWith("extracolor:")) {
obj.extraColor = line.replace("extracolor:", "").trim();
continue;
}

// Get the lists of links or properties if it's a settings list
if (line.startsWith("- ")) {
const cleaned = line.replace("- ", "").trim();
if (settings) {
const [prop, val] = cleaned.split(":");
obj.settings[prop.trim()] = val.trim();
continue;
}
if (projects) {
const thingy = cleaned.split(",");
if (thingy.length == 1) {
obj.projects.push(thingy[0]);
} else {
obj.projects.push(thingy.map((p) => p.trim()));
}
continue;
// Get the lists of links or properties if it's a settings list
if (line.startsWith("- ")) {
const cleaned = line.replace("- ", "").trim();
if (settings) {
const [prop, val] = cleaned.split(":");
obj.settings[prop.trim()] = val.trim();
continue;
}
if (projects) {
const thingy = cleaned.split(",");
if (thingy.length == 1) {
obj.projects.push(thingy[0]);
} else {
obj.projects.push(thingy.map((p) => p.trim()));
}
const linkMatch = cleaned.match(linkRegex);
if (linkMatch) {
if (obj.links) {
obj.links.push([linkMatch[1], linkMatch[2]]);
} else {
obj.links = [[linkMatch[1], linkMatch[2]]];
}
continue;
continue;
}
const linkMatch = cleaned.match(linkRegex);
if (linkMatch) {
if (obj.links) {
obj.links.push([linkMatch[1], linkMatch[2]]);
} else {
// If we are in a list, haven't matched a known property,
// and match no link, we are in a log message.
if (obj.msg) {
obj.msg.push(cleaned);
} else {
obj.msg = [cleaned];
}
obj.links = [[linkMatch[1], linkMatch[2]]];
}
continue;
} else {
// If the line does not start a list and we have not processed a known command…
const cleaned = line.trim();
if (cleaned) {
// Could be empty, so…
obj.extra = cleaned;
// If we are in a list, haven't matched a known property,
// and match no link, we are in a log message.
if (obj.msg) {
obj.msg.push(cleaned);
} else {
obj.msg = [cleaned];
}
}
} else {
// If the line does not start a list and we have not processed a known command…
const cleaned = line.trim();
if (cleaned) {
// Could be empty, so…
obj.extra = cleaned;
}
}
return obj;
}

return obj;
}
Loading

0 comments on commit 94e6012

Please sign in to comment.