From c42b9f69963b9d62e850a64361a76f15e1d4fd99 Mon Sep 17 00:00:00 2001 From: diondiondion Date: Wed, 10 Dec 2025 17:26:46 +0100 Subject: [PATCH] Implement custom font for Wrapstodon heading (#37193) --- .../fonts/silkscreen-wrapstodon/OFL.txt | 100 ++++++++++++++++++ .../silkscreen-regular.woff2 | Bin 0 -> 2696 bytes .../annual_report/annual_report.stories.tsx | 6 -- .../features/annual_report/index.module.scss | 67 +++++++++--- .../mastodon/features/annual_report/index.tsx | 10 +- .../annual_report/shared_page.module.css | 3 +- app/javascript/mastodon/locales/en.json | 1 - 7 files changed, 155 insertions(+), 32 deletions(-) create mode 100644 app/javascript/fonts/silkscreen-wrapstodon/OFL.txt create mode 100644 app/javascript/fonts/silkscreen-wrapstodon/silkscreen-regular.woff2 diff --git a/app/javascript/fonts/silkscreen-wrapstodon/OFL.txt b/app/javascript/fonts/silkscreen-wrapstodon/OFL.txt new file mode 100644 index 00000000000..63c1c98e1e9 --- /dev/null +++ b/app/javascript/fonts/silkscreen-wrapstodon/OFL.txt @@ -0,0 +1,100 @@ +Below you'll find the original License file for the Silkscreen font. +The file used on Mastodon is a custom file subset to only include the +characters "Wrapstodon 0123456789" using the Font Squirrel Font-face Generator +(https://www.fontsquirrel.com/tools/webfont-generator) + +----------------------------------------------------------- + +Copyright 2001 The Silkscreen Project Authors (https://github.com/googlefonts/silkscreen) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/app/javascript/fonts/silkscreen-wrapstodon/silkscreen-regular.woff2 b/app/javascript/fonts/silkscreen-wrapstodon/silkscreen-regular.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..3b7ba43e9c36f5682fa130f1e0b1ca196bfe18b0 GIT binary patch literal 2696 zcmV;33U~E)Pew8T0RR9101Aiz5&!@I02<@~016`j0RR9100000000000000000000 z0000#Mn+Uk92ztmARKlEU;u+62owo~Wf2Gpm~@p03s3+7HUcCAfgA)N1&Lw@fqo2u z2ODh{6K;$=Y#e~V-v-G3FUgHDum;R-MeHC85p|y!!#Ct3N0lHZcof95=%(226qUVzMj5;_SA3c$J0&C&waE5I${;C8?l2n5tPU0r^dMU!W& z`b{D-SAh0Q4SJTCI1lg-otim08hdtjY%x!Cnos>{3s(Qr#@a>1g8WSI%|a_``KV1V zR^dUa`hk~rt!h=?T>M*|(yg3B_ynJ(znN8Oss@y{SkJv8p@2nkKmQn0=K#=7b* zW*l6wLPG`Wz*=#4Low>czB`-uY6$c9Dr!g?8z>8Hh2|iHmXc6u4rBf{7cS+jd#h5a z-Q^q36lQ|0wk8>FFTX#OJCH0$>_qW=&LrGW@2sx#;*AtR%!0Ow?Zu8LFW zs->){W_lWHwGB4g@32cf8*d)bb6vl`|JUh~k)!uIILPn4{=NS8>*G34U|4!>RZMAFP!OK$Us3b&VzrXLyjLK>8 z01Zg&#PL3Zqw5S%wP}c+spiKgw8!)XF0mxdhtu>6>iO`xbHFq!mOf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&$cnJedB^3}mV!z!Y2CzgTX zK3;JaqBmh2fSQ3`6FfCvyZr#~3UQbZTjL_=bqq)uSJ<+?V1!^?BaeuonT*8)0001} C8}H}< literal 0 HcmV?d00001 diff --git a/app/javascript/mastodon/features/annual_report/annual_report.stories.tsx b/app/javascript/mastodon/features/annual_report/annual_report.stories.tsx index 20a3735e15b..3ccaceae6c5 100644 --- a/app/javascript/mastodon/features/annual_report/annual_report.stories.tsx +++ b/app/javascript/mastodon/features/annual_report/annual_report.stories.tsx @@ -42,14 +42,12 @@ export const Standalone: Story = { args: { context: 'standalone', }, - render: (args) => , }; export const InModal: Story = { args: { context: 'modal', }, - render: (args) => , }; export const ArchetypeOracle: Story = { @@ -62,7 +60,6 @@ export const ArchetypeOracle: Story = { }), }, }, - render: (args) => , }; export const NoHashtag: Story = { @@ -74,7 +71,6 @@ export const NoHashtag: Story = { }), }, }, - render: (args) => , }; export const NoNewPosts: Story = { @@ -88,7 +84,6 @@ export const NoNewPosts: Story = { }), }, }, - render: (args) => , }; export const NoNewPostsNoHashtag: Story = { @@ -101,5 +96,4 @@ export const NoNewPostsNoHashtag: Story = { }), }, }, - render: (args) => , }; diff --git a/app/javascript/mastodon/features/annual_report/index.module.scss b/app/javascript/mastodon/features/annual_report/index.module.scss index 0258f9c7983..95ebb727298 100644 --- a/app/javascript/mastodon/features/annual_report/index.module.scss +++ b/app/javascript/mastodon/features/annual_report/index.module.scss @@ -1,3 +1,14 @@ +$mobile-breakpoint: 540px; + +@font-face { + font-family: silkscreen-wrapstodon; + src: url('@/fonts/silkscreen-wrapstodon/silkscreen-regular.woff2') + format('woff2'); + font-weight: normal; + font-display: swap; + font-style: normal; +} + .modalWrapper { position: absolute; inset: 0; @@ -9,22 +20,33 @@ pointer-events: none; scrollbar-color: var(--color-text-secondary) var(--color-bg-secondary); + @media (width < $mobile-breakpoint) { + padding-inline: 10px; + } + .loading-indicator .circular-progress { color: var(--lime); } } .closeButton { - position: absolute; - top: 24px; - right: 24px; - padding: 8px; - border-radius: 100%; - --default-icon-color: var(--color-bg-primary); --default-bg-color: var(--color-text-primary); --hover-icon-color: var(--color-bg-primary); --hover-bg-color: var(--color-text-primary); + --corner-distance: 18px; + + position: absolute; + top: var(--corner-distance); + right: var(--corner-distance); + padding: 8px; + border-radius: 100%; + + @media (width < $mobile-breakpoint) { + --corner-distance: 16px; + + padding: 4px; + } } .wrapper { @@ -45,8 +67,10 @@ var(--color-bg-primary); border-radius: 40px; - @media (width < 600px) { - padding: 12px; + @media (width < $mobile-breakpoint) { + padding-inline: 12px; + padding-bottom: 12px; + border-radius: 28px; } &::after { @@ -65,13 +89,16 @@ text-align: center; h1 { - font-family: monospace; - text-transform: uppercase; - letter-spacing: 0.15em; - font-size: 30px; - font-weight: 600; - line-height: 1.5; + font-family: silkscreen-wrapstodon, monospace; + font-size: 28px; + line-height: 1; margin-bottom: 8px; + padding-inline: 40px; // Prevent overlap with close button + + @media (width < $mobile-breakpoint) { + font-size: 22px; + margin-bottom: 4px; + } } p { @@ -150,6 +177,10 @@ font-weight: 500; line-height: 1; overflow-wrap: break-word; + + @media (width < $mobile-breakpoint) { + font-size: 24px; + } } .mostBoostedPost { @@ -166,7 +197,7 @@ 'followers hashtag' 'new-posts hashtag'; - @media (width < 680px) { + @media (width < $mobile-breakpoint) { grid-template-columns: 1fr 1fr; grid-template-areas: 'followers new-posts' @@ -191,7 +222,7 @@ grid-template-columns: 1fr 2fr; grid-template-areas: 'number hashtag'; - @media (width < 680px) { + @media (width < $mobile-breakpoint) { grid-template-areas: 'number number' 'hashtag hashtag'; @@ -230,6 +261,10 @@ flex-direction: column; align-items: center; gap: 12px; + + p { + max-width: 460px; + } } .archetypeArtboard { diff --git a/app/javascript/mastodon/features/annual_report/index.tsx b/app/javascript/mastodon/features/annual_report/index.tsx index 15266d7e264..91fd02c7a7c 100644 --- a/app/javascript/mastodon/features/annual_report/index.tsx +++ b/app/javascript/mastodon/features/annual_report/index.tsx @@ -1,7 +1,7 @@ import { useCallback, useEffect, useState } from 'react'; import type { FC } from 'react'; -import { defineMessage, FormattedMessage, useIntl } from 'react-intl'; +import { defineMessage, useIntl } from 'react-intl'; import { useLocation } from 'react-router'; @@ -75,13 +75,7 @@ export const AnnualReport: FC<{ context?: 'modal' | 'standalone' }> = ({ return (
-

- -

+

Wrapstodon {report.year}

{account &&

@{account.acct}

} {context === 'modal' && ( That puts you in the topof {domain} users.", "annual_report.summary.percentile.we_wont_tell_bernie": "We won't tell Bernie.", "annual_report.summary.share_message": "I got the {archetype} archetype!", - "annual_report.summary.title": "Wrapstodon {year}", "attachments_list.unprocessed": "(unprocessed)", "audio.hide": "Hide audio", "block_modal.remote_users_caveat": "We will ask the server {domain} to respect your decision. However, compliance is not guaranteed since some servers may handle blocks differently. Public posts may still be visible to non-logged-in users.",